birzha_mobile/lib/components/icon.dart

36 lines
882 B
Dart

import 'package:flutter/material.dart';
class AppIconButton extends StatelessWidget {
const AppIconButton({
Key? key,
required this.icon,
required this.size,
this.onTap,
this.highlightColor,
this.splashColor
}) : super(key: key);
final Icon icon;
final double size;
final Color? highlightColor;
final Color? splashColor;
final void Function()? onTap;
@override
Widget build(BuildContext context) {
return IconButton(
icon: icon,
color: Colors.grey.shade400,
onPressed: (){
if(onTap != null)
onTap!();
},
padding: EdgeInsets.zero,
splashRadius: size*1.1,
constraints: BoxConstraints(),
iconSize: size,
highlightColor: highlightColor ?? Colors.grey.withOpacity(0.1),
splashColor:splashColor ?? Theme.of(context).accentColor.withOpacity(0.1),
);
}
}