This commit is contained in:
Phuoc Nguyen
2025-10-10 17:36:10 +07:00
parent 04f7042b8d
commit bdaf0b96c5
82 changed files with 4753 additions and 329 deletions

View File

@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
/// Custom elevated button for authentication actions
class AuthButton extends StatelessWidget {
const AuthButton({
super.key,
required this.onPressed,
required this.text,
this.isLoading = false,
this.enabled = true,
});
final VoidCallback? onPressed;
final String text;
final bool isLoading;
final bool enabled;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
onPressed: (enabled && !isLoading) ? onPressed : null,
style: ElevatedButton.styleFrom(
backgroundColor: theme.colorScheme.primary,
foregroundColor: theme.colorScheme.onPrimary,
disabledBackgroundColor:
theme.colorScheme.onSurface.withOpacity(0.12),
disabledForegroundColor:
theme.colorScheme.onSurface.withOpacity(0.38),
elevation: 2,
shadowColor: theme.colorScheme.primary.withOpacity(0.3),
),
child: isLoading
? SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
theme.colorScheme.onPrimary,
),
),
)
: Text(
text,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
color: theme.colorScheme.onPrimary,
),
),
),
);
}
}