chore: display loading during image upload (#3503)

pull/2245/head
ggurdin 4 months ago committed by GitHub
parent e59e314628
commit cc9fa75c34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -172,6 +172,7 @@ class ActivityPlannerBuilderState extends State<ActivityPlannerBuilder> {
if (mounted) {
setState(() {
avatar = bytes;
imageURL = null;
filename = photo.singleOrNull?.name;
});
}

@ -56,22 +56,43 @@ class ActivitySuggestionDialogState extends State<ActivitySuggestionDialog> {
: MediaQuery.of(context).size.width;
Future<void> _launchActivity() async {
if (widget.onLaunch != null) {
await widget.controller.updateImageURL();
widget.onLaunch!.call();
Navigator.of(context).pop();
} else if (widget.controller.room != null &&
!widget.controller.room!.isSpace) {
final resp = await showFutureLoadingDialog(
context: context,
future: widget.controller.launchToRoom,
);
if (!resp.isError) {
context.go("/rooms/${widget.controller.room!.id}");
try {
setState(() {
_loading = true;
_error = null;
});
if (widget.onLaunch != null) {
widget.onLaunch!.call();
Navigator.of(context).pop();
} else if (widget.controller.room != null &&
!widget.controller.room!.isSpace) {
final resp = await showFutureLoadingDialog(
context: context,
future: widget.controller.launchToRoom,
);
if (!resp.isError) {
context.go("/rooms/${widget.controller.room!.id}");
Navigator.of(context).pop();
}
} else {
_setPageMode(_PageMode.roomSelection);
}
} catch (e, s) {
_error = e;
ErrorHandler.logError(
e: e,
s: s,
data: {
"request": widget.controller.updatedRequest.toJson(),
},
);
} finally {
if (mounted) {
setState(() {
_loading = false;
});
}
} else {
_setPageMode(_PageMode.roomSelection);
}
}

Loading…
Cancel
Save