Skip to content

Instantly share code, notes, and snippets.

@jeroenouw
Created September 15, 2019 12:05
Show Gist options
  • Save jeroenouw/a35e208c3d6e4977f6b12ce02964f7c3 to your computer and use it in GitHub Desktop.
Save jeroenouw/a35e208c3d6e4977f6b12ce02964f7c3 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class ReusableScreen extends StatelessWidget {
final String screenTitle;
final IconData tileIcon;
final String tileTitle;
final String tileSubtitle;
final Function cancelButtonAction;
final Function proceedButtonAction;
ReusableScreen({
@required this.screenTitle,
@required this.tileIcon,
@required this.tileTitle,
@required this.tileSubtitle,
@required this.cancelButtonAction,
@required this.proceedButtonAction
});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(screenTitle)),
body: Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
leading: Icon(tileIcon),
title: Text(tileTitle),
subtitle: Text(tileSubtitle),
),
ButtonTheme.bar(
child: ButtonBar(
children: <Widget>[
FlatButton(
child: Text('Cancel'),
onPressed: cancelButtonAction,
),
FlatButton(
child: Text('Proceed'),
onPressed: proceedButtonAction,
),
],
),
),
],
),
),
);
}
}
@comptech-developer
Copy link

comptech-developer commented Mar 25, 2020

where have to placed onTap();

@jeroenouw
Copy link
Author

jeroenouw commented Mar 25, 2020

@comptech-developer depends on where you want it, in this case it was a menu with menu items which routes to a page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment