From 1f543aec046f432e09c1fa04866671b2efe68313 Mon Sep 17 00:00:00 2001 From: SomnusVeritas Date: Wed, 8 Nov 2023 11:12:06 +0100 Subject: [PATCH] simple content for create todo page --- lib/pages/create_todo_page.dart | 40 ++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/lib/pages/create_todo_page.dart b/lib/pages/create_todo_page.dart index 212caa4..14e493b 100644 --- a/lib/pages/create_todo_page.dart +++ b/lib/pages/create_todo_page.dart @@ -9,8 +9,46 @@ class CreateTodoPage extends StatefulWidget { } class _CreateTodoPageState extends State { + String _title = ''; + String _description = ''; + @override Widget build(BuildContext context) { - return const Scaffold(); + return Scaffold( + floatingActionButton: _title.isNotEmpty + ? FloatingActionButton( + onPressed: () {}, + child: const Icon(Icons.save), + ) + : null, + appBar: AppBar(), + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + children: [ + TextField( + decoration: const InputDecoration(label: Text('Title')), + textInputAction: TextInputAction.next, + onTapOutside: (event) => FocusScope.of(context).unfocus(), + onChanged: (value) { + if (value.isEmpty || (value.isNotEmpty && _title.isEmpty)) { + setState(() { + _title = value; + }); + } else { + _title = value; + } + }, + ), + TextField( + minLines: 3, + maxLines: 5, + decoration: const InputDecoration(label: Text('Description')), + onChanged: (value) => _description = value, + ), + ], + ), + ), + ); } }