mirror of
https://github.com/foss42/apidash.git
synced 2025-10-19 04:33:08 +08:00
A new interim state screen
This commit is contained in:
BIN
assets/sending.gif
Normal file
BIN
assets/sending.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 181 KiB |
@ -25,12 +25,16 @@ class _ResponsePaneState extends ConsumerState<ResponsePane> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final activeId = ref.watch(activeIdStateProvider);
|
final activeId = ref.watch(activeIdStateProvider);
|
||||||
|
final sentRequestId = ref.watch(sentRequestIdStateProvider);
|
||||||
final collection = ref.read(collectionStateNotifierProvider);
|
final collection = ref.read(collectionStateNotifierProvider);
|
||||||
final idIdx = collection.indexWhere((m) => m.id == activeId);
|
final idIdx = collection.indexWhere((m) => m.id == activeId);
|
||||||
final status = ref.watch(collectionStateNotifierProvider
|
final status = ref.watch(collectionStateNotifierProvider
|
||||||
.select((value) => (value[idIdx].responseStatus,
|
.select((value) => (value[idIdx].responseStatus,
|
||||||
value[idIdx].message,
|
value[idIdx].message,
|
||||||
value[idIdx].responseModel)));
|
value[idIdx].responseModel)));
|
||||||
|
if(sentRequestId != null && sentRequestId == activeId){
|
||||||
|
return const SendingWidget();
|
||||||
|
}
|
||||||
if (status.$0 == null) {
|
if (status.$0 == null) {
|
||||||
return const NotSentWidget();
|
return const NotSentWidget();
|
||||||
}
|
}
|
||||||
@ -59,6 +63,7 @@ class NotSentWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final color = Theme.of(context).colorScheme.secondary;
|
||||||
return Center(
|
return Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -66,14 +71,41 @@ class NotSentWidget extends StatelessWidget {
|
|||||||
Icon(
|
Icon(
|
||||||
Icons.north_east_rounded,
|
Icons.north_east_rounded,
|
||||||
size: 40,
|
size: 40,
|
||||||
color: colorErrorMsg,
|
color: color,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Not Sent',
|
'Not Sent',
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.titleMedium
|
.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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final color = Theme.of(context).colorScheme.secondary;
|
||||||
return Center(
|
return Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -95,14 +128,14 @@ class ErrorMessage extends StatelessWidget {
|
|||||||
Icon(
|
Icon(
|
||||||
Icons.warning_rounded,
|
Icons.warning_rounded,
|
||||||
size: 40,
|
size: 40,
|
||||||
color: colorErrorMsg,
|
color: color,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
message ?? 'And error occurred.',
|
message ?? 'And error occurred.',
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.titleMedium
|
.titleMedium
|
||||||
?.copyWith(color: colorErrorMsg),
|
?.copyWith(color: color),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
enum HTTPVerb { get, head, post, put, patch, delete }
|
enum HTTPVerb { get, head, post, put, patch, delete }
|
||||||
|
|
||||||
enum ContentType { json, text }
|
enum ContentType { json, text }
|
||||||
@ -6,6 +8,8 @@ const DEFAULT_METHOD = HTTPVerb.get;
|
|||||||
const DEFAULT_BODY_CONTENT_TYPE = ContentType.json;
|
const DEFAULT_BODY_CONTENT_TYPE = ContentType.json;
|
||||||
const JSON_MIMETYPE = 'application/json';
|
const JSON_MIMETYPE = 'application/json';
|
||||||
|
|
||||||
|
const sendingIndicator = AssetImage("assets/sending.gif");
|
||||||
|
|
||||||
const RESPONSE_CODE_REASONS = {
|
const RESPONSE_CODE_REASONS = {
|
||||||
// 100s
|
// 100s
|
||||||
100: 'Continue',
|
100: 'Continue',
|
||||||
|
@ -26,3 +26,5 @@ dev_dependencies:
|
|||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
assets:
|
||||||
|
- assets/sending.gif
|
Reference in New Issue
Block a user