diff --git a/assets/sending.gif b/assets/sending.gif new file mode 100644 index 00000000..ebb16613 Binary files /dev/null and b/assets/sending.gif differ diff --git a/lib/components/editor_pane/response_pane.dart b/lib/components/editor_pane/response_pane.dart index b4e2078e..ac64a753 100644 --- a/lib/components/editor_pane/response_pane.dart +++ b/lib/components/editor_pane/response_pane.dart @@ -25,12 +25,16 @@ class _ResponsePaneState extends ConsumerState { @override Widget build(BuildContext context) { final activeId = ref.watch(activeIdStateProvider); + final sentRequestId = ref.watch(sentRequestIdStateProvider); final collection = ref.read(collectionStateNotifierProvider); final idIdx = collection.indexWhere((m) => m.id == activeId); final status = ref.watch(collectionStateNotifierProvider .select((value) => (value[idIdx].responseStatus, value[idIdx].message, value[idIdx].responseModel))); + if(sentRequestId != null && sentRequestId == activeId){ + return const SendingWidget(); + } if (status.$0 == null) { return const NotSentWidget(); } @@ -59,6 +63,7 @@ class NotSentWidget extends StatelessWidget { @override Widget build(BuildContext context) { + final color = Theme.of(context).colorScheme.secondary; return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -66,14 +71,41 @@ class NotSentWidget extends StatelessWidget { Icon( Icons.north_east_rounded, size: 40, - color: colorErrorMsg, + color: color, ), Text( 'Not Sent', style: Theme.of(context) .textTheme .titleMedium - ?.copyWith(color: colorErrorMsg), + ?.copyWith(color: color), + ), + ], + ), + ); + } +} + +class SendingWidget extends StatelessWidget { + const SendingWidget({super.key}); + + @override + Widget build(BuildContext context) { + final color = Theme.of(context).colorScheme.secondary; + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ColorFiltered( + colorFilter: ColorFilter.mode( + //Color.fromARGB(123, 71, 84, 179), + color.withOpacity(0.7), + BlendMode.dstIn, + ), + child: const Image( + image: sendingIndicator, + width: 300, + ), ), ], ), @@ -88,6 +120,7 @@ class ErrorMessage extends StatelessWidget { @override Widget build(BuildContext context) { + final color = Theme.of(context).colorScheme.secondary; return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -95,14 +128,14 @@ class ErrorMessage extends StatelessWidget { Icon( Icons.warning_rounded, size: 40, - color: colorErrorMsg, + color: color, ), Text( message ?? 'And error occurred.', style: Theme.of(context) .textTheme .titleMedium - ?.copyWith(color: colorErrorMsg), + ?.copyWith(color: color), ), ], ), diff --git a/lib/consts.dart b/lib/consts.dart index 2524e950..8c88f09d 100644 --- a/lib/consts.dart +++ b/lib/consts.dart @@ -1,3 +1,5 @@ +import 'package:flutter/material.dart'; + enum HTTPVerb { get, head, post, put, patch, delete } enum ContentType { json, text } @@ -6,6 +8,8 @@ const DEFAULT_METHOD = HTTPVerb.get; const DEFAULT_BODY_CONTENT_TYPE = ContentType.json; const JSON_MIMETYPE = 'application/json'; +const sendingIndicator = AssetImage("assets/sending.gif"); + const RESPONSE_CODE_REASONS = { // 100s 100: 'Continue', diff --git a/pubspec.yaml b/pubspec.yaml index 3da8568f..bf484183 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,3 +26,5 @@ dev_dependencies: flutter: uses-material-design: true + assets: + - assets/sending.gif \ No newline at end of file