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 ## 0.3.1
* fixes formatting issues * 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 ```dart
List<MediaFile>? media = await GalleryPicker.pickMedia( List<MediaFile>? media = await GalleryPicker.pickMedia(
context: context, context: context,
pageTransitionType: PageTransitionType.rightToLeft
config: Config( config: Config(
backgroundColor: Colors.white, backgroundColor: Colors.white,
permissionDeniedPage:PermissionDeniedPage(), permissionDeniedPage:PermissionDeniedPage(),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -109,6 +109,19 @@ class PickerScaffold extends StatelessWidget {
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
bottomNavigationBar: bottomNavigationBar, bottomNavigationBar: bottomNavigationBar,
body: body, 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( bottomSheet: DraggableBottomSheet(
draggableBody: true, draggableBody: true,
maxHeight: MediaQuery.of(context).size.height, maxHeight: MediaQuery.of(context).size.height,

View File

@ -1,6 +1,6 @@
name: gallery_picker 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. 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 homepage: https://github.com/FlutterWay/gallery_picker
environment: environment:
@ -18,7 +18,8 @@ dependencies:
get: ^4.6.5 get: ^4.6.5
video_thumbnail: ^0.5.3 video_thumbnail: ^0.5.3
intl: ^0.18.0 intl: ^0.18.0
bottom_sheet_scaffold: ^0.1.1 page_transition: ^2.0.9
bottom_sheet_scaffold: ^0.1.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter