mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-06 04:17:42 +00:00
55 lines
1.3 KiB
Dart
55 lines
1.3 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||
|
import 'package:stackwallet/utilities/assets.dart';
|
||
|
|
||
|
class LivingStackIcon extends StatefulWidget {
|
||
|
const LivingStackIcon({Key? key, this.onPressed,}) : super(key: key);
|
||
|
|
||
|
final VoidCallback? onPressed;
|
||
|
|
||
|
@override
|
||
|
State<LivingStackIcon> createState() => _LivingStackIconState();
|
||
|
}
|
||
|
|
||
|
class _LivingStackIconState extends State<LivingStackIcon> {
|
||
|
bool _hovering = false;
|
||
|
|
||
|
late final VoidCallback? onPressed;
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
onPressed = widget.onPressed;
|
||
|
super.initState();
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return SizedBox(
|
||
|
height: 76,
|
||
|
child: MouseRegion(
|
||
|
cursor: SystemMouseCursors.click,
|
||
|
onEnter: (_) {
|
||
|
setState(() {
|
||
|
_hovering = true;
|
||
|
});
|
||
|
},
|
||
|
onExit: (_) {
|
||
|
setState(() {
|
||
|
_hovering = false;
|
||
|
});
|
||
|
},
|
||
|
child: GestureDetector(
|
||
|
onTap: () => onPressed?.call(),
|
||
|
child: AnimatedScale(
|
||
|
duration: const Duration(milliseconds: 200),
|
||
|
scale: _hovering ? 1.2 : 1,
|
||
|
child: SvgPicture.asset(
|
||
|
Assets.svg.stackIcon(context),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|