first commit
This commit is contained in:
67
lib/constants/font_constants.dart
Normal file
67
lib/constants/font_constants.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class FontConstants {
|
||||
static const String fontFamily = 'Proxima Nova';
|
||||
}
|
||||
|
||||
|
||||
class ZoomIconButton extends StatefulWidget {
|
||||
final VoidCallback onTap;
|
||||
final IconData icon;
|
||||
final double size;
|
||||
final Color color;
|
||||
|
||||
const ZoomIconButton({
|
||||
Key? key,
|
||||
required this.onTap,
|
||||
this.icon = Icons.more_vert,
|
||||
this.size = 24,
|
||||
this.color = Colors.black,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ZoomIconButton> createState() => _ZoomIconButtonState();
|
||||
}
|
||||
|
||||
class _ZoomIconButtonState extends State<ZoomIconButton> {
|
||||
double _scale = 1.0;
|
||||
|
||||
void _onTapDown(TapDownDetails details) {
|
||||
setState(() {
|
||||
_scale = 1.2; // zoom in
|
||||
});
|
||||
}
|
||||
|
||||
void _onTapUp(TapUpDetails details) {
|
||||
setState(() {
|
||||
_scale = 1.0; // zoom back
|
||||
});
|
||||
widget.onTap(); // trigger your action
|
||||
}
|
||||
|
||||
void _onTapCancel() {
|
||||
setState(() {
|
||||
_scale = 1.0; // reset if cancelled
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTapDown: _onTapDown,
|
||||
onTapUp: _onTapUp,
|
||||
onTapCancel: _onTapCancel,
|
||||
child: AnimatedScale(
|
||||
scale: _scale,
|
||||
duration: const Duration(milliseconds: 100),
|
||||
curve: Curves.easeInCirc,
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
size: widget.size,
|
||||
color: widget.color,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user