From e441ae2dd5d84656fd1a7e068fee6354925829e9 Mon Sep 17 00:00:00 2001 From: Aditya-Thakur-369 Date: Sat, 18 Nov 2023 22:53:28 +0530 Subject: [PATCH] Shimmer effect added --- lib/main.dart | 18 +- lib/providers/dateTime_provider.dart | 41 +- lib/screens/home_screen.dart | 2288 ++++++++++++++------------ lib/screens/home_shimmer.dart | 189 +++ lib/utilities/task_notification.dart | 59 + pubspec.lock | 8 + pubspec.yaml | 1 + 7 files changed, 1502 insertions(+), 1102 deletions(-) create mode 100644 lib/screens/home_shimmer.dart create mode 100644 lib/utilities/task_notification.dart diff --git a/lib/main.dart b/lib/main.dart index fff5d97..327b1cc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,12 +19,13 @@ import 'package:todo/screens/home_screen.dart'; import 'package:todo/screens/signin_screen.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:todo/utilities/notification_service.dart'; +import 'package:todo/utilities/task_notification.dart'; import 'firebase_options.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); - NotificationService().initNotification(); initializeTimeZones(); + await TaskNotification.init(); await NotificationService().initNotification(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, @@ -158,15 +159,14 @@ class splash_screenState extends State { } Future _init() async { - bool notificationPermission = await requestNotificationPermission(); - bool exactAlarmPermission = await requestExactAlarmsPermission(); + bool notificationPermission = await requestNotificationPermission(); + bool exactAlarmPermission = await requestExactAlarmsPermission(); - print('Notification Permission: $notificationPermission'); - print('Exact Alarm Permission: $exactAlarmPermission'); - - stateChage(); -} + print('Notification Permission: $notificationPermission'); + print('Exact Alarm Permission: $exactAlarmPermission'); + stateChage(); + } @override void initState() { @@ -181,7 +181,7 @@ 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, diff --git a/lib/providers/dateTime_provider.dart b/lib/providers/dateTime_provider.dart index 5fe88d9..81e1967 100644 --- a/lib/providers/dateTime_provider.dart +++ b/lib/providers/dateTime_provider.dart @@ -27,29 +27,33 @@ class DatesProvider extends ChangeNotifier { [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] // Leap year ]; - List>> dates = []; + List>> dates = []; - for (int year = currentYear; year <= 2024; year++) { - List> yearData = []; - for (int i = currentMonth - 1; i < months.length; i++) { - int dateInMonth = (i == 1 && isLeapYear(year)) ? date[1][i] : date[0][i]; - List> monthData = []; - int startDay = (year == currentYear && i == currentMonth - 1) ? currentDay : 1; - for (int j = startDay; j <= dateInMonth; j++) { - monthData.add({ - 'month': months[i], - 'date': j, - 'year': year, - }); - } - yearData.addAll(monthData); + for (int year = currentYear; year <= 2024; year++) { + List> yearData = []; + int startMonth = (year == currentYear) ? currentMonth - 1 : 0; + + for (int i = startMonth; i < months.length; i++) { + int dateInMonth = (i == 1 && isLeapYear(year)) ? date[1][i] : date[0][i]; + List> monthData = []; + int startDay = (year == currentYear && i == currentMonth - 1) ? currentDay : 1; + + for (int j = startDay; j <= dateInMonth; j++) { + monthData.add({ + 'month': months[i % 12], + 'date': j, + 'year': year, + }); } - dates.add(yearData); + yearData.addAll(monthData); } - - return dates; + dates.add(yearData); } + return dates; +} + + bool isLeapYear(int year) { if (year % 4 != 0) { return false; @@ -129,6 +133,7 @@ class DatesProvider extends ChangeNotifier { } } } + return resultList; } } diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 62236ae..d73b69f 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -20,12 +20,14 @@ import 'package:todo/routes/router_name.dart'; import 'package:todo/screens/bottomsheet_addtask.dart'; import 'package:todo/screens/bottomsheet_profile.dart'; import 'package:todo/screens/bottomsheet_updatetask.dart'; +import 'package:todo/screens/home_shimmer.dart'; import 'package:todo/screens/show_history.dart'; import 'package:todo/screens/signin_screen.dart'; import 'package:todo/utilities/firebase_database.dart'; import 'package:todo/utilities/notification_service.dart'; import 'package:share_plus/share_plus.dart'; +import 'package:todo/utilities/task_notification.dart'; class home_screen extends StatefulWidget { const home_screen({super.key}); @@ -243,332 +245,337 @@ class _home_screenState extends State { final screenwidth = MediaQuery.of(context).size.width; final screenhight = MediaQuery.of(context).size.height; final themeprovider = Provider.of(context); - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Column(children: [ - Container( - height: MediaQuery.of(context).size.height / 12, - width: double.infinity, - child: Padding( - padding: - const EdgeInsets.only(right: 10, left: 10, top: 5, bottom: 5), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - GestureDetector( - onTap: () async { - // try { - // NotificationService().showNotification( - // body: "this is body", - // title: "this is title", - // ); - // } catch (e) { - // print('e'); - // } + return name == null + ? home_shimmer() + : Scaffold( + body: SafeArea( + child: SingleChildScrollView( + child: Column(children: [ + Container( + height: MediaQuery.of(context).size.height / 12, + width: double.infinity, + child: Padding( + padding: const EdgeInsets.only( + right: 10, left: 10, top: 5, bottom: 5), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + GestureDetector( + onTap: () async { + // 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()); - }, - child: const CircleAvatar( - minRadius: 25, - maxRadius: 25, - backgroundColor: Colors.blue, - child: Icon( - Icons.person_sharp, - size: 25, - color: Colors.white, - ), - ), - ), - // IconButton( - // onPressed: () { - // sign_out(); - // }, - // icon: const Icon( - // Icons.logout_outlined, - // )) - ], - ), - FittedBox( - child: Container( - constraints: BoxConstraints( - maxWidth: MediaQuery.of(context).size.width - 130), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: "Hi, ", - style: TextStyle( - color: themeprovider.isDarkMode - ? Colors.black - : Colors.white, - fontSize: 18, - letterSpacing: 2, + // await NotificationService().scheduleNotification( + // id: 2, + // title: 'Notification Title', + // body: 'Notification Body', + // scheduledTime: + // DateTime.now().add(Duration(seconds: 3)), + // payload: 'Some payload data', + // ); + + TaskNotification.showperiodicnnotification(title: 'title', body: 'body', payload: 'payload'); + showOptions(context, name.toString(), + email.toString()); + }, + child: const CircleAvatar( + minRadius: 25, + maxRadius: 25, + backgroundColor: Colors.blue, + child: Icon( + Icons.person_sharp, + size: 25, + color: Colors.white, ), ), - TextSpan( - text: "$name ", - style: TextStyle( - color: themeprovider.isDarkMode - ? Colors.black - : Colors.white, - fontSize: 25, - fontWeight: FontWeight.w200, + ), + // IconButton( + // onPressed: () { + // sign_out(); + // }, + // icon: const Icon( + // Icons.logout_outlined, + // )) + ], + ), + FittedBox( + child: Container( + constraints: BoxConstraints( + maxWidth: + MediaQuery.of(context).size.width - 130), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: "Hi, ", + style: TextStyle( + color: themeprovider.isDarkMode + ? Colors.black + : Colors.white, + fontSize: 18, + letterSpacing: 2, + ), + ), + TextSpan( + text: "$name ", + style: TextStyle( + color: themeprovider.isDarkMode + ? Colors.black + : Colors.white, + fontSize: 25, + fontWeight: FontWeight.w200, + ), + ), + ], ), + overflow: TextOverflow + .ellipsis, // Add this line to handle text overflow ), - ], + ), ), - overflow: TextOverflow - .ellipsis, // Add this line to handle text overflow ), - ), - ), - ), - Align( - alignment: Alignment.topRight, - child: IconButton( - onPressed: () { - themeprovider.toggleTheme(); + Align( + alignment: Alignment.topRight, + child: IconButton( + onPressed: () { + themeprovider.toggleTheme(); + }, + icon: Icon( + themeprovider.getThemeIcon(), + size: 25, + )), + ) + ]), + ), + ), + Container( + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + // get task bottom model sheet appear heer + selectedbox.getFormattedDate(); + gettask(context); }, - icon: Icon( - themeprovider.getThemeIcon(), - size: 25, - )), - ) - ]), - ), - ), - Container( - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - // get task bottom model sheet appear heer - selectedbox.getFormattedDate(); - gettask(context); - }, - child: Container( - height: MediaQuery.of(context).size.height / 16, - width: MediaQuery.of(context).size.width / 3, - clipBehavior: Clip.none, - decoration: BoxDecoration( - color: Colors.deepPurple, - borderRadius: BorderRadius.circular(10)), - child: const Padding( - padding: EdgeInsets.only(right: 10, left: 8), - child: FittedBox( - child: Row(children: [ - Text( - "Add Task", - style: - TextStyle(color: Colors.white, fontSize: 20), - ), - Icon( - Icons.add, - size: 25, - color: Colors.white, + child: Container( + height: MediaQuery.of(context).size.height / 16, + width: MediaQuery.of(context).size.width / 3, + clipBehavior: Clip.none, + decoration: BoxDecoration( + color: Colors.deepPurple, + borderRadius: BorderRadius.circular(10)), + child: const Padding( + padding: EdgeInsets.only(right: 10, left: 8), + child: FittedBox( + child: Row(children: [ + Text( + "Add Task", + style: TextStyle( + color: Colors.white, fontSize: 20), + ), + Icon( + Icons.add, + size: 25, + color: Colors.white, + ), + ]), + ), ), - ]), + ), ), - ), + Text( + selectedbox.getFormattedDate(), + style: TextStyle( + fontSize: 20, + color: Colors.grey[650], + fontWeight: FontWeight.bold), + ), + ], ), ), - Text( - selectedbox.getFormattedDate(), - style: TextStyle( - fontSize: 20, - color: Colors.grey[650], - fontWeight: FontWeight.bold), - ), - ], - ), - ), - ), + ), - // Code Starts From here ------------------------ + // Code Starts From here ------------------------ // ... - Padding( - padding: const EdgeInsets.all(10.0), - child: SizedBox( - width: MediaQuery.of(context).size.width, - height: 110, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: dateList.length, - itemBuilder: (context, index) { - final item = dateList[index]; - final color = boxcolors[index % boxcolors.length]; - final selectedBoxValue = selectedbox.selectedBox; + Padding( + padding: const EdgeInsets.all(10.0), + child: SizedBox( + width: MediaQuery.of(context).size.width, + height: 110, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: dateList.length, + itemBuilder: (context, index) { + final item = dateList[index]; + final color = boxcolors[index % boxcolors.length]; + final selectedBoxValue = selectedbox.selectedBox; - return Padding( - padding: const EdgeInsets.only(right: 5, left: 3), - child: GestureDetector( - onTap: () async { - selectedbox.updateSelectedBox(item); - showtask(); - showdonetask(); - }, - child: Container( - height: 100, - width: 100, - decoration: BoxDecoration( - border: Border.all( - color: Colors.deepPurple.withOpacity(1)), - boxShadow: [ - BoxShadow( - color: - Colors.grey.withOpacity(0.2), // Shadow color - spreadRadius: 2, // Spread radius - blurRadius: 2, // Blur radius - offset: const Offset(0, 3), // Offset - ), - ], - borderRadius: BorderRadius.circular(10), - // color: Colors.deepPurple - // color: color - color: selectedBoxValue != null && - selectedBoxValue['year'] == item['year'] && - selectedBoxValue['month'] == item['month'] && - selectedBoxValue['date'] == item['date'] && - selectedBoxValue['dayOfWeek'] == - item['dayOfWeek'] - ? Colors.deepPurple - : Colors.deepPurple.withOpacity(0.4), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - FittedBox( - child: Text( - item['month'] != null ? item['month'] : '', - style: TextStyle( - fontSize: 20, - color: themeprovider.isDarkMode - ? Colors.white - : Colors.white, - // selectedbox == index - // ? Colors.white - // : Colors.white + return Padding( + padding: const EdgeInsets.only(right: 5, left: 3), + child: GestureDetector( + onTap: () async { + selectedbox.updateSelectedBox(item); + showtask(); + showdonetask(); + }, + child: Container( + height: 100, + width: 100, + decoration: BoxDecoration( + border: Border.all( + color: Colors.deepPurple.withOpacity(1)), + boxShadow: [ + BoxShadow( + color: Colors.grey + .withOpacity(0.2), // Shadow color + spreadRadius: 2, // Spread radius + blurRadius: 2, // Blur radius + offset: const Offset(0, 3), // Offset ), - ), + ], + borderRadius: BorderRadius.circular(10), + // color: Colors.deepPurple + // color: color + color: selectedBoxValue != null && + selectedBoxValue['year'] == + item['year'] && + selectedBoxValue['month'] == + item['month'] && + selectedBoxValue['date'] == + item['date'] && + selectedBoxValue['dayOfWeek'] == + item['dayOfWeek'] + ? Colors.deepPurple + : Colors.deepPurple.withOpacity(0.4), ), - Text( - item['date'] != null - ? item['date'].toString() - : '', - style: const TextStyle( - fontSize: 20, - color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + FittedBox( + child: Text( + item['month'] != null + ? item['month'] + : '', + style: TextStyle( + fontSize: 20, + color: themeprovider.isDarkMode + ? Colors.white + : Colors.white, + // selectedbox == index + // ? Colors.white + // : Colors.white + ), + ), + ), + Text( + item['date'] != null + ? item['date'].toString() + : '', + style: const TextStyle( + fontSize: 20, + color: Colors.white, - // selectedbox == index - // ? Colors.white - // : Colors.white - ), - ), - FittedBox( - child: Text( - item['dayOfWeek'] != null - ? item['dayOfWeek'] - : '', - style: const TextStyle( - fontSize: 20, - color: Colors.white, - // selectedbox == index - // ? Colors.white - // : Colors.white - ), + // selectedbox == index + // ? Colors.white + // : Colors.white + ), + ), + FittedBox( + child: Text( + item['dayOfWeek'] != null + ? item['dayOfWeek'] + : '', + style: const TextStyle( + fontSize: 20, + color: Colors.white, + // selectedbox == index + // ? Colors.white + // : Colors.white + ), + ), + ), + ], ), ), - ], + ), ), - ), - ), + ); + }, ), - ); - }, - ), - ), - ), + ), + ), - // Second Container Starts + // Second Container Starts - Padding( - padding: const EdgeInsets.only(right: 10, left: 10), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - gradient: LinearGradient(colors: [ - Colors.purple[200]!.withOpacity(1), - Colors.deepPurple.withOpacity(0.5) - ], begin: Alignment.topLeft, end: Alignment.bottomRight), - ), - width: MediaQuery.of(context).size.width, - height: screenhight / 1.9, - child: tasks.isNotEmpty && tasks != 0 - ? Padding( - padding: const EdgeInsets.only(top: 3, bottom: 5), - child: ListView.builder( - itemCount: tasks.length, - itemBuilder: (context, index) { - final currentTask = tasks[index]; + Padding( + padding: const EdgeInsets.only(right: 10, left: 10), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + gradient: LinearGradient( + colors: [ + Colors.purple[200]!.withOpacity(1), + Colors.deepPurple.withOpacity(0.5) + ], + begin: Alignment.topLeft, + end: Alignment.bottomRight), + ), + width: MediaQuery.of(context).size.width, + height: screenhight / 1.9, + child: tasks.isNotEmpty && tasks != 0 + ? Padding( + padding: const EdgeInsets.only(top: 3, bottom: 5), + child: ListView.builder( + itemCount: tasks.length, + itemBuilder: (context, index) { + final currentTask = tasks[index]; - final color = boxcolors[index % boxcolors.length]; + final color = + boxcolors[index % boxcolors.length]; - return Padding( - padding: const EdgeInsets.only( - top: 5, bottom: 5, left: 5, right: 5), - child: GestureDetector( - onTap: () {}, - 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( + return Padding( + padding: const EdgeInsets.only( + top: 5, bottom: 5, left: 5, right: 5), + child: GestureDetector( + onTap: () {}, + 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, @@ -576,842 +583,973 @@ class _home_screenState extends State { MainAxisAlignment .spaceBetween, children: [ - FittedBox( - child: Container( - constraints: BoxConstraints( - maxWidth: MediaQuery.of( - context) - .size - .width - - 100, - maxHeight: MediaQuery.of( - context) - .size - .height / - 8), - child: - ListView( - shrinkWrap: true, - children: [ - Text( - "Title : ${currentTask.title ?? ""}", - style: const TextStyle( - letterSpacing: - 2, - fontSize: - 20, - color: Colors - .white, - fontWeight: - FontWeight - .bold), + Padding( + padding: + const EdgeInsets + .all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + FittedBox( + child: + Container( + constraints: BoxConstraints( + maxWidth: + MediaQuery.of(context).size.width - + 100, + maxHeight: + MediaQuery.of(context).size.height / + 8), + child: + ListView( + shrinkWrap: + true, + children: [ + Text( + "Title : ${currentTask.title ?? ""}", + style: const TextStyle( + letterSpacing: 2, + fontSize: 20, + 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", - "Body : ${currentTask.note ?? ""}", - style: const TextStyle( - fontSize: - 18, + ), + 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", + "Body : ${currentTask.note ?? ""}", + style: const TextStyle( + fontSize: + 18, + color: + Colors.white, + fontWeight: FontWeight.w300), + ), + ), + ), + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + const Icon( + Icons + .lock_clock, + size: 28, color: Colors .white, - fontWeight: - FontWeight - .w300), + ), + Text( + // " 02:04 PM - 02:19 PM", + " ${currentTask.starttime} - ${currentTask.endtime}", + + style: + const TextStyle( + color: Colors + .white, + ), + ), + ], ), - ), + ], ), ), - Row( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - const Icon( - Icons - .lock_clock, - size: 28, - color: Colors - .white, - ), - Text( - // " 02:04 PM - 02:19 PM", - " ${currentTask.starttime} - ${currentTask.endtime}", - - style: - const TextStyle( - color: Colors - .white, - ), + 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 + ), + ) + ], ), - ], - ), + ), + ) ], - ), - ), - Padding( - padding: - const EdgeInsets.all( - 10.0), - child: Container( - child: Row( - children: [ - Container( - height: 1000, - width: 1, + )), + ), + const SizedBox( + height: 30, + ), + CupertinoActionSheetAction( + child: Text( + "Mark as Done 🙂", + style: TextStyle( + color: Colors + .grey.shade600), + ), + onPressed: () async { + DateTime now = + DateTime.now(); + + // Format the time using DateFormat + String formattedTime = + DateFormat('hh:mm a') + .format(now); + bool rs = await FirebaseStore + .MarkasRead( + currentTask.id + .toString(), + FirebaseAuth + .instance + .currentUser! + .uid, + formattedTime); + if (rs = true) { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => + const home_screen(), + )); + final scaffoldContext = + ScaffoldMessenger.of( + context); + scaffoldContext + .showSnackBar( + const SnackBar( + content: Text( + "Task Done 👍🏻", + style: TextStyle( + fontSize: 15, color: Colors.white, + fontWeight: + FontWeight + .bold, ), - 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 - ), - ) - ], + ), + backgroundColor: + Colors.black, ), - ), - ) - ], - )), - ), - const SizedBox( - height: 30, - ), - CupertinoActionSheetAction( - child: Text( - "Mark as Done 🙂", - style: TextStyle( - color: Colors.grey.shade600), - ), - onPressed: () async { - DateTime now = DateTime.now(); - - // Format the time using DateFormat - String formattedTime = - DateFormat('hh:mm a') - .format(now); - bool rs = await FirebaseStore - .MarkasRead( - currentTask.id.toString(), - FirebaseAuth.instance - .currentUser!.uid, - formattedTime); - if (rs = true) { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => - const home_screen(), - )); - final scaffoldContext = - ScaffoldMessenger.of( - context); - scaffoldContext.showSnackBar( - const SnackBar( - content: Text( - "Task Done 👍🏻", - style: TextStyle( - fontSize: 15, - color: Colors.white, - fontWeight: - FontWeight.bold, - ), - ), - backgroundColor: - Colors.black, + ); + } else { + print( + "Something is wrong while deleting the Task"); + } + }, + ), + CupertinoActionSheetAction( + child: Text( + "Share Task", + style: TextStyle( + color: Colors + .grey.shade600), ), - ); - } else { - print( - "Something is wrong while deleting the Task"); - } - }, - ), - CupertinoActionSheetAction( - child: Text( - "Share Task", - style: TextStyle( - color: Colors.grey.shade600), - ), - onPressed: () async { - await Share.share( - "🚀 Task Details 🚀\n\n" - "📌 Task Title: ${currentTask.title}\n" - "📋 Task Description: ${currentTask.note}\n" - "📆 Task date: ${currentTask.date}\n" - "⏰ Task Start Time: ${currentTask.starttime}\n" - "⌛ Task End Time: ${currentTask.endtime}\n" - "🚧 Task Status: In Progress\n\n" - "📝 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( - "Edit", - style: TextStyle( - color: Colors.grey.shade600), - ), - onPressed: () { - updatesheet( - context, - currentTask.id.toString(), - FirebaseAuth.instance - .currentUser!.uid); - }, - ), - CupertinoActionSheetAction( - child: Text( - "Delete", - style: TextStyle( - color: Colors.grey.shade600), - ), - onPressed: () async { - bool rs = await FirebaseStore - .DeleteTask( - currentTask.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, + onPressed: () async { + await Share.share( + "🚀 Task Details 🚀\n\n" + "📌 Task Title: ${currentTask.title}\n" + "📋 Task Description: ${currentTask.note}\n" + "📆 Task date: ${currentTask.date}\n" + "⏰ Task Start Time: ${currentTask.starttime}\n" + "⌛ Task End Time: ${currentTask.endtime}\n" + "🚧 Task Status: In Progress\n\n" + "📝 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( + "Edit", + style: TextStyle( + color: Colors + .grey.shade600), ), - ); - } else { - print( - "Something is wrong while deleting the Task"); - } - }, - ), - ], - cancelButton: - CupertinoActionSheetAction( - isDefaultAction: true, - onPressed: () { - Navigator.of(context).pop(); + onPressed: () { + updatesheet( + context, + currentTask.id + .toString(), + FirebaseAuth.instance + .currentUser!.uid); + }, + ), + CupertinoActionSheetAction( + child: Text( + "Delete", + style: TextStyle( + color: Colors + .grey.shade600), + ), + onPressed: () async { + bool rs = await FirebaseStore + .DeleteTask( + currentTask.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: const Text( - "Cancel", - style: TextStyle(color: Colors.red), - ), - ), - ); - }, - ); - }, - child: Container( - height: 110, - width: 300, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: color), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + ); + }, + child: Container( + height: 110, + width: 300, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(20), + color: color), + child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - FittedBox( - child: Container( - constraints: BoxConstraints( - maxWidth: - MediaQuery.of(context) - .size - .width - - 100), - child: SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Text( - // "Note 1", - currentTask.title ?? "", - style: const TextStyle( - fontSize: 18, - color: Colors.white, - fontWeight: - FontWeight.w300), + Padding( + padding: + const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + FittedBox( + child: Container( + constraints: BoxConstraints( + maxWidth: MediaQuery.of( + context) + .size + .width - + 100), + child: + SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Text( + // "Note 1", + currentTask.title ?? + "", + style: const TextStyle( + fontSize: 18, + color: Colors + .white, + fontWeight: + FontWeight + .w300), + ), + ), + ), ), - ), - ), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - const Icon( - Icons.lock_clock, - size: 28, - color: Colors.white, - ), - Text( - // " 02:04 PM - 02:19 PM", - " ${currentTask.starttime} - ${currentTask.endtime}", + Row( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + const Icon( + Icons.lock_clock, + size: 28, + color: Colors.white, + ), + Text( + // " 02:04 PM - 02:19 PM", + " ${currentTask.starttime} - ${currentTask.endtime}", - style: const TextStyle( - color: Colors.white, + style: + const TextStyle( + color: Colors.white, + ), + ), + ], ), - ), - ], + FittedBox( + child: Container( + constraints: BoxConstraints( + maxWidth: MediaQuery.of( + context) + .size + .width - + 100), + child: + SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Text( + // "Note 1", + currentTask.note ?? + "", + style: const TextStyle( + fontSize: 18, + color: Colors + .white, + fontWeight: + FontWeight + .w300), + ), + ), + ), + ) + ], + ), ), - FittedBox( + Padding( + padding: + const EdgeInsets.all(10.0), child: Container( - constraints: BoxConstraints( - maxWidth: - MediaQuery.of(context) - .size - .width - - 100), - child: SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Text( - // "Note 1", - currentTask.note ?? "", - style: const TextStyle( - fontSize: 18, - color: Colors.white, - fontWeight: - FontWeight.w300), - ), + child: Row( + children: [ + Container( + height: 100, + 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 + ), + ) + ], ), ), ) ], - ), - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - child: Row( - children: [ - Container( - height: 100, - 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 - ), - ) - ], - ), - ), - ) - ], - )), + )), + ), + ); + }, ), - ); - }, - ), - ) - : Container( - width: MediaQuery.of(context).size.width, - height: screenhight / 1.9, - child: Center( - child: FittedBox( - child: GestureDetector( - onTap: () { - gettask(context); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/empty_todo.svg', - height: 200, - ), - const SizedBox( - height: 5, - ), - const Text( - "Add Some Task To Increase Your Productivity !!", - style: TextStyle( - color: Colors.white, - fontSize: 15, - fontStyle: FontStyle.normal, - fontWeight: FontWeight.bold), + ) + : Container( + width: MediaQuery.of(context).size.width, + height: screenhight / 1.9, + child: Center( + child: FittedBox( + child: GestureDetector( + onTap: () { + gettask(context); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/empty_todo.svg', + height: 200, + ), + const SizedBox( + height: 5, + ), + const Text( + "Add Some Task To Increase Your Productivity !!", + style: TextStyle( + color: Colors.white, + fontSize: 15, + fontStyle: FontStyle.normal, + fontWeight: FontWeight.bold), + ), + ], + ), ), - ], - ), - ), - ))), - - // second Container strts from here - )), + ))), - // i want to show another list in sizedbox with same features and funtions only list is changes from task to donetask and all other things are same how can i do that , one more feature if donetask list is empty then it will srink but show the container + // second Container strts from here + )), - const SizedBox( - height: 10, - ), - donetasks.isNotEmpty && donetasks != 0 - ? Container( - height: 30, - width: 200, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - color: Colors.green.withOpacity(0.2), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.1), - spreadRadius: 1, - blurRadius: 1, - ) - ]), - child: const Center( - child: Text( - "Task Completed", - style: TextStyle( - fontSize: 15, - color: Colors.green, - ), - ), - ), - ) - : SizedBox(), - const SizedBox( - height: 20, - ), - donetasks.isNotEmpty && donetasks != 0 - ? Padding( - padding: const EdgeInsets.only(right: 10, left: 10), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - gradient: LinearGradient(colors: [ - Colors.purple[200]!.withOpacity(1), - Colors.deepPurple.withOpacity(0.5) - ], begin: Alignment.topLeft, end: Alignment.bottomRight), - ), - width: MediaQuery.of(context).size.width, - height: screenhight / 1.9, - child: donetasks.isNotEmpty && donetasks != 0 - ? Padding( - padding: const EdgeInsets.only( - top: 3, bottom: 3, right: 3, left: 3), - child: ListView.builder( - itemCount: donetasks.length, - itemBuilder: (context, index) { - final currentdoneTask = donetasks[index]; - final color = - boxcolors[index % boxcolors.length]; + // i want to show another list in sizedbox with same features and funtions only list is changes from task to donetask and all other things are same how can i do that , one more feature if donetask list is empty then it will srink but show the container - return Padding( - padding: const EdgeInsets.only( - top: 5, bottom: 5, left: 5, right: 5), - child: GestureDetector( - onTap: () { - 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( - 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, - ), - ), - ], - ), - ), - ], - ), + const SizedBox( + height: 10, ), - 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, + donetasks.isNotEmpty && donetasks != 0 + ? Container( + height: 30, + width: 200, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(50), + color: Colors.green.withOpacity(0.2), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.1), + spreadRadius: 1, + blurRadius: 1, + ) + ]), + child: const Center( child: Text( - 'TODO', + "Task Completed", style: TextStyle( - fontSize: 13, - color: Colors.white, + fontSize: 15, + color: Colors.green, ), ), ), - ], - ), - ), - ) - ], - ), - ), - ), - 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, + ) + : SizedBox(), + const SizedBox( + height: 20, ), - ); - } 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), - ), - ), - ); - }, -); - - + donetasks.isNotEmpty && donetasks != 0 + ? Padding( + padding: const EdgeInsets.only(right: 10, left: 10), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + gradient: LinearGradient( + colors: [ + Colors.purple[200]!.withOpacity(1), + Colors.deepPurple.withOpacity(0.5) + ], + begin: Alignment.topLeft, + end: Alignment.bottomRight), + ), + width: MediaQuery.of(context).size.width, + height: screenhight / 1.9, + child: donetasks.isNotEmpty && donetasks != 0 + ? Padding( + padding: const EdgeInsets.only( + top: 3, bottom: 3, right: 3, left: 3), + child: ListView.builder( + itemCount: donetasks.length, + itemBuilder: (context, index) { + final currentdoneTask = donetasks[index]; + final color = + boxcolors[index % boxcolors.length]; - }, - child: Container( - height: 110, - width: 300, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(20), - color: color), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: - const EdgeInsets.all(8.0), - child: Column( + return Padding( + padding: const EdgeInsets.only( + top: 5, + bottom: 5, + left: 5, + right: 5), + child: GestureDetector( + onTap: () { + 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( + 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), + ), + ), + ); + }, + ); + }, + child: Container( + height: 110, + width: 300, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(20), + color: color), + child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment .spaceBetween, children: [ - FittedBox( - child: Container( - constraints: BoxConstraints( - maxWidth: MediaQuery.of( - context) - .size - .width - - 100), - child: - SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Text( - // "Title " + index.toString(), - currentdoneTask - .title ?? - "", - style: const TextStyle( - fontSize: 17, - color: - Colors.white, - fontWeight: - FontWeight - .bold), + Padding( + padding: + const EdgeInsets.all( + 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + FittedBox( + child: Container( + constraints: BoxConstraints( + maxWidth: MediaQuery.of( + context) + .size + .width - + 100), + child: + SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Text( + // "Title " + index.toString(), + currentdoneTask + .title ?? + "", + style: const TextStyle( + fontSize: + 17, + color: Colors + .white, + fontWeight: + FontWeight + .bold), + ), + ), + ), ), - ), - ), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "Task Completed at : ", - style: TextStyle( - fontSize: 15, - fontWeight: - FontWeight.bold, - color: - Colors.white), - ), - Text( - // " 02:04 PM - 02:19 PM", - currentdoneTask - .completedTime ?? - " ", + Row( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Text( + "Task Completed at : ", + style: TextStyle( + fontSize: 15, + fontWeight: + FontWeight + .bold, + color: Colors + .white), + ), + Text( + // " 02:04 PM - 02:19 PM", + currentdoneTask + .completedTime ?? + " ", - style: const TextStyle( - color: Colors.white, + style: + const TextStyle( + color: Colors + .white, + ), + ), + ], ), - ), - ], + FittedBox( + child: Container( + constraints: BoxConstraints( + maxWidth: MediaQuery.of( + context) + .size + .width - + 100), + child: + SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Text( + // "Note 1", + currentdoneTask + .note ?? + "", + style: const TextStyle( + fontSize: + 18, + color: Colors + .white, + fontWeight: + FontWeight + .w300), + ), + ), + ), + ) + ], + ), ), - FittedBox( + Padding( + padding: + const EdgeInsets.all( + 10.0), child: Container( - constraints: BoxConstraints( - maxWidth: MediaQuery.of( - context) - .size - .width - - 100), - child: - SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Text( - // "Note 1", - currentdoneTask - .note ?? - "", - style: const TextStyle( - fontSize: 18, - color: - Colors.white, - fontWeight: - FontWeight - .w300), - ), + child: Row( + children: [ + Container( + height: 100, + 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 + ), + ) + ], ), ), ) ], - ), - ), - Padding( - padding: - const EdgeInsets.all(10.0), - child: Container( - child: Row( - children: [ - Container( - height: 100, - 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(), + ) + : const SizedBox(), - // second Container strts from here - )) - : SizedBox(), - ]), - )), - ); + // second Container strts from here + )) + : SizedBox(), + ]), + )), + ); } } diff --git a/lib/screens/home_shimmer.dart b/lib/screens/home_shimmer.dart new file mode 100644 index 0000000..6412858 --- /dev/null +++ b/lib/screens/home_shimmer.dart @@ -0,0 +1,189 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:shimmer/shimmer.dart'; + +class home_shimmer extends StatelessWidget { + const home_shimmer({super.key}); + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + body: Shimmer.fromColors( + baseColor: Colors.grey.withOpacity(.25), + highlightColor: Colors.grey.withOpacity(.6), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CircleAvatar( + maxRadius: 30, + minRadius: 30, + backgroundColor: Colors.grey.withOpacity(.9), + ), + Container( + height: 40, + width: 130, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(30)), + ), + CircleAvatar( + maxRadius: 30, + minRadius: 30, + backgroundColor: Colors.grey.withOpacity(.9), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 60, + width: 160, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(20)), + ), + Container( + height: 50, + width: 130, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(20)), + ) + ], + ), + ), + SizedBox( + height: 15, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 110, + width: 100, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(20)), + ), + SizedBox( + width: 5, + ), + Container( + height: 110, + width: 100, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(20)), + ), + SizedBox( + width: 5, + ), + Container( + height: 110, + width: 100, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(20)), + ), + SizedBox( + width: 5, + ), + Container( + height: 110, + width: 100, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(20)), + ), + ], + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 500, + width: 700, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(30) + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: SingleChildScrollView( + child: Column( + children: [ + Container( + height: 110, + width: 650, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(30), + border: Border.all(color: Colors.black, width: 2) + ), + ), + SizedBox( + height: 6, + ), + Container( + height: 110, + width: 650, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(30), + border: Border.all(color: Colors.black, width: 2) + ), + ), + SizedBox( + height: 6, + ), + Container( + height: 110, + width: 650, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(30), + border: Border.all(color: Colors.black, width: 2) + ), + ), + SizedBox( + height: 6, + ), + Container( + height: 110, + width: 650, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(.9), + borderRadius: BorderRadius.circular(30), + border: Border.all(color: Colors.black, width: 2) + ), + ), + + ], + ), + ), + ), + ), + ), + ], + )), + )); + } +} diff --git a/lib/utilities/task_notification.dart b/lib/utilities/task_notification.dart new file mode 100644 index 0000000..1a96b74 --- /dev/null +++ b/lib/utilities/task_notification.dart @@ -0,0 +1,59 @@ +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; + +class TaskNotification { + static final FlutterLocalNotificationsPlugin + _flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); + + static Future init() async { + const AndroidInitializationSettings initializationSettingsAndroid = + AndroidInitializationSettings('launcher'); + final DarwinInitializationSettings initializationSettingsDarwin = + DarwinInitializationSettings( + requestAlertPermission: true, + requestBadgePermission: true, + requestSoundPermission: true, + onDidReceiveLocalNotification: (id, title, body, payload) async {}, + ); + final LinuxInitializationSettings initializationSettingsLinux = + LinuxInitializationSettings(defaultActionName: 'Open notification'); + final InitializationSettings initializationSettings = + InitializationSettings( + android: initializationSettingsAndroid, + iOS: initializationSettingsDarwin, + linux: initializationSettingsLinux); + _flutterLocalNotificationsPlugin.initialize(initializationSettings, + onDidReceiveNotificationResponse: + (NotificationResponse notificationResponse) async {}); + } + + static Future showsimplenotification( + {required String title, + required String body, + required String payload}) async { + const AndroidNotificationDetails androidNotificationDetails = + AndroidNotificationDetails('your channel id', 'your channel name', + channelDescription: 'your channel description', + importance: Importance.max, + priority: Priority.high, + ticker: 'ticker'); + const NotificationDetails notificationDetails = + NotificationDetails(android: androidNotificationDetails); + await _flutterLocalNotificationsPlugin + .show(0, title, body, notificationDetails, payload: payload); + } + + static Future showperiodicnnotification( {required String title, + required String body, + required String payload}) async { + const AndroidNotificationDetails androidNotificationDetails = + AndroidNotificationDetails('your channel id', 'your channel name', + channelDescription: 'your channel description', + importance: Importance.max, + priority: Priority.high, + ticker: 'ticker'); + const NotificationDetails notificationDetails = + NotificationDetails(android: androidNotificationDetails); + await _flutterLocalNotificationsPlugin.periodicallyShow( + 1, title, body, RepeatInterval.everyMinute, notificationDetails); + } +} diff --git a/pubspec.lock b/pubspec.lock index cca00b3..c2132f3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -712,6 +712,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + shimmer: + dependency: "direct main" + description: + name: shimmer + sha256: "5f88c883a22e9f9f299e5ba0e4f7e6054857224976a5d9f839d4ebdc94a14ac9" + url: "https://pub.dev" + source: hosted + version: "3.0.0" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 43c1314..dadca87 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,6 +53,7 @@ dependencies: permission_handler: ^11.0.1 timezone: ^0.9.2 connectivity_plus: ^5.0.1 + shimmer: ^3.0.0 dev_dependencies: flutter_test: