refactored broad range of the application, split files, modularized calendar and file views, centralized bottom sheets and clipboard handling, and implemented unit test coverage
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
part of '../async_action_button.dart';
|
||||
|
||||
class AsyncTextButton extends StatelessWidget {
|
||||
final AsyncActionCallback? onPressed;
|
||||
final Widget child;
|
||||
final AsyncActionController? controller;
|
||||
final AsyncErrorBuilder? errorBuilder;
|
||||
final void Function(String message)? onError;
|
||||
final VoidCallback? onSuccess;
|
||||
final bool showInlineError;
|
||||
|
||||
const AsyncTextButton({
|
||||
required this.onPressed,
|
||||
required this.child,
|
||||
this.controller,
|
||||
this.errorBuilder,
|
||||
this.onError,
|
||||
this.onSuccess,
|
||||
this.showInlineError = true,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => _AsyncMixin(
|
||||
onPressed: onPressed,
|
||||
controller: controller,
|
||||
errorBuilder: errorBuilder,
|
||||
onError: onError,
|
||||
onSuccess: onSuccess,
|
||||
builder: (context, busy, handler) {
|
||||
final content = busy
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AppProgressIndicator.small(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
child,
|
||||
],
|
||||
)
|
||||
: child;
|
||||
return _InlineErrorWrapper(
|
||||
controller: controller,
|
||||
child: TextButton(onPressed: handler, child: content),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user