Passing dates(variables) between Classes? - dart

I need to pass variables between classes.
for example:
archive ClassN1.dart
The Class N1 content variable1 = 0
archive ClassN2.dart
the class N2 calculate sumVariables = Variable1 * 2;
For days I've been looking for information about it.
From already thank you very much!
import 'package:flutter/material.dart';
import 'Funtion_Calculate.dart';
class DatesPrincipal extends StatelessWidget {
get left => null;
#override
Widget build(BuildContext context) {
return new Container(
child: Row(
children: <Widget>[
new Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ //First linea of dates
NumberDates(),
StatusNPS(),
PutDatesNPS()
],
),
)
],
),
);
}
}
class NumberDates extends StatefulWidget {
#override
_NumberDatesState createState() => _NumberDatesState();
}
class _NumberDatesState extends State<NumberDates> {
var adecuado = '0';
Widget build(BuildContext context) {
Widget iconList;
return iconList = DefaultTextStyle.merge(
style: descTextStyle,
child: Container(
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
child: Column(
children: <Widget>[
Text(adecuado,
style: TextStyle(
fontSize: 18
),
),
Padding(
padding: EdgeInsets.all(4),
),
Text('Adecuado')
],
),
width: 100.0,
),
],
),
)
);
}
}
The archive number2.dart
- status = adecuado * 2
class StatusNPS extends StatefulWidget {
#override
_StatusNPSState createState() => _StatusNPSState();
}
class _StatusNPSState extends State<StatusNPS> {
var status = '82.9'; // status = adecuado * 2
Widget build(BuildContext context) {
Widget iconList;
return iconList = DefaultTextStyle.merge(
style: descTextStyle,
child: Container(
width: 400.0,
padding: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(status, style: TextStyle(
fontFamily: 'SF Pro',
),),
Text(' %', style: TextStyle(
fontSize: 65.0,
fontFamily:'SF Pro',
),)
],
)
)
);
}
}

Related

Set text to match column width in flutter

I have an image and a text in a column.
I want the text container to expand to the column width, creating a black border with the text centered.
This is what i got now.
Code.
List<Container> getMediaItem(List<Media> mediaItems) {
List<Container> mediaContainers = [];
for (Media media in mediaItems) {
mediaContainers.add(
Container(
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
media.image,
Container(
color: Colors.black,
padding: EdgeInsets.only(top: 8, bottom: 8),
child: Text(media.title),
)
],
),
),
);
}
return mediaContainers;
}
If you know how to solve it please share.
Update:
The full code (I'm trying to make a nested scroll view to display a gallery of media items, like Netflix):
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Live Tree',
theme: ThemeData(
brightness: Brightness.dark,
),
home: Scaffold(
appBar: AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Text("LiveTree"),
Icon(Icons.check_circle_outline),
],
),
),
body: HomePage(),
),
);
}
}
class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);
#override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
#override
Widget build(BuildContext context) {
List<Column> getMediaItem(List<Media> mediaItems) {
List<Column> mediaContainers = [];
for (Media media in mediaItems) {
mediaContainers.add(
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
media.image,
Container(
color: Colors.black,
padding: EdgeInsets.only(top: 8, bottom: 8),
child: Text(media.title),
)
],
),
);
}
return mediaContainers;
}
List<Widget> getCategoryRows(List<CategoryModel> categoryModels) {
List<Widget> categoryRows = [];
for (CategoryModel category in categoryModels) {
final mediaItemsForCategory = getMediaItem(category.media);
categoryRows.add(
ListView(scrollDirection: Axis.horizontal,
children: mediaItemsForCategory,
),
);
}
return categoryRows;
}
Widget gallerySection = Column(
mainAxisSize: MainAxisSize.min,
children: getCategoryRows(mockCategoryDataSet),
);
return Scaffold(
body: ListView(
children: <Widget>[
gallerySection,
],
),
);
}
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
media.image,
Container(
color: Colors.black,
padding: EdgeInsets.only(top: 8, bottom: 8),
child: Text(media.title),
),
],
);
or
Column(
children: [
media.image,
Container(
color: Colors.black,
padding: EdgeInsets.only(top: 8, bottom: 8),
child: Center(
child: Text(media.title),
),
),
],
);

Flutter LBS to KG app not registrating "Convert" submit

