Problems after version 0.3.1 have been resolved

This commit is contained in:
Furkan 2023-01-21 03:43:51 +03:00
parent 0cab155c53
commit 875d3030a4
10 changed files with 193 additions and 150 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"permission_handler_apple","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_apple-9.0.7\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\photo_gallery-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_avfoundation-2.3.8\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"permission_handler_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_android-10.2.0\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\photo_gallery-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_android-2.3.10\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[{"name":"permission_handler_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_windows-0.1.2\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"video_player_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_web-2.0.13\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"photo_gallery","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"video_thumbnail","dependencies":[]}],"date_created":"2023-01-20 10:38:51.103847","version":"3.3.10"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"permission_handler_apple","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_apple-9.0.7\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\photo_gallery-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_avfoundation-2.3.8\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"permission_handler_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_android-10.2.0\\\\","native_build":true,"dependencies":[]},{"name":"photo_gallery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\photo_gallery-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_android-2.3.10\\\\","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_thumbnail-0.5.3\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[{"name":"permission_handler_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler_windows-0.1.2\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"video_player_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\video_player_web-2.0.13\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"photo_gallery","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"video_thumbnail","dependencies":[]}],"date_created":"2023-01-21 03:35:10.968143","version":"3.3.10"}

View File

@ -104,3 +104,7 @@
## 0.3.1
* fixes formatting issues
## 0.3.2
* Problems after version 0.3.1 have been resolved

View File

