From 79617f155a0ea275097cc3fca08cea209c68a385 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Tue, 15 May 2018 18:25:52 +0200 Subject: [PATCH] Add a very simple text editor --- lib/main.dart | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 06126e54..2a9084a9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -8,7 +8,7 @@ class JournalList extends StatelessWidget { @override Widget build(BuildContext context) { var createButton = new FloatingActionButton( - onPressed: _newPost, + onPressed: () => _newPost(context), child: new Icon(Icons.add), ); @@ -73,8 +73,25 @@ So now what is going to happen? ); } - void _newPost() { - print("FOoOO"); + void _newPost(BuildContext context) { + var bodyWidget = new Container( + child: new TextField( + autofocus: true, + keyboardType: TextInputType.multiline, + maxLines: 500, + ), + padding: const EdgeInsets.all(8.0), + ); + + var newJournalScreen = new Scaffold( + appBar: new AppBar( + title: new Text("May 15, 17:35"), + ), + body: bodyWidget, + ); + + var route = new MaterialPageRoute(builder: (context) => newJournalScreen); + Navigator.of(context).push(route); } }