From c2437fb3ce1cb410fe64487ae9f381ec312871c8 Mon Sep 17 00:00:00 2001 From: mike doornenbal Date: Tue, 27 Aug 2024 14:46:50 +0200 Subject: [PATCH] fix: image_picker version --- .../firebase_chat_repository/pubspec.yaml | 9 +- .../creation/widgets/image_picker.dart | 88 ++++++++++--------- packages/flutter_chat/pubspec.yaml | 18 ++-- 3 files changed, 56 insertions(+), 59 deletions(-) diff --git a/packages/firebase_chat_repository/pubspec.yaml b/packages/firebase_chat_repository/pubspec.yaml index b1045d0..4dffa92 100644 --- a/packages/firebase_chat_repository/pubspec.yaml +++ b/packages/firebase_chat_repository/pubspec.yaml @@ -1,11 +1,10 @@ name: firebase_chat_repository description: "A new Flutter package project." version: 0.0.1 -homepage: -publish_to: 'none' +publish_to: "none" environment: - sdk: '>=3.4.3 <4.0.0' + sdk: ">=3.4.3 <4.0.0" flutter: ">=1.17.0" dependencies: @@ -14,7 +13,7 @@ dependencies: chat_repository_interface: path: ../chat_repository_interface - + firebase_storage: any cloud_firestore: any @@ -25,5 +24,3 @@ dev_dependencies: git: url: https://github.com/Iconica-Development/flutter_iconica_analysis ref: 7.0.0 - -flutter: \ No newline at end of file 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..30b47a8 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 @@ -10,54 +10,58 @@ Future onPressSelectImage( BuildContext context, ChatOptions options, Function(Uint8List image) onUploadImage, -) async => - showModalBottomSheet( - context: context, - builder: (BuildContext context) => - options.builders.imagePickerContainerBuilder?.call( - context, - () => Navigator.of(context).pop(), - options.translations, - ) ?? - Container( - padding: const EdgeInsets.all(8.0), - color: Colors.white, - child: ImagePicker( - imagePickerTheme: ImagePickerTheme( - title: options.translations.imagePickerTitle, - titleTextSize: 16, - titleAlignment: TextAlign.center, - iconSize: 60.0, - makePhotoText: options.translations.takePicture, - selectImageText: options.translations.uploadFile, - selectImageIcon: const Icon( - Icons.insert_drive_file_rounded, - size: 60, - ), +) async { + var theme = Theme.of(context); + return showModalBottomSheet( + context: context, + builder: (BuildContext context) => + options.builders.imagePickerContainerBuilder?.call( + context, + () => Navigator.of(context).pop(), + options.translations, + ) ?? + Container( + padding: const EdgeInsets.all(8.0), + color: Colors.white, + child: ImagePicker( + theme: ImagePickerTheme( + titleStyle: theme.textTheme.titleMedium, + iconSize: 40, + selectImageText: "UPLOAD FILE", + makePhotoText: "TAKE PICTURE", + selectImageIcon: const Icon( + size: 40, + Icons.insert_drive_file, ), - customButton: TextButton( - onPressed: () => Navigator.of(context).pop(), + closeButtonBuilder: (onTap) => TextButton( + onPressed: () { + onTap(); + }, child: Text( - options.translations.cancelImagePickerBtn, - style: Theme.of(context).textTheme.bodyMedium, + "Cancel", + style: theme.textTheme.bodyMedium!.copyWith( + decoration: TextDecoration.underline, + ), ), ), ), ), - ).then( - (image) async { - if (image == null) return; - var messenger = ScaffoldMessenger.of(context) - ..showSnackBar( - _getImageLoadingSnackbar(options.translations), - ) - ..activate(); - await onUploadImage(image); - Future.delayed(const Duration(seconds: 1), () { - messenger.hideCurrentSnackBar(); - }); - }, - ); + ), + ).then( + (image) async { + if (image == null) return; + var messenger = ScaffoldMessenger.of(context) + ..showSnackBar( + _getImageLoadingSnackbar(options.translations), + ) + ..activate(); + await onUploadImage(image); + Future.delayed(const Duration(seconds: 1), () { + messenger.hideCurrentSnackBar(); + }); + }, + ); +} SnackBar _getImageLoadingSnackbar(ChatTranslations translations) => SnackBar( duration: const Duration(minutes: 1), diff --git a/packages/flutter_chat/pubspec.yaml b/packages/flutter_chat/pubspec.yaml index b7ba58d..e518c3c 100644 --- a/packages/flutter_chat/pubspec.yaml +++ b/packages/flutter_chat/pubspec.yaml @@ -1,29 +1,27 @@ name: flutter_chat description: "A new Flutter package project." version: 0.0.1 -homepage: -publish_to: 'none' +publish_to: "none" environment: - sdk: '>=3.4.3 <4.0.0' + sdk: ">=3.4.3 <4.0.0" flutter: ">=1.17.0" dependencies: flutter: sdk: flutter - + cached_network_image: ^3.2.2 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 url: https://github.com/Iconica-Development/flutter_profile - chat_repository_interface: + chat_repository_interface: path: ../chat_repository_interface dev_dependencies: @@ -33,5 +31,3 @@ dev_dependencies: git: url: https://github.com/Iconica-Development/flutter_iconica_analysis ref: 7.0.0 - -flutter: