Fixed size hoverable button

This commit is contained in:
hannathkadher
2024-11-27 14:22:48 +04:00
parent 670be70567
commit ff22a6b6ab

View File

@ -24,14 +24,16 @@ class _HoverableButtonState extends State<HoverableButton> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final screenWidth = MediaQuery.of(context).size.width;
return GestureDetector(
onTap: widget.onTap,
child: MouseRegion(
onEnter: (_) => _updateHoverState(true),
onExit: (_) => _updateHoverState(false),
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
child: SizedBox(
width: screenWidth * .07,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 8),
decoration: BoxDecoration(
color: isHovered ? ColorsManager.warningRed : Colors.white,
@ -45,6 +47,7 @@ class _HoverableButtonState extends State<HoverableButton> {
),
],
),
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
@ -53,8 +56,8 @@ class _HoverableButtonState extends State<HoverableButton> {
if (!isHovered) _buildText(theme),
],
),
),
),
)),
)),
);
}