Add manual auth screen
This commit is contained in:
@ -6,25 +6,23 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:moneymgr_mobile/utils/extensions.dart';
|
||||
import 'package:moneymgr_mobile/utils/hooks.dart';
|
||||
|
||||
|
||||
/// A button that shows a circular progress indicator when the [onPressed] callback
|
||||
/// is pending.
|
||||
class AppButton extends HookWidget {
|
||||
const AppButton({
|
||||
super.key,
|
||||
required this.onPressed,
|
||||
required this.label,
|
||||
});
|
||||
const AppButton({super.key, required this.onPressed, required this.label});
|
||||
|
||||
final AsyncCallback? onPressed;
|
||||
final String label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final (:pending, :snapshot, hasError: _) = useAsyncTask();
|
||||
final (:pending, :snapshot, :hasError) = useAsyncTask();
|
||||
|
||||
return FilledButton(
|
||||
onPressed: onPressed == null ? null : () => pending.value = onPressed!(),
|
||||
style: ButtonStyle(
|
||||
backgroundColor: hasError ? WidgetStatePropertyAll(Colors.red) : null,
|
||||
),
|
||||
child: SeparatedRow(
|
||||
separatorBuilder: () => const GutterSmall(),
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
Reference in New Issue
Block a user