From f951469e4bbab03fc7e568fb6e162a90b7510ef2 Mon Sep 17 00:00:00 2001 From: Tito Arrigo Date: Thu, 28 Sep 2023 11:46:08 +0200 Subject: [PATCH] grafica pagina TodayView.dart --- lib/Components/EditReminder.dart | 55 -------------------------- lib/Components/EditReminderButton.dart | 17 ++++++++ lib/Components/Reminder.dart | 4 +- lib/myApp.dart | 2 +- lib/navigation.dart | 5 +-- lib/pages/EditReminder.dart | 54 +++++++++++++++++++++++++ lib/pages/TodayView.dart | 2 +- 7 files changed, 76 insertions(+), 63 deletions(-) delete mode 100644 lib/Components/EditReminder.dart create mode 100644 lib/Components/EditReminderButton.dart create mode 100644 lib/pages/EditReminder.dart diff --git a/lib/Components/EditReminder.dart b/lib/Components/EditReminder.dart deleted file mode 100644 index 927e0c2..0000000 --- a/lib/Components/EditReminder.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:flutter/material.dart'; - -class EditReminder extends StatelessWidget{ - @override - Widget build(BuildContext context) { - return FloatingActionButton.small( - onPressed: () { - showModalBottomSheet( - context: context, - showDragHandle: true, - builder: (BuildContext context) { - return Container( - // Contenuto del BottomSheet modale - - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - ListTile( - title: const TextField( - decoration: InputDecoration( - hintText: "Title", - border: OutlineInputBorder(), - ), - ), - onTap: () { - // Azione da eseguire quando viene selezionato "Share" - Navigator.pop(context); - }, - ), - ListTile( - title: const TextField( - decoration: InputDecoration( - hintText: "Title", - border: OutlineInputBorder(), - ), - ), - onTap: () { - // Azione da eseguire quando viene selezionato "Share" - Navigator.pop(context); - }, - ), - //spacer - Container( - height: 600 - ), - ], - ), - ); - }, - ); - }, - child: Icon(Icons.edit), - ); - } -} diff --git a/lib/Components/EditReminderButton.dart b/lib/Components/EditReminderButton.dart new file mode 100644 index 0000000..cb38d88 --- /dev/null +++ b/lib/Components/EditReminderButton.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; +import '../pages/EditReminder.dart'; + +class EditReminderButton extends StatelessWidget{ + @override + Widget build(BuildContext context) { + return FilledButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => EditReminder()), + ); + }, + child: Icon(Icons.list), + ); + } +} diff --git a/lib/Components/Reminder.dart b/lib/Components/Reminder.dart index fdddfa5..c9da672 100644 --- a/lib/Components/Reminder.dart +++ b/lib/Components/Reminder.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import '../Components/EditReminder.dart'; +import '../Components/EditReminderButton.dart'; class Reminder extends StatefulWidget { const Reminder({super.key}); @@ -27,7 +27,7 @@ class _ReminderState extends State { ), title: Text("Reminder"), subtitle: Text(DateTime.now().toString()), - trailing: EditReminder(), + trailing: EditReminderButton(), ); } } diff --git a/lib/myApp.dart b/lib/myApp.dart index afa1213..9cc3f55 100644 --- a/lib/myApp.dart +++ b/lib/myApp.dart @@ -9,7 +9,7 @@ class MyApp extends StatelessWidget { return MaterialApp( title: 'My App', theme: ThemeData( - useMaterial3: true, colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.orange, primary: Colors.blueAccent, background: Colors.white), + useMaterial3: true, ), home: Navigation() ); diff --git a/lib/navigation.dart b/lib/navigation.dart index f43bebe..0c212d5 100644 --- a/lib/navigation.dart +++ b/lib/navigation.dart @@ -31,10 +31,7 @@ class _NavigationState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: Text("BottomNavBar"), - ), - body: Center(child: _widgetOptions.elementAt(_selectedIndex)), + body: SafeArea(child: _widgetOptions.elementAt(_selectedIndex)), bottomNavigationBar: BottomNavigationBar( items: const [ BottomNavigationBarItem( diff --git a/lib/pages/EditReminder.dart b/lib/pages/EditReminder.dart new file mode 100644 index 0000000..cc08858 --- /dev/null +++ b/lib/pages/EditReminder.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; + +class EditReminder extends StatefulWidget { + const EditReminder({super.key}); + + @override + State createState() => _EditReminderState(); +} + +class _EditReminderState extends State { + String _title = "ciaciao"; + String _description = "description"; + DateTime _date = DateTime.now(); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Edit Reminder"), + ), + body: SafeArea( + child: Padding( + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + TextField( + controller: TextEditingController(text: _title), + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Title', + ), + ), + const SizedBox(height: 10), + Expanded(child: TextField( + onChanged: (text) { + setState(() { + _description = text; + }); + }, + controller: TextEditingController(text: _description), + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Description', + ), + maxLines: 6, + keyboardType: TextInputType.multiline, + ),), + const SizedBox(height: 10), + ], + ), + ) + ), + ); + } +} diff --git a/lib/pages/TodayView.dart b/lib/pages/TodayView.dart index a6a57f7..fe3db07 100644 --- a/lib/pages/TodayView.dart +++ b/lib/pages/TodayView.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; //import components import '../Components/Reminder.dart'; -import '../Components/EditReminder.dart'; +import '../Components/EditReminderButton.dart'; class TodayView extends StatefulWidget { const TodayView({super.key});