import 'package:aman_kassa_flutter/shared/app_colors.dart'; import 'package:aman_kassa_flutter/shared/shared_styles.dart'; import 'package:flutter/material.dart'; /// A button that shows a busy indicator in place of title class AmanIconButton extends StatefulWidget { final bool busy; final String title; final Function onPressed; final bool enabled; final Color mainColor; final IconData icon; const AmanIconButton( { @required this.title, this.busy = false, @required this.onPressed, this.enabled = true, this.mainColor, @required this.icon }); @override _AmanIconButtonState createState() => _AmanIconButtonState(); } class _AmanIconButtonState extends State { @override Widget build(BuildContext context) { return GestureDetector( child: InkWell( onTap: widget.busy ? () {} : widget.onPressed, child: Container( //height: 75, width: 120, alignment: Alignment.center, padding: EdgeInsets.symmetric( horizontal: 25, vertical: 15), decoration: BoxDecoration( //color: widget.enabled ? ( whiteColor ) : blueColorLigth, borderRadius: BorderRadius.circular(50), //boxShadow: [buttonShadowBox], ), child: Column( children: [ (!widget.busy ? Icon( widget.icon, color: widget.mainColor, size: 36, ) : CircularProgressIndicator( strokeWidth: 3, valueColor: AlwaysStoppedAnimation(widget.mainColor))), Text(widget.title, style: TextStyle(color: widget.mainColor, fontSize: 15, fontWeight: FontWeight.bold, ), textAlign: TextAlign.center,) ], ), ), ), ); } }