Refactor button styles in account settings dialog to use ButtonStyle for improved customization and consistency

This commit is contained in:
Leon Bösche
2026-01-30 14:00:00 +01:00
parent 1bc1dd8460
commit 4dd36fe98a

View File

@@ -327,9 +327,21 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
Expanded(
child: TextButton(
onPressed: () => Navigator.of(context).pop(),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
style: ButtonStyle(
splashFactory: NoSplash.splashFactory,
overlayColor: WidgetStateProperty.resolveWith<Color?>((
Set<WidgetState> states,
) {
if (states.contains(WidgetState.pressed)) {
return Colors.transparent;
}
return null; // Use default for other states (like hover)
}),
padding: WidgetStateProperty.all(
const EdgeInsets.symmetric(vertical: 12),
),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
color: AppTheme.secondaryText.withValues(
@@ -338,6 +350,7 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
),
),
),
),
child: Text(
'Cancel',
style: TextStyle(
@@ -355,16 +368,35 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
Navigator.of(context).pop();
_deleteAccount();
},
style: ElevatedButton.styleFrom(
backgroundColor: AppTheme.errorColor,
foregroundColor: Colors.white,
elevation: 0,
shadowColor: Colors.transparent,
padding: const EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
style: ButtonStyle(
splashFactory: NoSplash.splashFactory,
overlayColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.pressed)) {
return Colors.transparent;
}
return null;
},
),
backgroundColor: WidgetStateProperty.all(
AppTheme.errorColor,
),
foregroundColor: WidgetStateProperty.all(
Colors.white,
),
elevation: WidgetStateProperty.all(0),
shadowColor: WidgetStateProperty.all(
Colors.transparent,
),
padding: WidgetStateProperty.all(
const EdgeInsets.symmetric(vertical: 12),
),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
child: const Text(
'Delete Account',
style: TextStyle(