@ -224,6 +224,7 @@ A Config class is provided to user to customize your gallery picker. You can cus
```dart
List<MediaFile>? media = await GalleryPicker.pickMedia(
context: context,
pageTransitionType: PageTransitionType.rightToLeft
config: Config(
backgroundColor: Colors.white,
permissionDeniedPage:PermissionDeniedPage(),

View File

@ -173,7 +173,6 @@ class _MyHomePageState extends State<MyHomePage> {
Future<void> pickMedia() async {
List<MediaFile>? media = await GalleryPicker.pickMedia(
context: context,
config: Config(lastWeek: "Bu hafta"),
initSelectedMedia: selectedMedias,
extraRecentMedia: selectedMedias,
startWithRecent: true);

View File

@ -21,7 +21,7 @@ packages:
name: bottom_sheet_scaffold
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
version: "0.1.2"
camera:
dependency: "direct dev"
description:
@ -141,7 +141,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.3.1"
version: "0.3.2"
get:
dependency: transitive
description:
@ -198,6 +198,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
page_transition:
dependency: transitive
description:
name: page_transition
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
path:
dependency: transitive
description:

View File

@ -47,7 +47,7 @@ class PhoneGalleryController extends GetxController {
late bool startWithRecent;
late bool isRecent;
bool permissionGranted = false;
bool? permissionGranted;
bool configurationCompleted = false;
late Function(List<MediaFile> selectedMedias) onSelect;
Widget Function(String tag, MediaFile media, BuildContext context)?
@ -70,12 +70,13 @@ class PhoneGalleryController extends GetxController {
GalleryAlbum? selectedAlbum;
void resetBottomSheetView() {
if (permissionGranted) {
if (permissionGranted == true) {
isRecent = true;
if (selectedAlbum == null) {
pickerPageController.jumpToPage(0);
} else {
pageController.jumpToPage(0);
pickerPageController = PageController();
}
selectedAlbum = null;
update();
@ -112,6 +113,7 @@ class PhoneGalleryController extends GetxController {
required bool isBottomSheet}) async {
_selectedFiles.clear();
selectedAlbum = album;
update();
updatePickerListener();
await pageController.animateToPage(1,
duration: const Duration(milliseconds: 500), curve: Curves.easeIn);
@ -121,9 +123,11 @@ class PhoneGalleryController extends GetxController {
_selectedFiles.clear();
_pickerMode = false;
pickerPageController = PageController(initialPage: 1);
update();
await pageController.animateToPage(0,
duration: const Duration(milliseconds: 500), curve: Curves.easeIn);
selectedAlbum = null;
update();
}
void unselectMedia(MediaFile file) {

View File

@ -6,6 +6,7 @@ export 'models/mode.dart';
export 'models/medium.dart';
export 'models/gallery_media.dart';
export 'models/gallery_album.dart';
export 'package:page_transition/src/enum.dart';
export 'user_widgets/thumbnail_media.dart';
export 'user_widgets/album_categories_view.dart';
export 'user_widgets/album_media_view.dart';
@ -21,6 +22,7 @@ import 'package:bottom_sheet_scaffold/bottom_sheet_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:gallery_picker/models/gallery_media.dart';
import 'package:get/get.dart';
import 'package:page_transition/page_transition.dart';
import '../../controller/gallery_controller.dart';
import 'controller/picker_listener.dart';
import 'models/config.dart';
@ -49,14 +51,16 @@ class GalleryPicker {
{Config? config,
bool startWithRecent = false,
bool singleMedia = false,
PageTransitionType pageTransitionType = PageTransitionType.rightToLeft,
List<MediaFile>? initSelectedMedia,
List<MediaFile>? extraRecentMedia,
required BuildContext context}) async {
List<MediaFile>? media;
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GalleryPickerView(
PageTransition(
type: pageTransitionType,
child: GalleryPickerView(
onSelect: (mediaTmp) {
media = mediaTmp;
},
@ -65,8 +69,7 @@ class GalleryPicker {
initSelectedMedia: initSelectedMedia,
extraRecentMedia: extraRecentMedia,
startWithRecent: startWithRecent,
)),
);
)));
return media;
}
@ -77,14 +80,16 @@ class GalleryPicker {
Widget Function(String tag, MediaFile media, BuildContext context)?
heroBuilder,
bool singleMedia = false,
PageTransitionType pageTransitionType = PageTransitionType.rightToLeft,
List<MediaFile>? initSelectedMedia,
List<MediaFile>? extraRecentMedia,
bool startWithRecent = false,
required BuildContext context}) async {
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GalleryPickerView(
PageTransition(
type: pageTransitionType,
child: GalleryPickerView(
onSelect: (media) {},
multipleMediaBuilder: multipleMediaBuilder,
heroBuilder: heroBuilder,
@ -93,8 +98,7 @@ class GalleryPicker {
initSelectedMedia: initSelectedMedia,
extraRecentMedia: extraRecentMedia,
startWithRecent: startWithRecent,
)),
);
)));
}
static Future<void> openSheet() async {
@ -103,9 +107,6 @@ class GalleryPicker {
static Future<void> closeSheet() async {
BottomSheetPanel.close();
if (GetInstance().isRegistered<PhoneGalleryController>()) {
Get.find<PhoneGalleryController>().resetBottomSheetView();
}
}
static bool get isSheetOpened {

View File

@ -89,12 +89,13 @@ class _GalleryPickerState extends State<GalleryPickerView> {
double width = MediaQuery.of(context).size.width;
return GetBuilder<PhoneGalleryController>(builder: (controller) {
return GetInstance().isRegistered<PhoneGalleryController>()
? controller.permissionGranted
? controller.permissionGranted != false
? PageView(
controller: controller.pageController,
physics: const NeverScrollableScrollPhysics(),
children: [
Scaffold(
WillPopScope(
child: Scaffold(
backgroundColor: config.backgroundColor,
appBar: PickerAppBar(
controller: controller,
@ -107,7 +108,8 @@ class _GalleryPickerState extends State<GalleryPickerView> {
height: 48,
color: config.appbarColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Container(
decoration: controller.isRecent
@ -130,13 +132,15 @@ class _GalleryPickerState extends State<GalleryPickerView> {
curve: Curves.easeIn);
setState(() {
controller.isRecent = true;
controller.switchPickerMode(false);
controller
.switchPickerMode(false);
});
},
child: Text(config.recents,
style: controller.isRecent
? config.selectedMenuStyle
: config.unselectedMenuStyle)),
: config
.unselectedMenuStyle)),
),
Container(
decoration: !controller.isRecent
@ -189,7 +193,8 @@ class _GalleryPickerState extends State<GalleryPickerView> {
? AlbumMediasView(
galleryAlbum: controller.recent!,
controller: controller,
isBottomSheet: widget.isBottomSheet,
isBottomSheet:
widget.isBottomSheet,
singleMedia: widget.singleMedia)
: const Center(
child: CircularProgressIndicator(
@ -205,6 +210,12 @@ class _GalleryPickerState extends State<GalleryPickerView> {
],
),
),
onWillPop: () async {
if (!widget.isBottomSheet) {
controller.disposeController();
}
return true;
}),
AlbumPage(
album: controller.selectedAlbum,
controller: controller,
@ -212,9 +223,11 @@ class _GalleryPickerState extends State<GalleryPickerView> {
isBottomSheet: widget.isBottomSheet)
],
)
: controller.config.permissionDeniedPage ??
: Material(
child: controller.config.permissionDeniedPage ??
PermissionDeniedView(
config: controller.config,
),
)
: ReloadGallery(
config,

View File

@ -109,6 +109,19 @@ class PickerScaffold extends StatelessWidget {
backgroundColor: backgroundColor,
bottomNavigationBar: bottomNavigationBar,
body: body,
onWillPop: () async {
if (BottomSheetPanel.isOpen) {
if (GetInstance().isRegistered<PhoneGalleryController>() &&
Get.find<PhoneGalleryController>().selectedAlbum != null) {
Get.find<PhoneGalleryController>().backToPicker();
} else {
BottomSheetPanel.close();
}
return false;
} else {
return true;
}
},
bottomSheet: DraggableBottomSheet(
draggableBody: true,
maxHeight: MediaQuery.of(context).size.height,

View File

@ -1,6 +1,6 @@
name: gallery_picker
description: Gallery Picker is a flutter package that will allow you to pick media file(s), manage and navigate inside your gallery with modern tools and views.
version: 0.3.1
version: 0.3.2
homepage: https://github.com/FlutterWay/gallery_picker
environment:
@ -18,7 +18,8 @@ dependencies:
get: ^4.6.5
video_thumbnail: ^0.5.3
intl: ^0.18.0
bottom_sheet_scaffold: ^0.1.1
page_transition: ^2.0.9
bottom_sheet_scaffold: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter