💄 Optimized loading style

This commit is contained in:
2025-12-21 02:49:45 +08:00
parent f5fb5d8a98
commit 46a773cfe9
2 changed files with 152 additions and 156 deletions

View File

@@ -30,7 +30,10 @@ class DashboardScreen extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return AppScaffold(body: Center(child: DashboardGrid())); return AppScaffold(
isNoBackground: false,
body: Center(child: DashboardGrid()),
);
} }
} }

View File

@@ -96,24 +96,24 @@ void showLoadingModal(BuildContext context) {
if (_loadingOverlay != null) return; if (_loadingOverlay != null) return;
_loadingOverlay = OverlayEntry( _loadingOverlay = OverlayEntry(
builder: builder: (context) => _FadeOverlay(
(context) => _FadeOverlay(
key: _loadingOverlayKey, key: _loadingOverlayKey,
child: Material( child: Material(
color: Colors.black54, color: Colors.black54,
child: Center( child: Center(
child: Material( child: AlertDialog(
color: Theme.of(context).colorScheme.surface, content: Row(
borderRadius: BorderRadius.circular(8),
elevation: 4,
child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
CircularProgressIndicator(year2023: false), CircularProgressIndicator(
const Gap(24), year2023: false,
padding: EdgeInsets.zero,
).width(28).height(28).padding(horizontal: 8),
const Gap(16),
Text('loading'.tr()), Text('loading'.tr()),
], ],
).padding(all: 32), ),
contentPadding: EdgeInsets.symmetric(horizontal: 32, vertical: 24),
), ),
), ),
), ),
@@ -187,8 +187,7 @@ Future<T?> showOverlayDialog<T>({
} }
entry = OverlayEntry( entry = OverlayEntry(
builder: builder: (context) => _FadeOverlay(
(context) => _FadeOverlay(
key: key, key: key,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
curve: Curves.easeOut, curve: Curves.easeOut,
@@ -252,8 +251,7 @@ void showErrorAlert(dynamic err, {IconData? icon}) {
}; };
showOverlayDialog<void>( showOverlayDialog<void>(
builder: builder: (context, close) => ConstrainedBox(
(context, close) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: kDialogMaxWidth), constraints: const BoxConstraints(maxWidth: kDialogMaxWidth),
child: AlertDialog( child: AlertDialog(
title: null, title: null,
@@ -291,8 +289,7 @@ void showErrorAlert(dynamic err, {IconData? icon}) {
void showInfoAlert(String message, String title, {IconData? icon}) { void showInfoAlert(String message, String title, {IconData? icon}) {
showOverlayDialog<void>( showOverlayDialog<void>(
builder: builder: (context, close) => ConstrainedBox(
(context, close) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: kDialogMaxWidth), constraints: const BoxConstraints(maxWidth: kDialogMaxWidth),
child: AlertDialog( child: AlertDialog(
title: null, title: null,
@@ -333,8 +330,7 @@ Future<bool> showConfirmAlert(
bool isDanger = false, bool isDanger = false,
}) async { }) async {
final result = await showOverlayDialog<bool>( final result = await showOverlayDialog<bool>(
builder: builder: (context, close) => ConstrainedBox(
(context, close) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: kDialogMaxWidth), constraints: const BoxConstraints(maxWidth: kDialogMaxWidth),
child: AlertDialog( child: AlertDialog(
title: null, title: null,
@@ -360,14 +356,11 @@ Future<bool> showConfirmAlert(
actions: [ actions: [
TextButton( TextButton(
onPressed: () => close(false), onPressed: () => close(false),
child: Text( child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
MaterialLocalizations.of(context).cancelButtonLabel,
),
), ),
TextButton( TextButton(
onPressed: () => close(true), onPressed: () => close(true),
style: style: isDanger
isDanger
? TextButton.styleFrom( ? TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error, foregroundColor: Theme.of(context).colorScheme.error,
) )