mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 02:43:50 +02:00
feat: indicator for uploading images
This commit is contained in:
parent
9e0378fe74
commit
2ebb05bb79
3 changed files with 30 additions and 3 deletions
|
@ -81,6 +81,27 @@ class _CommunityChatState extends State<CommunityChat> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _beforeUploadingImage() => ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
duration: const Duration(minutes: 1),
|
||||||
|
content: Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
width: 25,
|
||||||
|
height: 25,
|
||||||
|
child: CircularProgressIndicator(color: Colors.grey),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16.0),
|
||||||
|
child: Text(widget.translations.imageUploading),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
_afterUploadingImage() => ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||||
|
|
||||||
Future<void> _onPressSelectImage(BuildContext context, ChatModel chat) =>
|
Future<void> _onPressSelectImage(BuildContext context, ChatModel chat) =>
|
||||||
showModalBottomSheet<Uint8List?>(
|
showModalBottomSheet<Uint8List?>(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -97,10 +118,14 @@ class _CommunityChatState extends State<CommunityChat> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
).then(
|
).then(
|
||||||
(image) {
|
(image) async {
|
||||||
|
_beforeUploadingImage();
|
||||||
|
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
return widget.dataProvider.sendImageMessage(image);
|
await widget.dataProvider.sendImageMessage(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_afterUploadingImage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_view"
|
path: "packages/flutter_community_chat_view"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: adc7d063039e44e5a76275bed48d336b18271f3d
|
resolved-ref: d10857d28905114c481753cd6193d685b713f028
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|
|
@ -11,6 +11,7 @@ class ChatTranslations {
|
||||||
this.searchPlaceholder = 'Search...',
|
this.searchPlaceholder = 'Search...',
|
||||||
this.cancelImagePickerBtn = 'Cancel',
|
this.cancelImagePickerBtn = 'Cancel',
|
||||||
this.messagePlaceholder = 'Write your message here...',
|
this.messagePlaceholder = 'Write your message here...',
|
||||||
|
this.imageUploading = 'Image is uploading...',
|
||||||
});
|
});
|
||||||
|
|
||||||
final String chatsTitle;
|
final String chatsTitle;
|
||||||
|
@ -20,4 +21,5 @@ class ChatTranslations {
|
||||||
final String searchPlaceholder;
|
final String searchPlaceholder;
|
||||||
final String cancelImagePickerBtn;
|
final String cancelImagePickerBtn;
|
||||||
final String messagePlaceholder;
|
final String messagePlaceholder;
|
||||||
|
final String imageUploading;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue