From 7eccdcfce297bca60649b6cc29b601dbab3d52ee Mon Sep 17 00:00:00 2001 From: Aditya-Thakur-369 Date: Sat, 18 Nov 2023 01:30:45 +0530 Subject: [PATCH] Only Reminders are left --- assets/images/splash_logo.png | Bin 0 -> 17678 bytes lib/main.dart | 63 +-- lib/screens/bottomsheet_addtask.dart | 542 ++++++++++++------------ lib/screens/bottomsheet_updatetask.dart | 519 ++++++++++++----------- lib/screens/home_screen.dart | 515 ++++++++++------------ lib/screens/signin_screen.dart | 5 +- lib/utilities/firebase_database.dart | 60 +-- lib/utilities/notification_service.dart | 50 ++- 8 files changed, 851 insertions(+), 903 deletions(-) create mode 100644 assets/images/splash_logo.png diff --git a/assets/images/splash_logo.png b/assets/images/splash_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..eccc10d20b882404a69d87e39ff0a64a9b0d3a2a GIT binary patch literal 17678 zcmeIahg%ch)<2pI5eSGh6{QGBD2fnzhr~v23W`V<5fv%Yr6quh2uhP)g7Q^F6c7-k zhKLQM_a1t05=sIgbBA-z?|tw65AMCs3D1)ZnLT^fUgfjOUXy5ZQ#}qgel{2k#$lj; z=_(8cK!*T~l^Ocj4D8v3J`k?wP0qt$pX1o+PKTiXMV$4on!sQ|5-=G4F${Jv1V0ah z`N_dxi;gguMj8yp=ap4`MGHD%?sCK6j)@8EEOg8Y1K>O`Cg=zb{lTK{!4UsChQXkj zpchjv{D05p0{`bM0Lx|i-{XUUC&e=}p-HUoS>EuyVPdS|?CCD+bldZmi)^5~*TDdo zR-guS=XnEhhqjB|;?tdl=bv>Ma!$JtE1%<&~K7DYb|9SnJPTzZX{`XEE zKL1%3v_SO18MM5t9QuFehA!1Q_*TQr`<@GQ=Y#omE4#b>fYtEE+}M7J%ItNB6t|U%`0**_C}<|s2BS>yU^;kOmTKa zK!v;IuxM0yxllDaY0)_2_L~r~dff)@XX!Uo(oKE__%Dat%O9+As4t!~`bkq4=EjPA z1)9c>XD9ZH#2Zm{hx7D8wuOv{KEK!RDQbQ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x4MtugvD#&!2GRJ(p*z75Ks*xtbj&TyM`i>O(Y%MqePpNtjKOW$!~<5*XfhLYJ+E~14rS+gW&ViWqylOb?1$KX8HUG zZuJY$x_wovt5SX$u4DMKIqka8wj`D1>#;K$fH;H$;(`g(3&HLck9H(6cT+;$@)j23 zSHHL$#}4M|mxswDmn;5^J?VP84cba;gM!4i+`~+YUjjEyAwmxJQInqDHJ9JGSRv`) z6=A*mqQ=;2P7cYai00lGm=>;W9N^j4i;d1CYf;#JmU;Y{ZX7)F`CmQwFAx4-ss|sQ vnOMPKK+C~z0sL1}|7)oKUpG`)BptU9x-t-thL0coT!_JC(@RAc93%cOOUD!Y literal 0 HcmV?d00001 diff --git a/lib/main.dart b/lib/main.dart index cc9c700..fff5d97 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,7 @@ class _MyAppState extends State { return MaterialApp( debugShowCheckedModeBanner: false, theme: themeprovider.getTheme(), - home: splash_screen(), + home: const splash_screen(), ); } } @@ -81,39 +81,6 @@ class splash_screen extends StatefulWidget { } class splash_screenState extends State { - // AskPermission() async { - // final prefs = await SharedPreferences.getInstance(); - // final hasNotificationPermission = - // prefs.getBool('notificationPermissionGranted'); - - // if (hasNotificationPermission == null || - // hasNotificationPermission == false) { - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // title: Text('Please grant notification permission'), - // content: Text( - // 'In order to receive notifications, please grant the app permission to access your notifications.'), - // actions: [ - // TextButton( - // child: Text('Cancel'), - // onPressed: () => Navigator.of(context).pop(), - // ), - // TextButton( - // child: Text('Grant Permission'), - // onPressed: () async { - // await requestNotificationPermission(); - // Navigator.of(context).pop(); - // }, - // ), - // ], - // ), - // ); - // } else { - // stateChage(); - // } - // } - Future requestExactAlarmsPermission() async { if (TargetPlatform.android == defaultTargetPlatform) { PermissionStatus status = await Permission.scheduleExactAlarm.request(); @@ -165,37 +132,41 @@ class splash_screenState extends State { var SharedPref = await SharedPreferences.getInstance(); var isLoggedIn = SharedPref.getBool(KEYLOGIN); - Timer(Duration(seconds: 3), () { + Timer(const Duration(seconds: 3), () { if (isLoggedIn != null) { if (isLoggedIn) { Navigator.pushReplacement( context, MaterialPageRoute( - builder: (context) => home_screen(), + builder: (context) => const home_screen(), )); } else { Navigator.pushReplacement( context, MaterialPageRoute( - builder: (context) => signin_screen(), + builder: (context) => const signin_screen(), )); } } else { Navigator.pushReplacement( context, MaterialPageRoute( - builder: (context) => signin_screen(), + builder: (context) => const signin_screen(), )); } }); } Future _init() async { - await requestNotificationPermission(); - await requestExactAlarmsPermission(); - stateChage(); - // AskPermission(); - } + bool notificationPermission = await requestNotificationPermission(); + bool exactAlarmPermission = await requestExactAlarmsPermission(); + + print('Notification Permission: $notificationPermission'); + print('Exact Alarm Permission: $exactAlarmPermission'); + + stateChage(); +} + @override void initState() { @@ -210,17 +181,17 @@ class splash_screenState extends State { height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, alignment: Alignment.center, - child: Column( + child: Column( mainAxisAlignment: MainAxisAlignment.center, // Ensure vertical centering crossAxisAlignment: CrossAxisAlignment.center, children: [ - SvgPicture.asset('assets/images/splash.svg'), + Center(child: Image.asset('assets/images/splash_logo.png')), SizedBox( height: 10, ), Text( - "Make You Work Easier !!", + "Manage Your Day !!", style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, diff --git a/lib/screens/bottomsheet_addtask.dart b/lib/screens/bottomsheet_addtask.dart index 63283e8..6616fea 100644 --- a/lib/screens/bottomsheet_addtask.dart +++ b/lib/screens/bottomsheet_addtask.dart @@ -1,7 +1,3 @@ - - -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:todo/models/model.dart'; @@ -32,60 +28,20 @@ void dispose() { AdditionslFeature feature = AdditionslFeature(); -final _formkey2 = GlobalKey(); - List options = [ '5 Minutes early', '10 Minutes early', '15 Minutes early', '30 Minutes early' ]; -Future sendtask(BuildContext context) async { - print("running program"); - if (_formkey2.currentState != null && _formkey2.currentState!.validate()) { - NoteModel n = NoteModel( - title: title.text, - note: note.text, - date: date.text, - starttime: starttime.text, - endtime: endtime.text, - reminder: reminder.text, - ); - try { - List result = await FirebaseStore.Savetask(n, date.text); - if (result[0] == true) { - // Extract the document ID from the result - String docId = result[1]; - - // Update the NoteModel with the retrieved document ID - n = n.copyWith(id: docId); - - title.text = ''; - note.text = ''; - date.text = ''; - starttime.text = ''; - endtime.text = ''; - reminder.text = ''; - print("Done Data Saved"); - aftertrue(context); - } else if (result[0] is String) { - print(result[0]); - } else { - print("Something went wrong "); - } - } catch (e) { - print("An error occurred: $e"); - } - } -} aftertrue(BuildContext context) { Navigator.push( context, MaterialPageRoute( - builder: (context) => home_screen(), + builder: (context) => const home_screen(), )); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( + ScaffoldMessenger.of(context).showSnackBar(const SnackBar( content: Text( "Task Addes !", style: TextStyle( @@ -110,236 +66,300 @@ gettask(BuildContext context) { isDismissible: true, context: context, builder: (context) { - return FractionallySizedBox( - heightFactor: 0.9, - child: Container( - height: MediaQuery.of(context).size.height, - width: double.infinity, - child: SingleChildScrollView( - child: Column( - children: [ - const SizedBox( - height: 10, - ), - Container( - height: 6, - width: 120, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.grey), - ), - const SizedBox( - height: 20, - ), - const Text( - "Add Task", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - letterSpacing: 2), - ), - const SizedBox( - height: 20, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: Form( - key: _formkey2, - child: Column( - children: [ - CustomTextFormField( - controller: title, - sur: const Icon(Icons.note_add_outlined), - labelText: "Note Title", - hintText: "Eat Snacks", - validator: (value) { - if (value == null || value.isEmpty) { - return "Title can not be empty"; - } else if (value.length < 3) { - return "It needs a minimum of 3 letters"; - } - return null; - }, - ), - const SizedBox( - height: 10, - ), - CustomTextFormField( - controller: note, - sur: const Icon( - Icons.abc_outlined, - size: 30, - ), - labelText: "Note Body", - hintText: "I will eat chips with coke!", - validator: (value) { - if (value == null || value.isEmpty) { - return "Body can not be empty"; - } else if (value.length < 3) { - return "It needs a minimum of 3 letters"; - } - return null; - }, - ), - const SizedBox( - height: 10, - ), - TextFormField( - enabled: false, - controller: date, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10)), - labelText: 'Date', - suffixIcon: Icon(Icons.date_range), - ), - validator: (value) { - if (value == null || value.isEmpty) { - return "Date can not be empty"; - } - return null; - }, + return TaskForm(timeProvider: timeProvider); + }, + ); +} + +class TaskForm extends StatefulWidget { + const TaskForm({ + super.key, + required this.timeProvider, + }); + + final TimeProvider timeProvider; + + @override + State createState() => _TaskFormState(); +} + +class _TaskFormState extends State { + final _formkey2 = GlobalKey(); + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.9, + child: SizedBox( + height: MediaQuery.of(context).size.height, + width: double.infinity, + child: SingleChildScrollView( + child: Column( + children: [ + const SizedBox( + height: 10, + ), + Container( + height: 6, + width: 120, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.grey), + ), + const SizedBox( + height: 20, + ), + const Text( + "Add Task", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + letterSpacing: 2), + ), + const SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Form( + key: _formkey2, + child: Column( + children: [ + CustomTextFormField( + controller: title, + sur: const Icon(Icons.note_add_outlined), + labelText: "Note Title", + hintText: "Eat Snacks", + validator: (value) { + if (value == null || value.isEmpty) { + return "Title can not be empty"; + } else if (value.length < 3) { + return "It needs a minimum of 3 letters"; + } + return null; + }, + ), + const SizedBox( + height: 10, + ), + CustomTextFormField( + controller: note, + sur: const Icon( + Icons.abc_outlined, + size: 30, ), - const SizedBox( - height: 10, + labelText: "Note Body", + hintText: "I will eat chips with coke!", + validator: (value) { + if (value == null || value.isEmpty) { + return "Body can not be empty"; + } else if (value.length < 3) { + return "It needs a minimum of 3 letters"; + } + return null; + }, + ), + const SizedBox( + height: 10, + ), + TextFormField( + enabled: false, + controller: date, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10)), + labelText: 'Date', + suffixIcon: const Icon(Icons.date_range), ), - Row( - children: [ - Expanded( - child: Container( - margin: const EdgeInsets.all(5), - child: TextFormField( - controller: starttime, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), - ), - labelText: "Start Time", - hintText: "12:15", - suffixIcon: IconButton( - onPressed: () { - TimePicker timePicker = TimePicker( - labelText: 'Select Time', - selectedTime: TimeOfDay.now(), - onSelectedTime: (TimeOfDay newTime) { - final formattedTime = timeProvider - .formatTime(newTime, context); - timeProvider - .updateStartTime(formattedTime); - starttime.text = - formattedTime; // Add this line - }, - ); - timePicker.selectTime(context); - }, - icon: const Icon( - Icons.watch_later_outlined), - ), + validator: (value) { + if (value == null || value.isEmpty) { + return "Date can not be empty"; + } + return null; + }, + ), + const SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( + child: Container( + margin: const EdgeInsets.all(5), + child: TextFormField( + keyboardType: TextInputType.none, + controller: starttime, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), + labelText: "Start Time", + hintText: "12:15", + suffixIcon: IconButton( + onPressed: () { + TimePicker timePicker = TimePicker( + labelText: 'Select Time', + selectedTime: TimeOfDay.now(), + onSelectedTime: (TimeOfDay newTime) { + final formattedTime = widget + .timeProvider + .formatTime(newTime, context); + widget.timeProvider + .updateStartTime(formattedTime); + starttime.text = + formattedTime; // Add this line + }, + ); + timePicker.selectTime(context); + }, + icon: + const Icon(Icons.watch_later_outlined), ), - validator: (value) { - if (value == null || value.isEmpty) { - return "Start time can not be empty"; - } - return null; - }, ), + validator: (value) { + if (value == null || value.isEmpty) { + return "Start time can not be empty"; + } + return null; + }, ), ), - const SizedBox(width: 5), - Expanded( - child: Container( - margin: const EdgeInsets.all(5), - child: TextFormField( - controller: endtime, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), - ), - labelText: "End Time", - hintText: "12:45", - suffixIcon: IconButton( - onPressed: () { - TimePicker timePicker = TimePicker( - labelText: 'Select Time', - selectedTime: TimeOfDay.now(), - onSelectedTime: (TimeOfDay newTime) { - final formattedTime = timeProvider - .formatTime(newTime, context); - timeProvider - .updateEndTime(formattedTime); - endtime.text = - formattedTime; // Add this line - }, - ); - timePicker.selectTime(context); - }, - icon: const Icon( - Icons.watch_later_outlined), - ), + ), + const SizedBox(width: 5), + Expanded( + child: Container( + margin: const EdgeInsets.all(5), + child: TextFormField( + keyboardType: TextInputType.none, + controller: endtime, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), + labelText: "End Time", + hintText: "12:45", + suffixIcon: IconButton( + onPressed: () { + TimePicker timePicker = TimePicker( + labelText: 'Select Time', + selectedTime: TimeOfDay.now(), + onSelectedTime: (TimeOfDay newTime) { + final formattedTime = widget + .timeProvider + .formatTime(newTime, context); + widget.timeProvider + .updateEndTime(formattedTime); + endtime.text = + formattedTime; // Add this line + }, + ); + timePicker.selectTime(context); + }, + icon: + const Icon(Icons.watch_later_outlined), ), - validator: (value) { - if (value == null || value.isEmpty) { - return "End time can not be empty"; - } - return null; - }, ), + validator: (value) { + if (value == null || value.isEmpty) { + return "End time can not be empty"; + } + return null; + }, ), ), - ], - ), - const SizedBox( - height: 10, - ), - DropdownButtonFormField( - value: options[0], - icon: const Icon(Icons.arrow_downward), - iconSize: 24, - elevation: 16, - style: TextStyle( - color: - Provider.of(context).isDarkMode - ? Colors.black - : Colors.white), - onChanged: (String? newValue) { - // Update the dropdown value when the user selects an option + ), + ], + ), + const SizedBox( + height: 10, + ), + DropdownButtonFormField( + value: options[0], + icon: const Icon(Icons.arrow_downward), + iconSize: 24, + elevation: 16, + style: TextStyle( + color: + Provider.of(context).isDarkMode + ? Colors.black + : Colors.white), + onChanged: (String? newValue) { + // Update the dropdown value when the user selects an option - reminder.text = newValue!; - }, - items: options.map((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), - ), - labelText: 'Reminder', - hintText: "5 Minutes early ", + reminder.text = newValue!; + }, + items: options.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), ), + labelText: 'Reminder', + hintText: "5 Minutes early ", ), - const SizedBox( - height: 15, - ), - CustomElevatedButton( - message: "Add Task", - function: () async { - if (_formkey2.currentState != null && - _formkey2.currentState!.validate()) { - await sendtask(context); - } - }), - ], - ), + ), + const SizedBox( + height: 15, + ), + CustomElevatedButton( + message: "Add Task", + function: () async { + if (_formkey2.currentState != null && + _formkey2.currentState!.validate()) { + await sendtask(context); + } + }, + ), + ], ), ), - ], - ), + ), + ], ), ), + ), + ); + } + + Future sendtask(BuildContext context) async { + print("running program"); + if (_formkey2.currentState != null && _formkey2.currentState!.validate()) { + NoteModel n = NoteModel( + title: title.text, + note: note.text, + date: date.text, + starttime: starttime.text, + endtime: endtime.text, + reminder: reminder.text, ); - }, - ); -} + try { + List result = await FirebaseStore.Savetask(n, date.text); + if (result[0] == true) { + // Extract the document ID from the result + String docId = result[1]; + + // Update the NoteModel with the retrieved document ID + n = n.copyWith(id: docId); + + title.text = ''; + note.text = ''; + date.text = ''; + starttime.text = ''; + endtime.text = ''; + reminder.text = ''; + print("Done Data Saved"); + aftertrue(context); + } else if (result[0] is String) { + print(result[0]); + } else { + print("Something went wrong "); + } + } catch (e) { + print("An error occurred: $e"); + } + } + } +} \ No newline at end of file diff --git a/lib/screens/bottomsheet_updatetask.dart b/lib/screens/bottomsheet_updatetask.dart index 2cdaa22..5160c64 100644 --- a/lib/screens/bottomsheet_updatetask.dart +++ b/lib/screens/bottomsheet_updatetask.dart @@ -22,8 +22,6 @@ TextEditingController reminder = TextEditingController(); AdditionslFeature feature = AdditionslFeature(); -final _formkey3 = GlobalKey(); - @override void dispose() { title.dispose(); @@ -41,34 +39,6 @@ List options = [ '30 Minutes early' ]; -Future Updatetask(String docId, BuildContext context) async { - print("running program"); - if (_formkey3.currentState != null && _formkey3.currentState!.validate()) { - NoteModel n = NoteModel( - id: docId, - title: title.text, - note: note.text, - date: date.text, - starttime: starttime.text, - endtime: endtime.text, - reminder: reminder.text, - ); - try { - bool result = await FirebaseStore.Updatask( - n, docId, FirebaseAuth.instance.currentUser!.uid); - if (result == true) { - // Navigator.of(context).pop(); - aftertrue(context); - } else { - // Navigator.of(context).pop(); - afterfalse(context); - } - } catch (e) { - print("An error occurred: $e"); - } - } -} - aftertrue(BuildContext context) { Navigator.push( context, @@ -77,7 +47,7 @@ aftertrue(BuildContext context) { )); ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( - "Task Addes !", + "Task Updated !", style: TextStyle( fontSize: 18, color: Colors.white, fontWeight: FontWeight.bold), ), @@ -89,7 +59,7 @@ aftertrue(BuildContext context) { afterfalse(BuildContext context) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( - "Unable to Add Task !", + "Unable to Update Task !", style: TextStyle( fontSize: 18, color: Colors.white, fontWeight: FontWeight.bold), ), @@ -98,7 +68,6 @@ afterfalse(BuildContext context) { Navigator.of(context).pop(); } - Future GetTaskDetails(String docId) async { try { var querySnapshot = await FirebaseFirestore.instance @@ -148,244 +117,294 @@ void updatesheet(BuildContext context, String docId, String uid) async { final timeProvider = Provider.of(context, listen: false); final provider = context.read(); String datevalue = provider.getFormattedDate().toString(); - showModalBottomSheet( isScrollControlled: true, isDismissible: true, context: context, builder: (context) { - return FractionallySizedBox( - heightFactor: 0.9, - child: Container( - height: MediaQuery.of(context).size.height, - width: double.infinity, - child: SingleChildScrollView( - child: Column( - children: [ - const SizedBox( - height: 10, - ), - Container( - height: 6, - width: 120, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.grey), - ), - const SizedBox( - height: 20, - ), - const Text( - "Update Task", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - letterSpacing: 2), - ), - const SizedBox( - height: 20, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: Form( - key: _formkey3, - child: Column( - children: [ - CustomTextFormField( - controller: title, - sur: const Icon(Icons.note_add_outlined), - labelText: "Note Title", - hintText: "Eat Snacks", - validator: (value) { - if (value == null || value.isEmpty) { - return "Title can not be empty"; - } else if (value.length < 3) { - return "It needs a minimum of 3 letters"; - } - return null; - }, - ), - const SizedBox( - height: 10, - ), - CustomTextFormField( - controller: note, - sur: const Icon( - Icons.abc_outlined, - size: 30, - ), - labelText: "Note Body", - hintText: "I will eat chips with coke!", - validator: (value) { - if (value == null || value.isEmpty) { - return "Body can not be empty"; - } else if (value.length < 3) { - return "It needs a minimum of 3 letters"; - } - return null; - }, - ), - const SizedBox( - height: 10, - ), - TextFormField( - enabled: false, - controller: date, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10)), - labelText: 'Date', - suffixIcon: Icon(Icons.date_range), - ), - validator: (value) { - if (value == null || value.isEmpty) { - return "Date can not be empty"; - } - return null; - }, + return UpdateTask(timeProvider: timeProvider,docId: docId,); + }, + ); +} + +class UpdateTask extends StatefulWidget { + const UpdateTask( + {super.key, required this.timeProvider, required this.docId}); + + final TimeProvider timeProvider; + final String docId; + + @override + State createState() => _UpdateTaskState(); +} + +class _UpdateTaskState extends State { + final _formkey3 = GlobalKey(); + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.9, + child: Container( + height: MediaQuery.of(context).size.height, + width: double.infinity, + child: SingleChildScrollView( + child: Column( + children: [ + const SizedBox( + height: 10, + ), + Container( + height: 6, + width: 120, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.grey), + ), + const SizedBox( + height: 20, + ), + const Text( + "Update Task", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + letterSpacing: 2), + ), + const SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Form( + key: _formkey3, + child: Column( + children: [ + CustomTextFormField( + controller: title, + sur: const Icon(Icons.note_add_outlined), + labelText: "Note Title", + hintText: "Eat Snacks", + validator: (value) { + if (value == null || value.isEmpty) { + return "Title can not be empty"; + } else if (value.length < 3) { + return "It needs a minimum of 3 letters"; + } + return null; + }, + ), + const SizedBox( + height: 10, + ), + CustomTextFormField( + controller: note, + sur: const Icon( + Icons.abc_outlined, + size: 30, ), - const SizedBox( - height: 10, + labelText: "Note Body", + hintText: "I will eat chips with coke!", + validator: (value) { + if (value == null || value.isEmpty) { + return "Body can not be empty"; + } else if (value.length < 3) { + return "It needs a minimum of 3 letters"; + } + return null; + }, + ), + const SizedBox( + height: 10, + ), + TextFormField( + enabled: false, + controller: date, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10)), + labelText: 'Date', + suffixIcon: Icon(Icons.date_range), ), - Row( - children: [ - Expanded( - child: Container( - margin: const EdgeInsets.all(5), - child: TextFormField( - controller: starttime, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), - ), - labelText: "Start Time", - hintText: "12:15", - suffixIcon: IconButton( - onPressed: () { - TimePicker timePicker = TimePicker( - labelText: 'Select Time', - selectedTime: TimeOfDay.now(), - onSelectedTime: (TimeOfDay newTime) { - final formattedTime = timeProvider - .formatTime(newTime, context); - timeProvider - .updateStartTime(formattedTime); - starttime.text = - formattedTime; // Add this line - }, - ); - timePicker.selectTime(context); - }, - icon: const Icon( - Icons.watch_later_outlined), - ), + validator: (value) { + if (value == null || value.isEmpty) { + return "Date can not be empty"; + } + return null; + }, + ), + const SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( + child: Container( + margin: const EdgeInsets.all(5), + child: TextFormField( + controller: starttime, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), + labelText: "Start Time", + hintText: "12:15", + suffixIcon: IconButton( + onPressed: () { + TimePicker timePicker = TimePicker( + labelText: 'Select Time', + selectedTime: TimeOfDay.now(), + onSelectedTime: (TimeOfDay newTime) { + final formattedTime = widget + .timeProvider + .formatTime(newTime, context); + widget.timeProvider + .updateStartTime(formattedTime); + starttime.text = + formattedTime; // Add this line + }, + ); + timePicker.selectTime(context); + }, + icon: + const Icon(Icons.watch_later_outlined), ), - validator: (value) { - if (value == null || value.isEmpty) { - return "Start time can not be empty"; - } - return null; - }, ), + validator: (value) { + if (value == null || value.isEmpty) { + return "Start time can not be empty"; + } + return null; + }, ), ), - const SizedBox(width: 5), - Expanded( - child: Container( - margin: const EdgeInsets.all(5), - child: TextFormField( - controller: endtime, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), - ), - labelText: "End Time", - hintText: "12:45", - suffixIcon: IconButton( - onPressed: () { - TimePicker timePicker = TimePicker( - labelText: 'Select Time', - selectedTime: TimeOfDay.now(), - onSelectedTime: (TimeOfDay newTime) { - final formattedTime = timeProvider - .formatTime(newTime, context); - timeProvider - .updateEndTime(formattedTime); - endtime.text = - formattedTime; // Add this line - }, - ); - timePicker.selectTime(context); - }, - icon: const Icon( - Icons.watch_later_outlined), - ), + ), + const SizedBox(width: 5), + Expanded( + child: Container( + margin: const EdgeInsets.all(5), + child: TextFormField( + controller: endtime, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), + labelText: "End Time", + hintText: "12:45", + suffixIcon: IconButton( + onPressed: () { + TimePicker timePicker = TimePicker( + labelText: 'Select Time', + selectedTime: TimeOfDay.now(), + onSelectedTime: (TimeOfDay newTime) { + final formattedTime = widget + .timeProvider + .formatTime(newTime, context); + widget.timeProvider + .updateEndTime(formattedTime); + endtime.text = + formattedTime; // Add this line + }, + ); + timePicker.selectTime(context); + }, + icon: + const Icon(Icons.watch_later_outlined), ), - validator: (value) { - if (value == null || value.isEmpty) { - return "End time can not be empty"; - } - return null; - }, ), + validator: (value) { + if (value == null || value.isEmpty) { + return "End time can not be empty"; + } + return null; + }, ), ), - ], - ), - const SizedBox( - height: 10, - ), - DropdownButtonFormField( - value: reminder.text, - icon: const Icon(Icons.arrow_downward), - iconSize: 24, - elevation: 16, - style: TextStyle( - color: - Provider.of(context).isDarkMode - ? Colors.black - : Colors.white, - ), - onChanged: (String? newValue) { - // Update the dropdown value when the user selects an option - // setState(() { - // reminder.text = newValue!; - // }); - }, - items: options.map((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), - ), - labelText: 'Reminder', - hintText: "5 Minutes early ", ), + ], + ), + const SizedBox( + height: 10, + ), + DropdownButtonFormField( + // value: options.contains(reminder.text) + // ? reminder.text + // : null, + value: reminder.text, + icon: const Icon(Icons.arrow_downward), + iconSize: 24, + elevation: 16, + style: TextStyle( + color: Provider.of(context).isDarkMode + ? Colors.black + : Colors.white, ), - const SizedBox( - height: 15, + onChanged: (String? newValue) { + // Update the dropdown value when the user selects an option + setState(() { + reminder.text = newValue!; + }); + }, + items: options.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), + labelText: 'Reminder', + hintText: "5 Minutes early ", ), - CustomElevatedButton( - message: "Update Task", - function: () async { - // if (_formkey3.currentState != null && - // _formkey3.currentState!.validate()) { - await Updatetask(docId, context); - // } - }), - ], - ), + ), + const SizedBox( + height: 15, + ), + CustomElevatedButton( + message: "Update Task", + function: () async { + // if (_formkey3.currentState != null && + // _formkey3.currentState!.validate()) { + await Updatetask(widget.docId, context); + // } + }), + ], ), ), - ], - ), + ), + ], ), ), + ), + ); + } + + Future Updatetask(String docId, BuildContext context) async { + print("running program"); + if (_formkey3.currentState != null && _formkey3.currentState!.validate()) { + NoteModel n = NoteModel( + id: docId, + title: title.text, + note: note.text, + date: date.text, + starttime: starttime.text, + endtime: endtime.text, + reminder: reminder.text, ); - }, - ); + try { + bool result = await FirebaseStore.Updatask( + n, docId, FirebaseAuth.instance.currentUser!.uid); + if (result == true) { + // Navigator.of(context).pop(); + aftertrue(context); + } else { + // Navigator.of(context).pop(); + afterfalse(context); + } + } catch (e) { + print("An error occurred: $e"); + } + } + } } diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index c30357a..62236ae 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -260,15 +260,23 @@ class _home_screenState extends State { children: [ GestureDetector( onTap: () async { - try { - NotificationService().showNotification( - body: "this is body", - title: "this is title", - ); - } catch (e) { - print('e'); - } + // try { + // NotificationService().showNotification( + // body: "this is body", + // title: "this is title", + // ); + // } catch (e) { + // print('e'); + // } + await NotificationService().scheduleNotification( + id: 2, + title: 'Notification Title', + body: 'Notification Body', + scheduledTime: + DateTime.now().add(Duration(seconds: 3)), + payload: 'Some payload data', + ); showOptions( context, name.toString(), email.toString()); }, @@ -582,23 +590,24 @@ class _home_screenState extends State { .height / 8), child: - SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Text( - "Title : ${currentTask.title ?? ""}", - style: const TextStyle( - letterSpacing: - 2, - fontSize: - 20, - color: Colors - .white, - fontWeight: - FontWeight - .bold), - ), - ), + ListView( + shrinkWrap: true, + children: [ + Text( + "Title : ${currentTask.title ?? ""}", + style: const TextStyle( + letterSpacing: + 2, + fontSize: + 20, + color: Colors + .white, + fontWeight: + FontWeight + .bold), + ), + ], + ), ), ), FittedBox( @@ -1066,278 +1075,192 @@ class _home_screenState extends State { print(currentdoneTask); }, onLongPress: () { - showCupertinoModalPopup( - context: context, - builder: (context) { - return CupertinoActionSheet( - actions: [ - Material( - child: Container( - height: - MediaQuery.of(context) - .size - .height / - 3, - width: 300, - decoration: BoxDecoration( - borderRadius: - BorderRadius - .circular(10), - color: color), - child: Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Padding( - padding: - const EdgeInsets - .all(8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Text( - "Task Completed at : ", - style: TextStyle( - fontSize: - 15, - fontWeight: - FontWeight - .bold, - color: Colors - .white), - ), - SizedBox( - width: 5, - ), - Text( - // " 02:04 PM - 02:19 PM", - currentdoneTask - .completedTime ?? - '', + showCupertinoModalPopup( + context: context, + builder: (context) { + return CupertinoActionSheet( + actions: [ + Material( + child: Container( + height: MediaQuery.of(context).size.height / 3, + width: 300, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: color, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "Task Completed at : ", + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + SizedBox(width: 5), + Text( + currentdoneTask.completedTime ?? '', + style: const TextStyle(color: Colors.white), + ), + ], + ), + Container( + constraints: BoxConstraints( + maxWidth: MediaQuery.of(context).size.width - 100, + maxHeight: MediaQuery.of(context).size.height / 8, + ), + child: ListView( + shrinkWrap: true, + children: [ + Text( + "Title : ${currentdoneTask.title ?? ""}", + style: const TextStyle( + letterSpacing: 2, + fontSize: 20, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ] + ), + ), + Container( + constraints: BoxConstraints( + maxWidth: MediaQuery.of(context).size.width - 100, + maxHeight: MediaQuery.of(context).size.height / 10, + ), + child: ListView( + shrinkWrap: true, + children: [ + Text( + currentdoneTask.note ?? "", + style: const TextStyle( + fontSize: 18, + color: Colors.white, + fontWeight: FontWeight.w300, + ), + ), + ], + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + child: Row( + children: [ + Container( + height: 1000, + width: 1, + color: Colors.white, + ), + const SizedBox(width: 8), + const RotatedBox( + quarterTurns: 3, + child: Text( + 'TODO', + style: TextStyle( + fontSize: 13, + color: Colors.white, + ), + ), + ), + ], + ), + ), + ) + ], + ), + ), + ), + const SizedBox(height: 30), + CupertinoActionSheetAction( + child: Text( + "Share Task", + style: TextStyle(color: Colors.grey.shade600), + ), + onPressed: () async { + await Share.share( + "🚀 Task Details 🚀\n\n" + "📌 Task Title: ${currentdoneTask.title}\n" + "📋 Task Description: ${currentdoneTask.note}\n" + "🗓 Task Date: ${currentdoneTask.date}\n" + "⏰ Task Start Time: ${currentdoneTask.starttime}\n" + "🎉 Task Completion Time: ${currentdoneTask.completedTime}\n\n" + "✅ Task Accomplished! Dive into seamless task management with the cutting-edge Todo app!\n\n" + "🌟 Discover the endless possibilities of the Todo app on GitHub. Let's simplify your task management journey together.\n" + "GitHub Link: https://github.com/Aditya-Thakur-369/Todo-App", + subject: "📅 Task Details from the Todo App 📝", + ); + }, + ), + CupertinoActionSheetAction( + child: Text( + "Delete", + style: TextStyle(color: Colors.grey.shade600), + ), + onPressed: () async { + bool rs = await FirebaseStore.DeleteTask( + currentdoneTask.id.toString(), + FirebaseAuth.instance.currentUser!.uid, + ); + if (rs == true) { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => const home_screen(), + ), + ); + final scaffoldContext = ScaffoldMessenger.of(context); + scaffoldContext.showSnackBar( + const SnackBar( + content: Text( + "Task Deleted Successfully ! ", + style: TextStyle( + fontSize: 15, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + backgroundColor: Colors.black, + ), + ); + } else { + print("Something is wrong while deleting the Task"); + } + }, + ), + ], + cancelButton: CupertinoActionSheetAction( + isDefaultAction: true, + onPressed: () { + Navigator.of(context).pop(); + }, + child: const Text( + "Cancel", + style: TextStyle(color: Colors.red), + ), + ), + ); + }, +); + + - style: - const TextStyle( - color: Colors - .white, - ), - ), - ], - ), - FittedBox( - child: - Container( - color: Colors - .red, - constraints: - BoxConstraints( - maxWidth: MediaQuery.of(context) - .size - .width - - 100, - maxHeight: MediaQuery.of(context) - .size - .height / - 10, - ), - child: - SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Row( - children: [ - Text( - "Title : ", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: Colors.white), - ), - Text( - currentdoneTask.title ?? - "", - style: const TextStyle( - fontSize: 17, - color: Colors.white, - fontWeight: FontWeight.bold), - ), - ], - ), - ), - ), - ), - FittedBox( - child: - Container( - constraints: BoxConstraints( - maxWidth: - MediaQuery.of(context).size.width - - 100, - maxHeight: - MediaQuery.of(context).size.height / - 10), - child: - SingleChildScrollView( - scrollDirection: - Axis.vertical, - child: Text( - // "Note 1", - currentdoneTask - .note ?? - "", - style: const TextStyle( - fontSize: - 18, - color: Colors - .white, - fontWeight: - FontWeight.w300), - ), - ), - ), - ) - ], - ), - ), - Padding( - padding: - const EdgeInsets - .all(10.0), - child: Container( - child: Row( - children: [ - Container( - height: 1000, - width: 1, - color: Colors - .white, - ), - const SizedBox( - width: 8, - ), - const RotatedBox( - quarterTurns: - 3, // Set the number of clockwise quarter turns - child: Text( - 'TODO', - style: - TextStyle( - fontSize: - 13, - color: Colors - .white, - ), // Define the text style - ), - ) - ], - ), - ), - ) - ], - )), - ), - const SizedBox( - height: 30, - ), - CupertinoActionSheetAction( - child: Text( - "Share Task", - style: TextStyle( - color: - Colors.grey.shade600), - ), - onPressed: () async { - await Share.share( - "🚀 Task Details 🚀\n\n" - "📌 Task Title: ${currentdoneTask.title}\n" - "📋 Task Description: ${currentdoneTask.note}\n" - "🗓 Task Date: ${currentdoneTask.date}\n" - "⏰ Task Start Time: ${currentdoneTask.starttime}\n" - "🎉 Task Completion Time: ${currentdoneTask.completedTime}\n\n" - "✅ Task Accomplished! Dive into seamless task management with the cutting-edge Todo app!\n\n" - "🌟 Discover the endless possibilities of the Todo app on GitHub. Let's simplify your task management journey together.\n" - "GitHub Link: https://github.com/Aditya-Thakur-369/Todo-App", - subject: - "📅 Task Details from the Todo App 📝"); - }, - ), - CupertinoActionSheetAction( - child: Text( - "Delete", - style: TextStyle( - color: - Colors.grey.shade600), - ), - onPressed: () async { - bool rs = await FirebaseStore - .DeleteTask( - currentdoneTask.id - .toString(), - FirebaseAuth - .instance - .currentUser! - .uid); - if (rs = true) { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => - const home_screen(), - )); - final scaffoldContext = - ScaffoldMessenger.of( - context); - scaffoldContext - .showSnackBar( - const SnackBar( - content: Text( - "Task Deleted Successfully ! ", - style: TextStyle( - fontSize: 15, - color: Colors.white, - fontWeight: - FontWeight.bold, - ), - ), - backgroundColor: - Colors.black, - ), - ); - } else { - print( - "Something is wrong while deleting the Task"); - } - }, - ), - ], - cancelButton: - CupertinoActionSheetAction( - isDefaultAction: true, - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text( - "Cancel", - style: TextStyle( - color: Colors.red), - ), - ), - ); - }, - ); }, child: Container( height: 110, diff --git a/lib/screens/signin_screen.dart b/lib/screens/signin_screen.dart index 0cf69d3..769976a 100644 --- a/lib/screens/signin_screen.dart +++ b/lib/screens/signin_screen.dart @@ -8,6 +8,7 @@ import 'package:todo/screens/forgetpassword_screen.dart'; import 'package:todo/screens/home_screen.dart'; import 'package:todo/screens/signup_screen.dart'; // Make sure to import the correct shared_preference file import 'package:todo/utilities/firebase_database.dart'; +import 'package:todo/utilities/notification_service.dart'; import 'package:todo/utilities/sharedprefence.dart'; import 'package:todo/utilities/user_data.dart'; import 'package:todo/widgets/custom_widgets.dart'; @@ -210,7 +211,8 @@ class _signin_screenState extends State { ), const Text("Create a new account ? "), TextButton( - onPressed: () { + onPressed: () async { + Navigator.push( context, @@ -218,7 +220,6 @@ class _signin_screenState extends State { builder: (context) => const signup_screen(), ), ); - }, child: const Text("Sign Up"), ), diff --git a/lib/utilities/firebase_database.dart b/lib/utilities/firebase_database.dart index 74605ab..34d4050 100644 --- a/lib/utilities/firebase_database.dart +++ b/lib/utilities/firebase_database.dart @@ -240,38 +240,38 @@ class FirebaseStore { - static Future thrownotificaion(String date) async { - try { - var querySnapshot = await FirebaseFirestore.instance - .collection("User") - .doc(FirebaseAuth.instance.currentUser!.uid) - .collection("Task") - .where('date', isEqualTo: date) - .where('isCompleted', isEqualTo: false) - .get(); +// static Future thrownotificaion(String date) async { +// try { +// var querySnapshot = await FirebaseFirestore.instance +// .collection("User") +// .doc(FirebaseAuth.instance.currentUser!.uid) +// .collection("Task") +// .where('date', isEqualTo: date) +// .where('isCompleted', isEqualTo: false) +// .get(); - List notes = []; - if (querySnapshot.docs.isNotEmpty) { - querySnapshot.docs.forEach((doc) { - // Access the 'date' field directly, assuming it's a Timestamp - final info = doc.data() as Map; - NoteModel a = NoteModel.fromMap(info); - notes.add(a); - NotificationService().scheduleNotifications(a); - }); - } +// List notes = []; +// if (querySnapshot.docs.isNotEmpty) { +// querySnapshot.docs.forEach((doc) { +// // Access the 'date' field directly, assuming it's a Timestamp +// final info = doc.data() as Map; +// NoteModel a = NoteModel.fromMap(info); +// notes.add(a); +// NotificationService().scheduleNotifications(a); +// }); +// } - if (notes.isEmpty) { - print('No documents found for the specified date in get notifications.'); - return []; - } - print(notes); - return notes; - } catch (e) { - print('An error occurred: $e'); - return []; // return an empty list or any other suitable action - } -} +// if (notes.isEmpty) { +// print('No documents found for the specified date in get notifications.'); +// return []; +// } +// print(notes); +// return notes; +// } catch (e) { +// print('An error occurred: $e'); +// return []; // return an empty list or any other suitable action +// } +// } // static Future MarkasRead() async {} } diff --git a/lib/utilities/notification_service.dart b/lib/utilities/notification_service.dart index b1a76ab..32a4529 100644 --- a/lib/utilities/notification_service.dart +++ b/lib/utilities/notification_service.dart @@ -82,8 +82,10 @@ // } import 'dart:math'; +import 'package:flutter/foundation.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'package:timezone/timezone.dart' as tz; import 'package:todo/models/model.dart'; @@ -103,6 +105,12 @@ class NotificationService { FlutterLocalNotificationsPlugin(); Future initNotification() async { + + + + + + // Create a notification channel for Android devices AndroidInitializationSettings androidInitializationSettings = AndroidInitializationSettings('launcher'); @@ -123,24 +131,27 @@ class NotificationService { } notificationsDetails() { - return const NotificationDetails( - android: AndroidNotificationDetails( - 'channelId 1', - 'channelName 1', - playSound: true, - priority: Priority.high, - importance: Importance.max, - icon: 'launcher', - ticker: 'ticker', - enableVibration: true, - channelShowBadge: true, - ), - iOS: DarwinNotificationDetails( - presentAlert: true, - presentBadge: true, - presentSound: true, - )); - } + const NotificationDetails platformChannelSpecifics = NotificationDetails( + android: AndroidNotificationDetails( + 'channelId 1', + 'channelName 1', + playSound: true, + priority: Priority.high, + importance: Importance.max, + icon: 'launcher', + ticker: 'ticker', + enableVibration: true, + channelShowBadge: true // Set this line + ), + iOS: DarwinNotificationDetails( + presentAlert: true, + presentBadge: true, + presentSound: true, + ), + ); + return platformChannelSpecifics; +} + Future showNotification( {int id = 0, String? title, String? body, String? payload}) async { @@ -215,4 +226,7 @@ class NotificationService { Future cancelAllNotifications() async { await _flutterLocalNotificationsPlugin.cancelAll(); } + + + }