I'm doing my first Flutter app where I want to take LBS as input and show it as KG.
I've created two double variables, one for _lbs and one for the _kg value.
I have a method that converts lbs input to kg output.
However when I press the Convert button nothing is happening in my app.
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
final appTitle = 'LBS to KG converter';
return MaterialApp(
title: appTitle,
home: Scaffold(
appBar: AppBar(
title: Text(appTitle),
),
body: MyCustomForm(),
),
);
}
}
// Create a Form Widget
class MyCustomForm extends StatefulWidget {
#override
MyCustomFormState createState() {
return MyCustomFormState();
}
}
// Create a corresponding State class. This class will hold the data related to
// the form.
class MyCustomFormState extends State<MyCustomForm> {
final _formKey = GlobalKey<FormState>();
double _lbs;
double _kg;
void _convert(){
setState(() {
_kg = _lbs * 0.45359237;
});
}
#override
Widget build(BuildContext context) {
return new Form(
key: _formKey,
child: Column(
children: <Widget>[
/*- LBS ---------------- */
new Row(
children: <Widget>[
Flexible(
child: Padding(
padding: const EdgeInsets.only(
top: 2.0, left: 10.0),
child: new Text(
"LBS:",
style: new TextStyle(fontSize: 18.0),
)
),
),
Flexible(
child: Padding(
padding: const EdgeInsets.only(
top: 2.0, left: 10.0),
child: new TextField(decoration: InputDecoration(
hintText: '$_lbs'
),)
),
)
],
),
/*- KG ----------------- */
new Row(
children: <Widget>[
Flexible(
child: Padding(
padding: const EdgeInsets.only(
top: 2.0, left: 10.0),
child: new Text(
"KG:",
style: new TextStyle(fontSize: 18.0),
)
),
),
Flexible(
child: Padding(
padding: const EdgeInsets.only(
top: 2.0, left: 10.0),
child: new TextField(decoration: InputDecoration(
hintText: '$_kg'
),)
),
)
],
),
/*- Convert ---------------- */
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Flexible(
child: Padding(
padding: const EdgeInsets.only(
top: 15.0, right: 10.0, left: 10.0),
child: GestureDetector(
onTap: _convert,
child: new Container(
alignment: Alignment.center,
height: 60.0,
decoration: new BoxDecoration(
color: Color(0xFF18D191),
borderRadius: new BorderRadius.circular(9.0)),
child: new Text("Convert",
style: new TextStyle(
fontSize: 20.0, color: Colors.white))),
),
),
)
],
)
],
),
);
}
}
1) Any suggestions on what I am missing in my app?
2) Is "hintText" the best method of showing the value? Is there not any "TextField.value" ?
final lbsController = TextEditingController();
final kgController = TextEditingController();
void _convert(){
_lbs = lbsController.text; // just add checking for digital input there
setState(() {
_kg = _lbs * 0.45359237;
});
}
And inside build
lbsController.text = _lbs;
kgController.text = _kg;
...
child: new TextField(controller: lbsController, ...

TextFormField is not working properly, its blinking continuously

TextFormField is not working properly, its blinking continuously and it doesn't allow me to write anything, as I tap on the TextFormField my keyboard appears for a second and disappear instantly. I am confused what wrong I have done with my code, I've matched my code with previous working code, but still getting this behaviour .
Here is my code.
class ComingSoonState extends State<ComingSoon> {
String language;
TextEditingController _textEdititingController ;
#override
void initState() {
_textEdititingController = new TextEditingController(); //Initialised TextEditingController
super.initState();
}
#override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final Size size = MediaQuery.of(context).size;
final formData = new Form(
key: widget._formKey,
child: new Container(
padding: const EdgeInsets.only(
left: 35.0,
right: 35.0),
child: new Column(
children: <Widget>[
new Theme(
data: theme.copyWith(primaryColor: Colors.black54),
child: new TextFormField(
controller: _textEdititingController, //ADDED CONTROLLER HERE
style: const TextStyle(color: Colors.black54),
decoration: new InputDecoration(
labelText: 'Amount',
labelStyle: const TextStyle(color: Colors.black54)
),
// validator: this._validateEmail,
validator: (val) {
return val.isEmpty
? "Please enter amount"
: null;
},
onSaved: (String value) {
// this._data.email = value;
this.language = value;
}
),
),
],
),
),
);
return Scaffold(
appBar: new AppBar(
leading: null,
title: const Text('Send Money', style: const TextStyle(
color: Colors.white
),
),
),
body: new Container(
color: Colors.grey[300],
child: new ListView(
children: <Widget>[
new Container(
child: new Column(
children: <Widget>[
new Container(
height: 60.0 ,
padding: const EdgeInsets.all(5.0),
child: new Card(
child: new Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text("Available balance in wallet", style:
new TextStyle(color: Colors.black54,
fontSize: 16.0
),),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text("123 KSH", style:
new TextStyle(color: Colors.blueAccent,
fontSize: 16.0
),),
),
],
),
),
) ,
new Container(
//height: 300.0,
padding: const EdgeInsets.all(5.0),
child: new Card(
child: new Container(
child: new Center(
child: new Column(
children: <Widget>[
formData
],
),
),
),
),
)
],
)
),
],
),
),
);
}
}
I added a floating action button that presents a dialog that will show what you entered into the TextField (using the controller). I'm not sure what form key you were passing in before but making the GlobalKey instance a member variable eliminates the keyboard present/dismiss issue.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
#override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String language;
TextEditingController _textEditingController;
final _formKey = GlobalKey<FormState>();
#override
void initState() {
_textEditingController =
TextEditingController(); //Initialised TextEditingController
super.initState();
}
#override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final Size size = MediaQuery.of(context).size;
final formData = Form(
key: _formKey,
child: Container(
padding: const EdgeInsets.only(left: 35.0, right: 35.0),
child: Column(
children: <Widget>[
Theme(
data: theme.copyWith(primaryColor: Colors.black54),
child: TextFormField(
controller: _textEditingController,
//ADDED CONTROLLER HERE
style: const TextStyle(color: Colors.black54),
decoration: InputDecoration(
labelText: 'Amount',
labelStyle: const TextStyle(color: Colors.black54)),
// validator: this._validateEmail,
validator: (val) {
return val.isEmpty ? "Please enter amount" : null;
},
onSaved: (String value) {
// this._data.email = value;
language = value;
}),
),
],
),
),
);
return Scaffold(
appBar: AppBar(
leading: null,
title: const Text(
'Send Money',
style: const TextStyle(color: Colors.white),
),
),
body: Container(
color: Colors.grey[300],
child: ListView(
children: <Widget>[
Container(
child: Column(
children: <Widget>[
Container(
height: 60.0,
padding: const EdgeInsets.all(5.0),
child: Card(
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
"Available balance in wallet",
style: TextStyle(
color: Colors.black54, fontSize: 16.0),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
"123 KSH",
style: TextStyle(
color: Colors.blueAccent, fontSize: 16.0),
),
),
],
),
),
),
Container(
//height: 300.0,
padding: const EdgeInsets.all(5.0),
child: Card(
child: Container(
child: Center(
child: Column(
children: <Widget>[formData],
),
),
),
),
)
],
)),
],
),
),
floatingActionButton: FloatingActionButton(
// When the user presses the button, show an alert dialog with the
// text the user has typed into our text field.
onPressed: () {
return showDialog(
context: context,
builder: (context) {
return AlertDialog(
// Retrieve the text the user has typed in using our
// TextEditingController
content: Text(_textEditingController.text),
);
},
);
},
tooltip: 'Show me the value!',
child: Icon(Icons.text_fields),
),
);
}
}

