simplify: dedupe boilerplate and remove dead code across all layers

This commit is contained in:
2026-07-13 22:22:39 +02:00
parent 15791423ea
commit 398b147c76
69 changed files with 345 additions and 651 deletions
@@ -3,6 +3,11 @@ part of '../async_action_button.dart';
typedef AsyncActionCallback = Future<void> Function();
typedef AsyncErrorBuilder = String Function(Object error);
/// Shared style for the inline error message the async-button family renders
/// beneath a control after a caught failure.
TextStyle _asyncErrorTextStyle(BuildContext context) =>
TextStyle(color: Theme.of(context).colorScheme.error, fontSize: 13);
/// Wraps [action] with a try/catch that pops up an [InfoDialog] on failure
/// (using [errorBuilder] or the default error mapper). Returns `true` on
/// success, `false` on caught failure.
@@ -44,10 +44,7 @@ class _AsyncDialogActionState extends State<AsyncDialogAction> {
child: Text(
err,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.error,
fontSize: 13,
),
style: _asyncErrorTextStyle(context),
),
),
Row(
@@ -76,13 +76,7 @@ class _AsyncListTileState extends State<AsyncListTile> {
if (err != null)
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 8),
child: Text(
err,
style: TextStyle(
color: Theme.of(context).colorScheme.error,
fontSize: 13,
),
),
child: Text(err, style: _asyncErrorTextStyle(context)),
),
],
);
+1 -4
View File
@@ -108,10 +108,7 @@ class _InlineErrorWrapper extends StatelessWidget {
Text(
err,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.error,
fontSize: 13,
),
style: _asyncErrorTextStyle(context),
),
],
],