Added loading indicator while file picking
This commit is contained in:
parent
8d890f1a26
commit
5dbdd52d4c
16
.idea/libraries/Dart_Packages.xml
generated
16
.idea/libraries/Dart_Packages.xml
generated
@ -58,6 +58,13 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="back_button_interceptor">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/back_button_interceptor-6.0.2/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="badges">
|
||||
<value>
|
||||
<list>
|
||||
@ -548,6 +555,13 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="loader_overlay">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/loader_overlay-2.2.0/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="localstore">
|
||||
<value>
|
||||
<list>
|
||||
@ -1093,6 +1107,7 @@
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/args-2.4.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/asn1lib-1.4.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/async-2.10.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/back_button_interceptor-6.0.2/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/badges-3.1.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/better_open_file-3.6.4/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/lib" />
|
||||
@ -1159,6 +1174,7 @@
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/json_serializable-6.6.2/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/linkify-4.1.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/lints-2.0.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/loader_overlay-2.2.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/localstore-1.3.5/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/logging-1.1.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/matcher-0.12.13/lib" />
|
||||
|
@ -1,6 +1,8 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:loader_overlay/loader_overlay.dart';
|
||||
import 'package:marianum_mobile/widget/filePick.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@ -19,6 +21,30 @@ class ChatTextfield extends StatefulWidget {
|
||||
class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
final TextEditingController _textBoxController = TextEditingController();
|
||||
bool sending = false;
|
||||
bool isLoading = false;
|
||||
|
||||
void mediaUpload(String? path) {
|
||||
if(path == null) {
|
||||
context.loaderOverlay.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
showDialog(context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text("Datei senden"),
|
||||
content: Image.file(File(path)),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
context.loaderOverlay.hide();
|
||||
}, child: const Text("Abbrechen")),
|
||||
TextButton(onPressed: () {
|
||||
context.loaderOverlay.hide();
|
||||
}, child: const Text("Senden")),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -42,8 +68,10 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
leading: const Icon(Icons.file_open),
|
||||
title: const Text("Aus Dateien auswählen"),
|
||||
onTap: () {
|
||||
context.loaderOverlay.show();
|
||||
FilePick.documentPick().then((value) {
|
||||
log(value ?? "?");
|
||||
mediaUpload(value);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
@ -52,8 +80,10 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
leading: const Icon(Icons.image),
|
||||
title: const Text("Aus Gallerie auswählen"),
|
||||
onTap: () {
|
||||
context.loaderOverlay.show();
|
||||
FilePick.galleryPick().then((value) {
|
||||
log(value?.path ?? "?");
|
||||
mediaUpload(value?.path);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:loader_overlay/loader_overlay.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/chat/getChatResponse.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/room/getRoomResponse.dart';
|
||||
import 'package:marianum_mobile/data/chatList/chatProps.dart';
|
||||
@ -92,17 +93,19 @@ class _ChatViewState extends State<ChatView> {
|
||||
colorFilter: ColorFilter.linearToSrgbGamma()
|
||||
)
|
||||
),
|
||||
child: data.primaryLoading() ? const Center(child: CircularProgressIndicator()) : Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView(
|
||||
reverse: true,
|
||||
controller: _listController,
|
||||
children: messages.reversed.toList(),
|
||||
child: LoaderOverlay(
|
||||
child: data.primaryLoading() ? const Center(child: CircularProgressIndicator()) : Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView(
|
||||
reverse: true,
|
||||
controller: _listController,
|
||||
children: messages.reversed.toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
ChatTextfield(widget.room.token),
|
||||
],
|
||||
ChatTextfield(widget.room.token),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
@ -66,6 +66,7 @@ dependencies:
|
||||
badges: ^3.0.2
|
||||
image_picker: ^0.8.7+4
|
||||
file_picker: ^5.2.11
|
||||
loader_overlay: ^2.2.0
|
||||
|
||||
dependency_overrides:
|
||||
xml: ^6.2.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user