Handling the app bar separately

I'm new to flutter and dart. I am trying to learn both by developing an app. I have taken the udacity course but it only gave me the basics. What I want to know is if it is possible to handle the appBar code separately.
Currently, this is what I have:
class HomePage extends StatelessWidget {
HomePage({Key key, this.title}) : super(key: key);
final String title;
#override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
leading: new IconButton(
icon: new Icon(Icons.menu),
tooltip: 'Menu',
onPressed: () {
print('Pressed Menu');
},
),
title: new Text(title),
titleSpacing: 0.0,
actions: <Widget>[
new Row(
children: <Widget>[
new Column(
children: <Widget>[
new Text(
'Firstname Lastname',
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.0,
),
),
new Text("username#email.com",
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.0,
)),
],
mainAxisAlignment: MainAxisAlignment.center,
),
new Padding(
padding: new EdgeInsets.all(8.0),
child: new Image.network(
'https://s5.postimg.cc/bycm2rrpz/71f3519243d136361d81df71724c60a0.png',
width: 42.0,
height: 42.0,
),
),
],
),
],
),
body: new Center(
child: Text('Hello World!'),
),
);
}
}
However, I would like to handle the appbar code separately as I believe it can swell a bit more. I have tried something like this:
class HomePage extends StatelessWidget {
HomePage({Key key, this.title}) : super(key: key);
final String title;
#override
Widget build(BuildContext context) {
return new Scaffold(
appBar: MyAppBar(),
body: new Center(
child: Text('Hello World!'),
),
);
}
}
class MyAppBar extends StatelessWidget {
#override
Widget build(BuildContext context) {
return new AppBar(
leading: new IconButton(
icon: new Icon(Icons.menu),
tooltip: 'Menu',
onPressed: () {
print('Pressed Menu');
},
),
title: new Text(title),
titleSpacing: 0.0,
actions: <Widget>[
new Row(
children: <Widget>[
new Column(
children: <Widget>[
new Text(
'Firstname Lastname',
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.0,
),
),
new Text("username#email.com",
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.0,
)),
],
mainAxisAlignment: MainAxisAlignment.center,
),
new Padding(
padding: new EdgeInsets.all(8.0),
child: new Image.network(
'https://s5.postimg.cc/bycm2rrpz/71f3519243d136361d81df71724c60a0.png',
width: 42.0,
height: 42.0,
),
),
],
),
],
);
}
}
But then I'm getting this message:
The argument type 'MyAppBar' can't be assigned to the parameter type 'PreferredSizeWidget'
I have an intuition that this might not be possible. As I said, I'm new to flutter and dart and I have tried looking in the documentation and in other posts to no avail. Sorry if this seems stupid. I would just really like for someone to point me to the documentation, if there is any, on how to achieve this kind of things or any resource that can help me better understand how this works.
For your kind and valuable help, many thanks in advance!
the appBar widget must implement the PreferredSizeWidget class so you have to :
class MyAppBar extends StatelessWidget implements PreferredSizeWidget
and then you have to implemt this method also
Size get preferredSize => new Size.fromHeight(kToolbarHeight);
Full Example :
class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
#override
Widget build(BuildContext context) {
return new AppBar(
leading: new IconButton(
icon: new Icon(Icons.menu),
tooltip: 'Menu',
onPressed: () {
print('Pressed Menu');
},
),
title: new Text(title),
titleSpacing: 0.0,
actions: <Widget>[
new Row(
children: <Widget>[
new Column(
children: <Widget>[
new Text(
'Firstname Lastname',
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.0,
),
),
new Text("username#email.com",
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.0,
)),
],
mainAxisAlignment: MainAxisAlignment.center,
),
new Padding(
padding: new EdgeInsets.all(8.0),
child: new Image.network(
'https://s5.postimg.cc/bycm2rrpz/71f3519243d136361d81df71724c60a0.png',
width: 42.0,
height: 42.0,
),
),
],
),
],
);
}
#override
Size get preferredSize => new Size.fromHeight(kToolbarHeight);
}
class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
#override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: Colors.blueGrey,
title: Text('News App'),
centerTitle: true,
leading: Icon(Icons.menu ),
);
}
#override
// TODO: implement preferredSize
Size get preferredSize => new Size.fromHeight(48);
}

