aman-kassa-flutter/lib/widgets/fields/aman_icon_button_horizontal...

50 lines
1.4 KiB
Dart

import 'package:aman_kassa_flutter/shared/app_colors.dart';
import 'package:flutter/material.dart';
/// A button that shows a busy indicator in place of title
class AmanIconButtonHorizontal extends StatefulWidget {
final String title;
final Function onPressed;
final Color activeColor;
final Color inactiveColor;
final bool selected;
final IconData icon;
const AmanIconButtonHorizontal(
{@required this.title,
this.onPressed,
this.activeColor = primaryColor,
this.inactiveColor = Colors.black26,
this.selected = false,
@required this.icon});
@override
_AmanIconButtonHorizontalState createState() =>
_AmanIconButtonHorizontalState();
}
class _AmanIconButtonHorizontalState extends State<AmanIconButtonHorizontal> {
@override
Widget build(BuildContext context) {
return GestureDetector(
child: InkWell(
onTap: widget.onPressed,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(widget.icon,
color: widget.selected
? widget.activeColor
: widget.inactiveColor),
Text(widget.title,
style: TextStyle(
color: widget.selected
? widget.activeColor
: widget.inactiveColor,
fontWeight: FontWeight.w800))
],
),
),
);
}
}