2020-07-21 17:22:41 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2020-09-09 14:13:44 +00:00
|
|
|
class ActionButton extends StatelessWidget {
|
|
|
|
ActionButton(
|
|
|
|
{@required this.image,
|
|
|
|
@required this.title,
|
|
|
|
@required this.route,
|
|
|
|
this.alignment = Alignment.center});
|
2020-07-21 17:22:41 +00:00
|
|
|
|
|
|
|
final Image image;
|
|
|
|
final String title;
|
|
|
|
final String route;
|
|
|
|
final Alignment alignment;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
alignment: alignment,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
if (route.isNotEmpty) {
|
|
|
|
Navigator.of(context, rootNavigator: true).pushNamed(route);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
height: 60,
|
|
|
|
width: 60,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
2020-09-09 14:13:44 +00:00
|
|
|
color: Theme.of(context).buttonColor, shape: BoxShape.circle),
|
2020-07-21 17:22:41 +00:00
|
|
|
child: image,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
title,
|
2020-09-09 14:13:44 +00:00
|
|
|
style: TextStyle(fontSize: 14, color: Colors.white),
|
2020-07-21 17:22:41 +00:00
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2020-09-09 14:13:44 +00:00
|
|
|
}
|