cake_wallet/lib/src/screens/dashboard/widgets/action_button.dart

55 lines
1.5 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
2020-09-09 14:13:44 +00:00
class ActionButton extends StatelessWidget {
ActionButton(
{@required this.image,
@required this.title,
this.route,
this.onClick,
this.alignment = Alignment.center});
final Image image;
final String title;
final String route;
final Alignment alignment;
final void Function() onClick;
@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 ?? false) {
Navigator.of(context, rootNavigator: true).pushNamed(route);
} else {
onClick?.call();
}
},
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),
child: image,
),
),
2020-09-26 11:17:39 +00:00
SizedBox(height: 15),
Text(
title,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).accentTextTheme.display3
.backgroundColor),
)
],
),
);
}
}