Added callbask for the tiles buttons and in the custom button widget

This commit is contained in:
Mariano Uvalle 2019-03-12 20:06:10 -06:00
parent 274be1c980
commit b6e74cceb3
2 changed files with 7 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
class ActionButton extends StatelessWidget {
final VoidCallback onPressed;
final Color color;
final Color textColor;
final IconData leadingIconData;
@ -11,6 +12,7 @@ class ActionButton extends StatelessWidget {
final double radius;
ActionButton({
this.onPressed,
this.color = const Color(0xFF2C2F34),
this.textColor = Colors.white,
this.leadingIconData,

View file

@ -16,7 +16,7 @@ class TaskListTile extends StatelessWidget {
final VoidCallback onEdit;
/// Function to be called when the "event" button is pressed.
final VoidCallback onEventClick;
final VoidCallback onEventPressed;
/// Height of the priority badge.
///
@ -31,7 +31,7 @@ class TaskListTile extends StatelessWidget {
@required this.task,
this.onDone,
this.onEdit,
this.onEventClick,
this.onEventPressed,
}) : assert(task != null);
Widget build(BuildContext context) {
@ -99,6 +99,7 @@ class TaskListTile extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
ActionButton(
onPressed: onDone,
text: 'Done',
trailingIconData: FontAwesomeIcons.checkCircle,
color: Colors.white,
@ -110,6 +111,7 @@ class TaskListTile extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ActionButton(
onPressed: onEdit,
text: 'Edit',
leadingIconData: Icons.edit,
),
@ -117,6 +119,7 @@ class TaskListTile extends StatelessWidget {
width: 4,
),
ActionButton(
onPressed: onEventPressed,
text: 'Event',
leadingIconData: FontAwesomeIcons.calendar,
)