mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Fixed size hoverable button
This commit is contained in:
@ -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),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user