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

View file

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