From ff03821c71976936d49570cc2df3f86cbf4f5899 Mon Sep 17 00:00:00 2001 From: "MOHAMED\\20109" Date: Sun, 6 Oct 2024 03:02:50 +0300 Subject: [PATCH 1/2] updata all fiels what you need without change logic --- lib/core/constant/app_colors.dart | 11 ++-- lib/core/my_bloc_observer.dart | 25 +++++-- .../presentation/pages/done_todo_page.dart | 2 +- .../presentation/pages/splash_screen.dart | 11 +++- .../todo/presentation/pages/todo_page.dart | 2 +- .../done_todo_posts_widget.dart | 4 +- .../widgets/public/dialog_widget.dart | 4 +- .../widgets/todo_page/bg_bottom_bar.dart | 2 +- .../widgets/todo_page/bg_drawer.dart | 4 +- .../widgets/todo_page/bg_widget.dart | 4 +- .../todo_page/button_add_and_done.dart | 2 +- .../description_form_field.dart | 8 +-- .../drawer_widgets/drawer_time_and_data.dart | 4 +- .../todo_page/drawer_widgets/icon_widget.dart | 2 +- .../drawer_widgets/name_form_filed.dart | 6 +- .../todo_page/icon_bottom_gradent.dart | 2 +- .../widgets/todo_page/main_bottom_bar.dart | 2 +- .../widgets/todo_page/todo_post_widget.dart | 4 +- .../todo_page/todo_posts_checkout.dart | 6 +- lib/theme/my_theme.dart | 6 +- pubspec.lock | 66 +++++++++++++------ 21 files changed, 110 insertions(+), 67 deletions(-) diff --git a/lib/core/constant/app_colors.dart b/lib/core/constant/app_colors.dart index ca60c74..2f09198 100644 --- a/lib/core/constant/app_colors.dart +++ b/lib/core/constant/app_colors.dart @@ -13,9 +13,10 @@ class AppColors { static Color orange = const Color(0xffFEA64C) ; static Color white = const Color(0xFFFFFFFF) ; static Color black = const Color(0xFF000000) ; - static Color shop = const Color(0xFFFEA64C).withOpacity(0.3) ; - static Color sport = const Color(0xFFFE1E9A).withOpacity(0.3) ; - static Color location = const Color(0xFF254DDE).withOpacity(0.3) ; - static Color health= const Color(0xFFFE1E9A).withOpacity(0.3) ; - static Color other = const Color(0xFF181743).withOpacity(0.3) ; +static Color shop = const Color(0xFFFEA64C).withValues(alpha: 0.3); +static Color sport = const Color(0xFFFE1E9A).withValues(alpha: 0.3); +static Color location = const Color(0xFF254DDE).withValues(alpha: 0.3); +static Color health = const Color(0xFFFE1E9A).withValues(alpha: 0.3); +static Color other = const Color(0xFF181743).withValues(alpha: 0.3); + } \ No newline at end of file diff --git a/lib/core/my_bloc_observer.dart b/lib/core/my_bloc_observer.dart index 0641863..4efbc34 100644 --- a/lib/core/my_bloc_observer.dart +++ b/lib/core/my_bloc_observer.dart @@ -1,39 +1,52 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class MyBlocObserver extends BlocObserver { @override void onCreate(BlocBase bloc) { super.onCreate(bloc); - print('onCreate -- ${bloc.runtimeType}'); + if (kDebugMode) { + print('onCreate -- ${bloc.runtimeType}'); + } } @override void onEvent(Bloc bloc, Object? event) { super.onEvent(bloc, event); - print('onEvent -- ${bloc.runtimeType}, $event'); + if (kDebugMode) { + print('onEvent -- ${bloc.runtimeType}, $event'); + } } @override void onChange(BlocBase bloc, Change change) { super.onChange(bloc, change); - print('onChange -- ${bloc.runtimeType}, $change'); + if (kDebugMode) { + print('onChange -- ${bloc.runtimeType}, $change'); + } } @override void onTransition(Bloc bloc, Transition transition) { super.onTransition(bloc, transition); - print('onTransition -- ${bloc.runtimeType}, $transition'); + if (kDebugMode) { + print('onTransition -- ${bloc.runtimeType}, $transition'); + } } @override void onError(BlocBase bloc, Object error, StackTrace stackTrace) { - print('onError -- ${bloc.runtimeType}, $error'); + if (kDebugMode) { + print('onError -- ${bloc.runtimeType}, $error'); + } super.onError(bloc, error, stackTrace); } @override void onClose(BlocBase bloc) { super.onClose(bloc); - print('onClose -- ${bloc.runtimeType}'); + if (kDebugMode) { + print('onClose -- ${bloc.runtimeType}'); + } } } \ No newline at end of file diff --git a/lib/features/todo/presentation/pages/done_todo_page.dart b/lib/features/todo/presentation/pages/done_todo_page.dart index 38435fe..eee468b 100644 --- a/lib/features/todo/presentation/pages/done_todo_page.dart +++ b/lib/features/todo/presentation/pages/done_todo_page.dart @@ -44,7 +44,7 @@ class DoneTodoPage extends StatelessWidget { return Expanded( child: Center( child: CircularProgressIndicator( - color: AppColors.bgGrandentTop.withOpacity(0.3), + color: AppColors.bgGrandentTop.withValues(alpha:0.3), ), )); } else if (state is ErrorTodoState) { diff --git a/lib/features/todo/presentation/pages/splash_screen.dart b/lib/features/todo/presentation/pages/splash_screen.dart index c51fdc6..6079fcb 100644 --- a/lib/features/todo/presentation/pages/splash_screen.dart +++ b/lib/features/todo/presentation/pages/splash_screen.dart @@ -11,14 +11,19 @@ class SplashScreen extends StatefulWidget { } class _SplashScreenState extends State { - Future goToHome () async{ - await Future.delayed(const Duration(seconds: 3) , ()=> Navigator.of(context).pushNamedAndRemoveUntil(AppRoute.todo, (route) => false)); + Future goToHome() async { + await Future.delayed(const Duration(seconds: 3)); + if (mounted) { + Navigator.of(context).pushNamedAndRemoveUntil(AppRoute.todo, (route) => false); + } } + @override void initState() { - goToHome(); super.initState(); + goToHome(); } + @override Widget build(BuildContext context) { return Container( diff --git a/lib/features/todo/presentation/pages/todo_page.dart b/lib/features/todo/presentation/pages/todo_page.dart index 3dec741..634ed04 100644 --- a/lib/features/todo/presentation/pages/todo_page.dart +++ b/lib/features/todo/presentation/pages/todo_page.dart @@ -110,7 +110,7 @@ class _TodoPageState extends State { Expanded( child: Center( child: CircularProgressIndicator( - color: AppColors.bgGrandentTop.withOpacity(0.3), + color: AppColors.bgGrandentTop.withValues(alpha:0.3), ), )); //! diff --git a/lib/features/todo/presentation/widgets/done_todo_page/done_todo_posts_widget.dart b/lib/features/todo/presentation/widgets/done_todo_page/done_todo_posts_widget.dart index e3bbd2d..92abc3a 100644 --- a/lib/features/todo/presentation/widgets/done_todo_page/done_todo_posts_widget.dart +++ b/lib/features/todo/presentation/widgets/done_todo_page/done_todo_posts_widget.dart @@ -17,10 +17,10 @@ class DoneTodoPostWidget extends StatelessWidget { width: double.maxFinite, height: 52, decoration: BoxDecoration( - color: AppColors.white.withOpacity(0.9), + color: AppColors.white.withValues(alpha:0.9), borderRadius: BorderRadius.circular(6), boxShadow: [ - BoxShadow(color: AppColors.black.withOpacity(0.06), blurRadius: 6, offset: const Offset(0, 1)) + BoxShadow(color: AppColors.black.withValues(alpha:0.6), blurRadius: 6, offset: const Offset(0, 1)) ]), child: Row( children: [ diff --git a/lib/features/todo/presentation/widgets/public/dialog_widget.dart b/lib/features/todo/presentation/widgets/public/dialog_widget.dart index bf73953..84b4b08 100644 --- a/lib/features/todo/presentation/widgets/public/dialog_widget.dart +++ b/lib/features/todo/presentation/widgets/public/dialog_widget.dart @@ -13,7 +13,7 @@ class DialogMoreWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Dialog( - backgroundColor: const Color(0xFF000000).withOpacity(0), + backgroundColor: const Color(0xFF000000).withValues(alpha:0), insetPadding: const EdgeInsets.all(0), child: SizedBox( child: Container( @@ -41,7 +41,7 @@ class PartTopOfDialog extends StatelessWidget { height: 123, width: double.maxFinite, decoration: BoxDecoration( - color: AppColors.bgGrandentTop.withOpacity(0.02), + color: AppColors.bgGrandentTop.withValues(alpha:0.02), borderRadius: const BorderRadius.vertical(bottom: Radius.circular(6))), child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/features/todo/presentation/widgets/todo_page/bg_bottom_bar.dart b/lib/features/todo/presentation/widgets/todo_page/bg_bottom_bar.dart index 6a2fc18..d5d629f 100644 --- a/lib/features/todo/presentation/widgets/todo_page/bg_bottom_bar.dart +++ b/lib/features/todo/presentation/widgets/todo_page/bg_bottom_bar.dart @@ -14,7 +14,7 @@ final Widget widget ; width: double.maxFinite, decoration: BoxDecoration( gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ - const Color(0xffCAEBFE).withOpacity(0), + const Color(0xffCAEBFE).withValues(alpha:0), const Color(0xffffffff), ])), child: widget , diff --git a/lib/features/todo/presentation/widgets/todo_page/bg_drawer.dart b/lib/features/todo/presentation/widgets/todo_page/bg_drawer.dart index d4121b4..cdca458 100644 --- a/lib/features/todo/presentation/widgets/todo_page/bg_drawer.dart +++ b/lib/features/todo/presentation/widgets/todo_page/bg_drawer.dart @@ -27,7 +27,7 @@ class BgDrawer extends StatelessWidget { gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, - colors: [AppColors.bgGrandentTop.withOpacity(0.03), AppColors.bgGrandentDown.withOpacity(0.03)]), + colors: [AppColors.bgGrandentTop.withValues(alpha:0.03), AppColors.bgGrandentDown.withValues(alpha:0.03)]), image: DecorationImage(image: AssetImage(AppImages.bgDrawer), fit: BoxFit.cover)), ); } @@ -39,7 +39,7 @@ class BgDrawer extends StatelessWidget { decoration: BoxDecoration( gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ const Color(0xffffffff), - AppColors.filterColor.withOpacity(0.0), + AppColors.filterColor.withValues(alpha:0.0), ])), ); } diff --git a/lib/features/todo/presentation/widgets/todo_page/bg_widget.dart b/lib/features/todo/presentation/widgets/todo_page/bg_widget.dart index b933315..1a97796 100644 --- a/lib/features/todo/presentation/widgets/todo_page/bg_widget.dart +++ b/lib/features/todo/presentation/widgets/todo_page/bg_widget.dart @@ -31,7 +31,7 @@ class BgWidget extends StatelessWidget { gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, - colors: [AppColors.bgGrandentTop.withOpacity(0.03),AppColors.bgGrandentDown.withOpacity(0.03)]), + colors: [AppColors.bgGrandentTop.withValues(alpha:0.03),AppColors.bgGrandentDown.withValues(alpha:0)]), image: DecorationImage(image: AssetImage(AppImages.bgImage), fit: BoxFit.cover)), ); } @@ -42,7 +42,7 @@ class BgWidget extends StatelessWidget { decoration: BoxDecoration( gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ AppColors.white, - AppColors.filterColor.withOpacity(0.0), + AppColors.filterColor.withValues(alpha:0), ])), ); } diff --git a/lib/features/todo/presentation/widgets/todo_page/button_add_and_done.dart b/lib/features/todo/presentation/widgets/todo_page/button_add_and_done.dart index 28a5bd9..933e9e6 100644 --- a/lib/features/todo/presentation/widgets/todo_page/button_add_and_done.dart +++ b/lib/features/todo/presentation/widgets/todo_page/button_add_and_done.dart @@ -16,7 +16,7 @@ class ButtonAddAndDone extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), boxShadow: [ - BoxShadow(color: AppColors.iconAddBgGrandentTop.withOpacity(0.3), blurRadius: 6, offset: const Offset(0, 3)) + BoxShadow(color: AppColors.iconAddBgGrandentTop.withValues(alpha:0.3), blurRadius: 6, offset: const Offset(0, 3)) ], gradient: LinearGradient( begin: Alignment.topRight, diff --git a/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/description_form_field.dart b/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/description_form_field.dart index 5628eba..2e3c3c1 100644 --- a/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/description_form_field.dart +++ b/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/description_form_field.dart @@ -15,10 +15,10 @@ class DescriptionFormField extends StatelessWidget { controller: textEditingController, style: TextStyle(fontSize: 14, color: AppColors.bgGrandentTop), cursorHeight: 20, - cursorColor: AppColors.bgGrandentTop.withOpacity(0.4), + cursorColor: AppColors.bgGrandentTop.withValues(alpha:0.4), decoration: InputDecoration( filled: true, - fillColor: AppColors.white.withOpacity(0.8), + fillColor: AppColors.white.withValues(alpha:0.8), contentPadding: const EdgeInsets.all(7), isDense: true, hintText: 'Add description for you to do', @@ -26,10 +26,10 @@ class DescriptionFormField extends StatelessWidget { border: const OutlineInputBorder(), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(6), - borderSide: BorderSide(color: AppColors.bgGrandentTop.withOpacity(0.2))), + borderSide: BorderSide(color: AppColors.bgGrandentTop.withValues(alpha:0.2))), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(6), - borderSide: BorderSide(color: AppColors.bgGrandentTop.withOpacity(0.2)))), + borderSide: BorderSide(color: AppColors.bgGrandentTop.withValues(alpha:0.2)))), ), ); } diff --git a/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/drawer_time_and_data.dart b/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/drawer_time_and_data.dart index b3046f2..51087e6 100644 --- a/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/drawer_time_and_data.dart +++ b/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/drawer_time_and_data.dart @@ -15,7 +15,7 @@ class DrawerTimeAndData extends StatelessWidget { // ignore: avoid_unnecessary_containers childWidget: Container( child: InkWell( - splashColor: AppColors.white.withOpacity(0), + splashColor: AppColors.white.withValues(alpha:0), onTap: onTapIcon, child: Column( children: [ @@ -25,7 +25,7 @@ class DrawerTimeAndData extends StatelessWidget { ), Divider( thickness: 1, - color: AppColors.bgGrandentTop.withOpacity(0.12), + color: AppColors.bgGrandentTop.withValues(alpha:0.12), ) ], ), diff --git a/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/icon_widget.dart b/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/icon_widget.dart index f25ec23..1b10904 100644 --- a/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/icon_widget.dart +++ b/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/icon_widget.dart @@ -44,7 +44,7 @@ class IconWidget extends StatelessWidget { height: 32, width: 32, child: CircleAvatar( - backgroundColor: StaticData.colorsStatusImage[index].colorStatus.withOpacity(0.12), + backgroundColor: StaticData.colorsStatusImage[index].colorStatus.withValues(alpha: 0.12), ), ); } diff --git a/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/name_form_filed.dart b/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/name_form_filed.dart index b4d997b..199e7f1 100644 --- a/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/name_form_filed.dart +++ b/lib/features/todo/presentation/widgets/todo_page/drawer_widgets/name_form_filed.dart @@ -13,16 +13,16 @@ class NameFormField extends StatelessWidget { controller: textEditingController, style: TextStyle(fontSize: 14, color: AppColors.bgGrandentTop), cursorHeight: 20, - cursorColor: AppColors.bgGrandentTop.withOpacity(0.4), + cursorColor: AppColors.bgGrandentTop.withValues(alpha: 0.4), decoration: InputDecoration( contentPadding: const EdgeInsets.only(top: 3, bottom: 7), isDense: true, hintText: 'Add name for you to do', hintStyle: const TextStyle(fontSize: 12), enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: AppColors.bgGrandentDown.withOpacity(0.3), width: 1)), + borderSide: BorderSide(color: AppColors.bgGrandentDown.withValues(alpha: 0.3), width: 1)), focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: AppColors.bgGrandentDown.withOpacity(0.5), width: 1.5))), + borderSide: BorderSide(color: AppColors.bgGrandentDown.withValues(alpha: 0.5), width: 1.5))), ), ); } diff --git a/lib/features/todo/presentation/widgets/todo_page/icon_bottom_gradent.dart b/lib/features/todo/presentation/widgets/todo_page/icon_bottom_gradent.dart index 9e7a61d..9fef78c 100644 --- a/lib/features/todo/presentation/widgets/todo_page/icon_bottom_gradent.dart +++ b/lib/features/todo/presentation/widgets/todo_page/icon_bottom_gradent.dart @@ -17,7 +17,7 @@ class IconBottomGradent extends StatelessWidget { width: 46, decoration: BoxDecoration( shape: BoxShape.circle, - boxShadow: [BoxShadow(color: topGrandient.withOpacity(0.3), blurRadius: 6, offset: const Offset(0, 3))], + boxShadow: [BoxShadow(color: topGrandient.withValues(alpha: 0.3), blurRadius: 6, offset: const Offset(0, 3))], gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [topGrandient, bottomGrandient])), child: Center( diff --git a/lib/features/todo/presentation/widgets/todo_page/main_bottom_bar.dart b/lib/features/todo/presentation/widgets/todo_page/main_bottom_bar.dart index 4677b0f..06c4bc6 100644 --- a/lib/features/todo/presentation/widgets/todo_page/main_bottom_bar.dart +++ b/lib/features/todo/presentation/widgets/todo_page/main_bottom_bar.dart @@ -41,7 +41,7 @@ class MainBottomBar extends StatelessWidget { width: 56, decoration: BoxDecoration( color: AppColors.white, - boxShadow: [BoxShadow(color: AppColors.other.withOpacity(0.2), blurRadius: 6, offset: const Offset(0, 4))], + boxShadow: [BoxShadow(color: AppColors.other.withValues(alpha: 0.2), blurRadius: 6, offset: const Offset(0, 4))], shape: BoxShape.circle, ), child: Center( diff --git a/lib/features/todo/presentation/widgets/todo_page/todo_post_widget.dart b/lib/features/todo/presentation/widgets/todo_page/todo_post_widget.dart index adb38b5..a35d625 100644 --- a/lib/features/todo/presentation/widgets/todo_page/todo_post_widget.dart +++ b/lib/features/todo/presentation/widgets/todo_page/todo_post_widget.dart @@ -20,10 +20,10 @@ class TodoPostWidget extends StatelessWidget { width: double.maxFinite, height: 52, decoration: BoxDecoration( - color: AppColors.white.withOpacity(0.9), + color: AppColors.white.withValues(alpha: 0.9), borderRadius: BorderRadius.circular(6), boxShadow: [ - BoxShadow(color: AppColors.black.withOpacity(0.06), blurRadius: 6, offset: const Offset(0, 1)) + BoxShadow(color: AppColors.black.withValues(alpha: 0.06), blurRadius: 6, offset: const Offset(0, 1)) ]), child: Row( children: [ diff --git a/lib/features/todo/presentation/widgets/todo_page/todo_posts_checkout.dart b/lib/features/todo/presentation/widgets/todo_page/todo_posts_checkout.dart index 89da435..ccc12c2 100644 --- a/lib/features/todo/presentation/widgets/todo_page/todo_posts_checkout.dart +++ b/lib/features/todo/presentation/widgets/todo_page/todo_posts_checkout.dart @@ -21,10 +21,10 @@ class TodoPostsCheckout extends StatelessWidget { decoration: BoxDecoration( color: AppColors.white, borderRadius: BorderRadius.circular(6), - border: Border.all(color: AppColors.bgGrandentTop.withOpacity(0.2)), + border: Border.all(color: AppColors.bgGrandentTop.withValues(alpha: 0.2)), boxShadow: [ BoxShadow( - color: AppColors.iconDoneBgGrandentTop.withOpacity(0.1), blurRadius: 4, offset: const Offset(0, 2)), + color: AppColors.iconDoneBgGrandentTop.withValues(alpha: 0.1), blurRadius: 4, offset: const Offset(0, 2)), ]), child: _checkIcon(), ), @@ -41,7 +41,7 @@ class TodoPostsCheckout extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(6), gradient: LinearGradient(colors: [ - AppColors.white.withOpacity(0), + AppColors.white.withValues(alpha: 0), AppColors.white, ])), child: widget, diff --git a/lib/theme/my_theme.dart b/lib/theme/my_theme.dart index 2f30e23..25f10c1 100644 --- a/lib/theme/my_theme.dart +++ b/lib/theme/my_theme.dart @@ -8,12 +8,12 @@ ThemeData myTheme() { titleLarge: TextStyle(fontSize: 20, color: AppColors.bgGrandentTop, fontFamily: "baloo"), titleSmall: TextStyle(fontSize: 16, color: AppColors.bgGrandentTop, fontWeight: FontWeight.bold), labelLarge: - TextStyle(fontSize: 12, color: AppColors.bgGrandentTop.withOpacity(0.2), fontWeight: FontWeight.bold), + TextStyle(fontSize: 12, color: AppColors.bgGrandentTop.withValues(alpha: 0.2), fontWeight: FontWeight.bold), labelMedium: - TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: AppColors.bgGrandentTop.withOpacity(0.8)), + TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: AppColors.bgGrandentTop.withValues(alpha: 0.8)), // ignore: prefer_const_constructors bodySmall: TextStyle(fontSize: 12, color: const Color(0xff95989A)), bodyMedium: TextStyle( color: AppColors.bgGrandentTop, fontFamily: "lato", fontSize: 14, overflow: TextOverflow.ellipsis), - labelSmall: TextStyle(fontSize: 10, color: AppColors.bgGrandentTop.withOpacity(0.6)))); + labelSmall: TextStyle(fontSize: 10, color: AppColors.bgGrandentTop.withValues(alpha: 0.6)))); } diff --git a/pubspec.lock b/pubspec.lock index a8421a1..f60dfd1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" crypto: dependency: transitive description: @@ -203,6 +203,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -215,26 +239,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.15.0" nested: dependency: transitive description: @@ -255,10 +279,10 @@ packages: dependency: "direct main" description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" petitparser: dependency: transitive description: @@ -279,7 +303,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -324,10 +348,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" synchronized: dependency: transitive description: @@ -348,10 +372,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.3" typed_data: dependency: transitive description: @@ -432,14 +456,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "14.2.5" xml: dependency: transitive description: @@ -457,5 +481,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.3 <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" From 963276001f8143b0135903aee8aa9d13db056e5d Mon Sep 17 00:00:00 2001 From: "MOHAMED\\20109" Date: Sun, 6 Oct 2024 03:32:09 +0300 Subject: [PATCH 2/2] add packge sqflit_common_ffi --- lib/core/database/todo_data_base.dart | 28 +++++++++++--------- pubspec.lock | 38 ++++++++++++++++++++++++--- pubspec.yaml | 34 +++++++++--------------- 3 files changed, 64 insertions(+), 36 deletions(-) diff --git a/lib/core/database/todo_data_base.dart b/lib/core/database/todo_data_base.dart index f201e45..fccf6ac 100644 --- a/lib/core/database/todo_data_base.dart +++ b/lib/core/database/todo_data_base.dart @@ -1,4 +1,4 @@ -import 'package:sqflite/sqflite.dart'; +import 'package:sqflite_common_ffi/sqflite_ffi.dart'; import 'package:path/path.dart'; import 'package:todo/features/todo/data/models/todo_model.dart'; @@ -13,6 +13,12 @@ const String time = "time"; class TodoDataBase { static Database? _db; + TodoDataBase() { + // Initialize the database factory for FFI + sqfliteFfiInit(); + databaseFactory = databaseFactoryFfi; + } + Future get db async { if (_db == null) { _db = await initDataBase(); @@ -31,15 +37,15 @@ class TodoDataBase { _onCraete(Database database, int version) { database.execute(''' - CREATE TABLE todo ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - iconId INTEGER, - isDone INTEGER, - title TEXT, - description TEXT, - time TEXT - ) -'''); + CREATE TABLE todo ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + iconId INTEGER, + isDone INTEGER, + title TEXT, + description TEXT, + time TEXT + ) + '''); } Future insertTodo(TodoModel todoModel) async { @@ -62,8 +68,6 @@ class TodoDataBase { Future getNotDoneTodo() async { Database? database = await db; - // List status = await database! - // .query(todo, columns: [id, iconId, isDone, title, description, time], where: '$isDone = ?', whereArgs: [0]); List status = await database!.rawQuery('SELECT * FROM $todo WHERE $isDone = 0 ORDER BY $id DESC'); return status; } diff --git a/pubspec.lock b/pubspec.lock index f60dfd1..4329052 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -121,6 +121,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + url: "https://pub.dev" + source: hosted + version: "2.1.3" flutter: dependency: "direct main" description: flutter @@ -324,10 +332,26 @@ packages: dependency: transitive description: name: sqflite_common - sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" + sha256: "2d8e607db72e9cb7748c9c6e739e2c9618320a5517de693d5a24609c4671b1a4" + url: "https://pub.dev" + source: hosted + version: "2.5.4+4" + sqflite_common_ffi: + dependency: "direct main" + description: + name: sqflite_common_ffi + sha256: a6057d4c87e9260ba1ec436ebac24760a110589b9c0a859e128842eb69a7ef04 url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.3.3+1" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: "45f168ae2213201b54e09429ed0c593dc2c88c924a1488d6f9c523a255d567cb" + url: "https://pub.dev" + source: hosted + version: "2.4.6" stack_trace: dependency: transitive description: @@ -464,6 +488,14 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.5" + web: + dependency: transitive + description: + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + url: "https://pub.dev" + source: hosted + version: "1.1.0" xml: dependency: transitive description: @@ -481,5 +513,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" + dart: ">=3.5.0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index 7dd9997..0210658 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,29 +28,24 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: + bloc: ^8.1.4 + cupertino_icons: ^1.0.2 + dartz: ^0.10.1 + equatable: ^2.0.5 flutter: sdk: flutter - - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.2 flutter_bloc: ^8.1.5 - equatable: ^2.0.5 - dartz: ^0.10.1 - sqflite: ^2.3.2 - path: ^1.8.3 - bloc: ^8.1.4 - page_transition: ^2.1.0 get_it: ^7.6.7 - jiffy: ^6.3.0 gradient_icon: ^2.0.9 + jiffy: ^6.3.0 + page_transition: ^2.1.0 + path: ^1.8.3 + sqflite: ^2.3.2 + sqflite_common_ffi: ^2.3.3+1 uicons: ^1.0.1 dev_dependencies: - flutter_test: - sdk: flutter - + flutter_launcher_icons: ^0.13.1 # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is @@ -58,8 +53,9 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^2.0.0 - flutter_launcher_icons: ^0.13.1 - + flutter_test: + sdk: flutter + flutter_launcher_icons: android: "launcher_icon" ios: true @@ -68,7 +64,6 @@ flutter_launcher_icons: # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec - # The following section is specific to Flutter packages. flutter: @@ -81,13 +76,10 @@ flutter: assets: - assets/images/ # - images/a_dot_ham.jpeg - # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware - # For details regarding adding assets from package dependencies, see # https://flutter.dev/assets-and-images/#from-packages - # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a