dart format
This commit is contained in:
@@ -6,7 +6,8 @@ class _AsyncMixin extends StatefulWidget {
|
||||
final AsyncErrorBuilder? errorBuilder;
|
||||
final void Function(String message)? onError;
|
||||
final VoidCallback? onSuccess;
|
||||
final Widget Function(BuildContext context, bool busy, VoidCallback? handler) builder;
|
||||
final Widget Function(BuildContext context, bool busy, VoidCallback? handler)
|
||||
builder;
|
||||
|
||||
const _AsyncMixin({
|
||||
required this.onPressed,
|
||||
@@ -59,7 +60,10 @@ class _AsyncMixinState extends State<_AsyncMixin> {
|
||||
Future<void> _trigger() async {
|
||||
final action = widget.onPressed;
|
||||
if (action == null) return;
|
||||
final success = await _controller.run(action, errorBuilder: widget.errorBuilder);
|
||||
final success = await _controller.run(
|
||||
action,
|
||||
errorBuilder: widget.errorBuilder,
|
||||
);
|
||||
if (!mounted) return;
|
||||
if (success) {
|
||||
widget.onSuccess?.call();
|
||||
@@ -71,7 +75,11 @@ class _AsyncMixinState extends State<_AsyncMixin> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final handler = widget.onPressed == null ? null : _trigger;
|
||||
return widget.builder(context, _controller.busy, _controller.busy ? null : handler);
|
||||
return widget.builder(
|
||||
context,
|
||||
_controller.busy,
|
||||
_controller.busy ? null : handler,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +106,10 @@ class _InlineErrorWrapper extends StatelessWidget {
|
||||
Text(
|
||||
err,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error, fontSize: 13),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user