From 41af4a30bf3b1711b9ee69b275f93388178b3fd4 Mon Sep 17 00:00:00 2001 From: mike doornenbal Date: Wed, 7 Aug 2024 13:50:39 +0200 Subject: [PATCH] fix: upgrade image_picker to 4.0.0 --- .../creation/widgets/image_picker.dart | 21 +++++++++++-------- packages/flutter_chat/pubspec.yaml | 5 ++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/flutter_chat/lib/src/screens/creation/widgets/image_picker.dart b/packages/flutter_chat/lib/src/screens/creation/widgets/image_picker.dart index 66c4108..6604840 100644 --- a/packages/flutter_chat/lib/src/screens/creation/widgets/image_picker.dart +++ b/packages/flutter_chat/lib/src/screens/creation/widgets/image_picker.dart @@ -23,10 +23,9 @@ Future onPressSelectImage( padding: const EdgeInsets.all(8.0), color: Colors.white, child: ImagePicker( - imagePickerTheme: ImagePickerTheme( + theme: ImagePickerTheme( title: options.translations.imagePickerTitle, - titleTextSize: 16, - titleAlignment: TextAlign.center, + titleStyle: Theme.of(context).textTheme.titleMedium, iconSize: 60.0, makePhotoText: options.translations.takePicture, selectImageText: options.translations.uploadFile, @@ -34,12 +33,15 @@ Future onPressSelectImage( Icons.insert_drive_file_rounded, size: 60, ), - ), - customButton: TextButton( - onPressed: () => Navigator.of(context).pop(), - child: Text( - options.translations.cancelImagePickerBtn, - style: Theme.of(context).textTheme.bodyMedium, + closeButtonBuilder: (ontap) => TextButton( + onPressed: () => Navigator.of(context).pop(), + child: Text( + options.translations.cancelImagePickerBtn, + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + fontSize: 18, + decoration: TextDecoration.underline, + ), + ), ), ), ), @@ -47,6 +49,7 @@ Future onPressSelectImage( ).then( (image) async { if (image == null) return; + if (!context.mounted) return; var messenger = ScaffoldMessenger.of(context) ..showSnackBar( _getImageLoadingSnackbar(options.translations), diff --git a/packages/flutter_chat/pubspec.yaml b/packages/flutter_chat/pubspec.yaml index e6ee2d5..e321353 100644 --- a/packages/flutter_chat/pubspec.yaml +++ b/packages/flutter_chat/pubspec.yaml @@ -16,9 +16,8 @@ dependencies: intl: any flutter_image_picker: - git: - url: https://github.com/Iconica-Development/flutter_image_picker - ref: 1.0.5 + hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub + version: ^4.0.0 flutter_profile: git: ref: 1.6.0