Refactor button overlay color handling in document viewer, file explorer, and home page for improved state management

This commit is contained in:
Leon Bösche
2026-01-16 14:43:29 +01:00
parent c2db24133b
commit b006187320
3 changed files with 147 additions and 18 deletions

View File

@@ -238,7 +238,17 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
final highlightColor = const Color.fromARGB(255, 100, 200, 255);
final defaultColor = AppTheme.secondaryText;
return TextButton(
style: ButtonStyle(splashFactory: NoSplash.splashFactory),
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)
}),
),
onPressed: onTap,
child: Text(
org.name,
@@ -254,7 +264,17 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
final highlightColor = const Color.fromARGB(255, 100, 200, 255);
final defaultColor = AppTheme.secondaryText;
return TextButton(
style: ButtonStyle(splashFactory: NoSplash.splashFactory),
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)
}),
),
onPressed: onTap,
child: Text(
'Personal',
@@ -269,7 +289,17 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
Widget _buildAddButton(VoidCallback onTap) {
final defaultColor = AppTheme.secondaryText;
return TextButton(
style: ButtonStyle(splashFactory: NoSplash.splashFactory),
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)
}),
),
onPressed: onTap,
child: Text('+ Add Organization', style: TextStyle(color: defaultColor)),
);