65 lines
2.0 KiB
Dart
65 lines
2.0 KiB
Dart
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<AmanIconButton> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(15),
|
|
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>[
|
|
(!widget.busy
|
|
? Icon(
|
|
widget.icon,
|
|
color: widget.mainColor,
|
|
size: 36,
|
|
)
|
|
: CircularProgressIndicator(
|
|
strokeWidth: 3,
|
|
valueColor: AlwaysStoppedAnimation<Color>(widget.mainColor))),
|
|
Text(widget.title, overflow: TextOverflow.fade, maxLines: 2, style: TextStyle(color: widget.mainColor, fontSize: 14, fontWeight: FontWeight.w800, ), textAlign: TextAlign.center,)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|