Flutter - Generate in app interactivity

I'm kind of lost in generating interactivity on Flutter.
I'm trying to make tapping the FlatButtons the value shown above, and in the order it was tapped.
For example, tap number 1, then 2, 1, 1, 1 and last 2 should appear $ 12111, remembering quite a list.
Taping on the backspace icon removes the last number that has entered the list.
I am not aware of generating this communication between classes.
Can you help me? I'm trying to use the StatefulWidget but I'm not succeeding.
Below I left the code that generates the screen described above.
main.dart
import "package:flutter/material.dart";
void main() {
runApp(new KeyboardApp());
}
class KeyboardApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return new MaterialApp(
home: new HomePage(),
);
}
}
class HomePage extends StatelessWidget {
#override
Widget build(BuildContext context) {
return new Scaffold(
body: new ListView (
children: <Widget>[
new Number(),
new Keyboard(),
],
),
);
}
}
class NumberState extends StatefulWidget {
NumberList createState() => new NumberList();
}
class NumberList extends State<NumberState> {
List<String> numbers = <String>[];
String number;
#override
Widget build(BuildContext context) {
number = this.numbers.join('');
return new Text(
this.number,
style: new TextStyle(
fontFamily: 'Roboto',
color: new Color(0xFFFFFFFF),
fontSize: 45.0
)
);
}
}
class Number extends StatelessWidget {
final Color color = new Color(0xFFE57373);
#override
Widget build(BuildContext context) {
return new Container(
height: 145.0,
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Container(
padding: new EdgeInsets.only(right: 16.0, top: 35.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new Text(
'\$ ',
style: new TextStyle(
fontFamily: 'Roboto',
color: new Color(0xFFFFFFFF),
fontSize: 20.0
)
),
new NumberState(),
],
)
)
],
),
color: color,
);
}
}
class Keyboard extends StatelessWidget {
final Color color = new Color(0xFFE57373);
var list = new NumberList().numbers;
#override
Widget build(BuildContext context) {
return new Container(
padding: new EdgeInsets.only(right: 15.0, left: 15.0, top: 47.0, bottom: 20.0),
child: new Column(
children: <Widget>[
new Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
new FlatButton(
textColor: color,
child: new Text(
'1',
style: new TextStyle(
fontSize: 35.0
),
),
onPressed: () {
this.list.add('1');
},
),
new FlatButton(
textColor: color,
child: new Text(
'2',
style: new TextStyle(
fontSize: 35.0
),
),
onPressed: () {
this.list.add('2');
},
),
new FlatButton(
textColor: color,
child: new Icon(
Icons.backspace,
size: 35.0
),
onPressed: () {
this.list.removeLast();
},
),
],
),
],
),
);
}
}
Check out the Flutter interactivity tutorial. At a high level (heh), your problem is that you are trying to store state in the leaves of your widget tree. You should store your state higher up in your tree and then pass it down to the children.
The example below uses ValueNotifier but you can also pass state around using streams, callbacks, or even Firebase Database.
import "package:flutter/material.dart";
void main() {
runApp(new KeyboardApp());
}
class KeyboardApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return new MaterialApp(
home: new HomePage(),
);
}
}
class HomePage extends StatefulWidget {
HomePageState createState() => new HomePageState();
}
class HomePageState extends State<HomePage> {
ValueNotifier<List<int>> numbers = new ValueNotifier<List<int>>(<int>[]);
#override
Widget build(BuildContext context) {
return new Scaffold(
body: new ListView (
children: <Widget>[
new NumberDisplay(numbers: numbers),
new Keyboard(numbers: numbers),
],
),
);
}
}
class NumberDisplay extends AnimatedWidget {
NumberDisplay({ this.numbers }) : super(listenable: numbers);
final ValueNotifier<List<int>> numbers;
final Color _color = new Color(0xFFE57373);
#override
Widget build(BuildContext context) {
return new Container(
height: 145.0,
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Container(
padding: new EdgeInsets.only(right: 16.0, top: 35.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new Text(
'\$ ',
style: new TextStyle(
fontFamily: 'Roboto',
color: new Color(0xFFFFFFFF),
fontSize: 20.0
)
),
new Text(
this.numbers.value.join(''),
style: new TextStyle(
fontFamily: 'Roboto',
color: new Color(0xFFFFFFFF),
fontSize: 45.0
),
),
],
),
),
],
),
color: _color,
);
}
}
class Keyboard extends StatelessWidget {
Keyboard({ this.numbers });
final ValueNotifier<List<int>> numbers;
final Color _color = new Color(0xFFE57373);
#override
Widget build(BuildContext context) {
return new Container(
padding: new EdgeInsets.only(right: 15.0, left: 15.0, top: 47.0, bottom: 20.0),
child: new Column(
children: <Widget>[
new Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
new FlatButton(
textColor: _color,
child: new Text(
'1',
style: new TextStyle(
fontSize: 35.0
),
),
onPressed: () {
numbers.value = new List.from(numbers.value)..add(1);
},
),
new FlatButton(
textColor: _color,
child: new Text(
'2',
style: new TextStyle(
fontSize: 35.0
),
),
onPressed: () {
numbers.value = new List.from(numbers.value)..add(2);
},
),
new FlatButton(
textColor: _color,
child: new Icon(
Icons.backspace,
size: 35.0
),
onPressed: () {
numbers.value = new List.from(numbers.value)..removeLast();
},
),
],
),
],
),
);
}
}

Resources