stack_wallet/lib/widgets/desktop/living_stack_icon.dart

66 lines
1.4 KiB
Dart

/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../app_icon.dart';
class LivingStackIcon extends ConsumerStatefulWidget {
const LivingStackIcon({
super.key,
this.onPressed,
});
final VoidCallback? onPressed;
@override
ConsumerState<LivingStackIcon> createState() => _LivingStackIconState();
}
class _LivingStackIconState extends ConsumerState<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: const AppIcon(),
),
),
),
);
}
}