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,37 +24,40 @@ 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),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: isHovered ? ColorsManager.warningRed : Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
if (isHovered)
|
||||
BoxShadow(
|
||||
color: ColorsManager.warningRed.withOpacity(0.4),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
onEnter: (_) => _updateHoverState(true),
|
||||
onExit: (_) => _updateHoverState(false),
|
||||
child: SizedBox(
|
||||
width: screenWidth * .07,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: isHovered ? ColorsManager.warningRed : Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
if (isHovered)
|
||||
BoxShadow(
|
||||
color: ColorsManager.warningRed.withOpacity(0.4),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildIcon(),
|
||||
if (!isHovered) const SizedBox(width: 8),
|
||||
if (!isHovered) _buildText(theme),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildIcon(),
|
||||
if (!isHovered) const SizedBox(width: 8),
|
||||
if (!isHovered) _buildText(theme),
|
||||
],
|
||||
),
|
||||
)),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user