fix: Improve dPad navigation buttons (#605)

This commit is contained in:
PartyDonut 2025-11-11 20:00:58 +01:00 committed by GitHub
parent e9f32f522b
commit 493f40645c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 91 additions and 61 deletions

View file

@ -3,23 +3,37 @@ import 'package:flutter/material.dart';
class AdaptiveFab {
final BuildContext context;
final String title;
final String? heroTag;
final Widget child;
final Function() onPressed;
final Color? backgroundColor;
final Key? key;
AdaptiveFab({
required this.context,
this.title = '',
this.heroTag,
required this.child,
required this.onPressed,
this.key,
this.backgroundColor,
});
FloatingActionButton get normal {
return FloatingActionButton(
key: key,
onPressed: onPressed,
tooltip: title,
child: child,
Widget get normal {
return Hero(
tag: heroTag ?? UniqueKey(),
child: IconButton.filledTonal(
iconSize: 26,
key: key,
tooltip: title,
onPressed: onPressed,
style: IconButton.styleFrom(
backgroundColor: backgroundColor,
),
icon: Padding(
padding: const EdgeInsets.all(8.0),
child: child,
),
),
);
}
@ -34,6 +48,7 @@ class AdaptiveFab {
onPressed: onPressed,
style: FilledButton.styleFrom(
padding: const EdgeInsets.all(16),
backgroundColor: backgroundColor,
),
child: Row(
spacing: 16,