From bcc25934c799c031a9ab128432d7e6fdb9a14c77 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:36:57 +0300 Subject: [PATCH 01/13] handle key store for play store --- android/app/build.gradle.kts | 24 ++++++++++++++-- android/app/src/main/AndroidManifest.xml | 2 +- .../MainActivity.kt | 2 +- ios/Runner/Base.lproj/LaunchScreen.storyboard | 21 +++++++++----- ios/Runner/Base.lproj/Main.storyboard | 13 +++++---- linux/CMakeLists.txt | 2 +- linux/my_application.cc | 4 +-- macos/Podfile | 2 +- macos/Podfile.lock | 4 +-- macos/Runner.xcodeproj/project.pbxproj | 6 ++-- pubspec.lock | 28 +++++++++---------- pubspec.yaml | 6 ++-- windows/runner/Runner.rc | 8 +++--- windows/runner/main.cpp | 2 +- 14 files changed, 76 insertions(+), 48 deletions(-) rename android/app/src/main/kotlin/com/example/{algorithm_visualizer => algodive}/MainActivity.kt (69%) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 84922bf..5475c0e 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,3 +1,6 @@ +import java.util.Properties +import java.io.FileInputStream + plugins { id("com.android.application") id("kotlin-android") @@ -5,11 +8,26 @@ plugins { id("dev.flutter.flutter-gradle-plugin") } +val keystoreProperties = Properties() +val keystorePropertiesFile = rootProject.file("key.properties") +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) +} + android { - namespace = "com.example.algorithm_visualizer" + namespace = "com.elhawary.algodive" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion + signingConfigs { + create("release") { + keyAlias = keystoreProperties["keyAlias"] as String + keyPassword = keystoreProperties["keyPassword"] as String + storeFile = keystoreProperties["storeFile"]?.let { file(it) } + storePassword = keystoreProperties["storePassword"] as String + } + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -21,7 +39,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "com.example.algorithm_visualizer" + applicationId = "com.elhawary.algodive" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion @@ -34,7 +52,7 @@ android { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") + signingConfig = signingConfigs.getByName("release") } } } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index de0045a..a6bcd7c 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ - + + + - + + @@ -14,10 +16,15 @@ + - - + + + + + + @@ -34,11 +41,11 @@ - + - + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard index f3c2851..b231b7a 100644 --- a/ios/Runner/Base.lproj/Main.storyboard +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -1,8 +1,10 @@ - - + + + - + + @@ -14,13 +16,14 @@ - + - + + diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 5e1ac4c..0d64bbb 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -7,7 +7,7 @@ project(runner LANGUAGES CXX) set(BINARY_NAME "algorithm_visualizer") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "com.example.algorithm_visualizer") +set(APPLICATION_ID "com.elhawary.algo_dive") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. diff --git a/linux/my_application.cc b/linux/my_application.cc index 2a5aeef..9ef3755 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) { if (use_header_bar) { GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "algorithm_visualizer"); + gtk_header_bar_set_title(header_bar, "algodive"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); } else { - gtk_window_set_title(window, "algorithm_visualizer"); + gtk_window_set_title(window, "algodive"); } gtk_window_set_default_size(window, 1280, 720); diff --git a/macos/Podfile b/macos/Podfile index c795730..b52666a 100644 --- a/macos/Podfile +++ b/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.14' +platform :osx, '10.15' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 8590126..9e12755 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -15,9 +15,9 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin SPEC CHECKSUMS: - FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 -PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 +PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3 COCOAPODS: 1.16.2 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 05ed00a..5a07389 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -557,7 +557,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -639,7 +639,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -689,7 +689,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/pubspec.lock b/pubspec.lock index bb34daa..ce381c9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -90,18 +90,18 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "6.0.0" flutter_riverpod: dependency: "direct main" description: name: flutter_riverpod - sha256: "0f1974eff5bbe774bf1d870e406fc6f29e3d6f1c46bd9c58e7172ff68a785d7d" + sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.6.1" flutter_screenutil: dependency: "direct main" description: @@ -140,10 +140,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1 + sha256: a4292e7cf67193f8e7c1258203104eb2a51ec8b3a04baa14695f4064c144297b url: "https://pub.dev" source: hosted - version: "7.7.0" + version: "8.2.0" get_storage: dependency: "direct main" description: @@ -156,10 +156,10 @@ packages: dependency: "direct main" description: name: go_router - sha256: d380de0355788c5c784fe9f81b43fc833b903991c25ecc4e2a416a67faefa722 + sha256: eb059dfe59f08546e9787f895bd01652076f996bcbf485a8609ef990419ad227 url: "https://pub.dev" source: hosted - version: "14.2.2" + version: "16.2.1" http: dependency: transitive description: @@ -204,10 +204,10 @@ packages: dependency: transitive description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "6.0.0" logging: dependency: transitive description: @@ -332,10 +332,10 @@ packages: dependency: "direct main" description: name: riverpod - sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d + sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.6.1" sky_engine: dependency: transitive description: flutter @@ -470,5 +470,5 @@ packages: source: hosted version: "6.5.0" sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=3.8.0 <4.0.0" + flutter: ">=3.29.0" diff --git a/pubspec.yaml b/pubspec.yaml index 06fcbe3..ce6587b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,8 +11,8 @@ environment: dependencies: flutter: sdk: flutter - go_router: ^14.2.1 - get_it: ^7.6.7 + go_router: ^16.2.1 + get_it: ^8.2.0 flutter_screenutil: ^5.9.1 flutter_svg: ^2.0.10+1 riverpod: ^2.5.1 # not used yet @@ -29,7 +29,7 @@ dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.0 + flutter_lints: ^6.0.0 flutter: diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 9640513..da0b324 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -90,12 +90,12 @@ BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "com.example" "\0" - VALUE "FileDescription", "algorithm_visualizer" "\0" + VALUE "FileDescription", "algodive" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "algorithm_visualizer" "\0" + VALUE "InternalName", "algodive" "\0" VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" - VALUE "OriginalFilename", "algorithm_visualizer.exe" "\0" - VALUE "ProductName", "algorithm_visualizer" "\0" + VALUE "OriginalFilename", "algodive.exe" "\0" + VALUE "ProductName", "algodive" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" END END diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp index 7850fe1..0224e47 100644 --- a/windows/runner/main.cpp +++ b/windows/runner/main.cpp @@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, FlutterWindow window(project); Win32Window::Point origin(10, 10); Win32Window::Size size(1280, 720); - if (!window.Create(L"algorithm_visualizer", origin, size)) { + if (!window.Create(L"algodive", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true); From 28f895371484e1d5dbdee3dbe05da305a7448551 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:10 +0300 Subject: [PATCH 02/13] reformat the code --- lib/core/enums/app_settings_enum.dart | 1 - lib/core/helpers/app_bar/app_bar.dart | 9 +++------ lib/core/helpers/app_bar/back_button.dart | 1 - .../storage/app_settings/app_settings_cubit.dart | 10 +++------- lib/core/resources/color_manager.dart | 11 +++++------ lib/core/widgets/adapt_widget_size.dart | 4 +--- lib/core/widgets/adaptive/padding/all_padding.dart | 3 +-- lib/core/widgets/adaptive/padding/bottom_padding.dart | 4 +--- lib/core/widgets/adaptive/text/bold_text.dart | 4 ++-- 9 files changed, 16 insertions(+), 31 deletions(-) diff --git a/lib/core/enums/app_settings_enum.dart b/lib/core/enums/app_settings_enum.dart index 4dc6195..1c44f82 100644 --- a/lib/core/enums/app_settings_enum.dart +++ b/lib/core/enums/app_settings_enum.dart @@ -1,2 +1 @@ - enum LanguagesEnum { english, arabic } diff --git a/lib/core/helpers/app_bar/app_bar.dart b/lib/core/helpers/app_bar/app_bar.dart index 93ac31b..aa5f3eb 100644 --- a/lib/core/helpers/app_bar/app_bar.dart +++ b/lib/core/helpers/app_bar/app_bar.dart @@ -6,8 +6,7 @@ import 'package:algorithm_visualizer/core/widgets/adaptive/text/adaptive_text.da import 'package:flutter/material.dart'; class CustomAppBar { - static AppBar iconAppBar( - {bool isShadowTransparent = true, bool withBackButton = true}) { + static AppBar iconAppBar({bool isShadowTransparent = true, bool withBackButton = true}) { return GlobalAppBar( centerTitle: true, // title: const AppLogo(), @@ -110,10 +109,8 @@ class AppBarCheckButton extends StatelessWidget { Widget build(BuildContext context) { return IconButton( icon: enableTap - ? const Icon(Icons.check_rounded, - size: secondAppBarIconSize, color: ColorManager.blue) - : const Icon(Icons.check_rounded, - size: secondAppBarIconSize, color: ColorManager.lightBlue), + ? const Icon(Icons.check_rounded, size: secondAppBarIconSize, color: ColorManager.blue) + : const Icon(Icons.check_rounded, size: secondAppBarIconSize, color: ColorManager.lightBlue), onPressed: () { final onTap = this.onTap; if (onTap != null) onTap(); diff --git a/lib/core/helpers/app_bar/back_button.dart b/lib/core/helpers/app_bar/back_button.dart index 0d4967a..d0dce55 100644 --- a/lib/core/helpers/app_bar/back_button.dart +++ b/lib/core/helpers/app_bar/back_button.dart @@ -8,7 +8,6 @@ class CustomAppBarBackButton extends StatelessWidget { Widget build(BuildContext context) { return IconButton( icon: const CustomBackButtonIcon(), - onPressed: () { Navigator.maybePop(context); }, diff --git a/lib/core/helpers/storage/app_settings/app_settings_cubit.dart b/lib/core/helpers/storage/app_settings/app_settings_cubit.dart index 3fd137d..5112a23 100644 --- a/lib/core/helpers/storage/app_settings/app_settings_cubit.dart +++ b/lib/core/helpers/storage/app_settings/app_settings_cubit.dart @@ -8,8 +8,7 @@ part 'app_settings_state.dart'; // Define your StateNotifierProvider final appSettingsProvider = - StateNotifierProvider( - (ref) => AppSettingsNotifier()); + StateNotifierProvider((ref) => AppSettingsNotifier()); class AppSettingsNotifier extends StateNotifier { AppSettingsNotifier() : super(AppSettingsState.initial()); @@ -25,8 +24,7 @@ class AppSettingsNotifier extends StateNotifier { LanguagesEnum get languageSelected => languageSelectedChar.language; - String get languageSelectedChar => - _languageSelectedChar ?? _getLanguageSelectedChar; + String get languageSelectedChar => _languageSelectedChar ?? _getLanguageSelectedChar; String get _getLanguageSelectedChar => _storage.read(_langSveKey) ?? "en"; bool get isLangEnglish => languageSelected == LanguagesEnum.english; @@ -84,9 +82,7 @@ class AppSettingsNotifier extends StateNotifier { ThemeMode get modeSelected => _selectedMode ?? _getModeSelected; ThemeMode get _getModeSelected => - (_storage.read(_modeSveKey) ?? "light") == "light" - ? ThemeMode.light - : ThemeMode.dark; + (_storage.read(_modeSveKey) ?? "light") == "light" ? ThemeMode.light : ThemeMode.dark; bool get isThemeLight => modeSelected == ThemeMode.light; } diff --git a/lib/core/resources/color_manager.dart b/lib/core/resources/color_manager.dart index debd2bd..c96b842 100644 --- a/lib/core/resources/color_manager.dart +++ b/lib/core/resources/color_manager.dart @@ -25,8 +25,7 @@ import 'package:flutter/material.dart'; abstract final class ColorManager { static const Color transparent = Colors.transparent; - static const Color transparentWhite = - Color.fromRGBO(255, 255, 255, 0.48627450980392156); + static const Color transparentWhite = Color.fromRGBO(255, 255, 255, 0.48627450980392156); static const Color whiteOp10 = Color.fromRGBO(255, 255, 255, .1); static const Color whiteOp20 = Color.fromRGBO(255, 255, 255, .2); static const Color whiteOp30 = Color.fromRGBO(255, 255, 255, .3); @@ -80,9 +79,9 @@ abstract final class ColorManager { /// ------------------------------------------> - static const Color finishedSearcherBlue = Color.fromRGBO(64,206,227, 1.0); - static const Color wallBlack = Color.fromRGBO(12,53,71, 1.0); - static const Color dividerBlue = Color.fromRGBO(175,216,248, 1.0); + static const Color finishedSearcherBlue = Color.fromRGBO(64, 206, 227, 1.0); + static const Color wallBlack = Color.fromRGBO(12, 53, 71, 1.0); + static const Color dividerBlue = Color.fromRGBO(175, 216, 248, 1.0); static const Color blue = Color.fromRGBO(41, 157, 250, 1.0); static const Color darkBlue1 = Color.fromRGBO(23, 154, 255, 1.0); static const Color darkBlue = Color.fromRGBO(2, 73, 128, 1.0); @@ -92,7 +91,7 @@ abstract final class ColorManager { static const Color lightBlueWhiteD1 = Color.fromRGBO(243, 243, 246, 1.0); static const Color blackL3Blue = Color.fromRGBO(14, 14, 19, 1.0); static const Color blackBlue = Color.fromRGBO(0, 0, 5, 1.0); - static const Color darkPurple = Color.fromRGBO(66,8,99, 1.0); + static const Color darkPurple = Color.fromRGBO(66, 8, 99, 1.0); static const Color green = Color.fromRGBO(25, 189, 98, 1.0); static const Color purple = Color.fromRGBO(160, 4, 238, 1); diff --git a/lib/core/widgets/adapt_widget_size.dart b/lib/core/widgets/adapt_widget_size.dart index 5bcf11f..2ced93a 100644 --- a/lib/core/widgets/adapt_widget_size.dart +++ b/lib/core/widgets/adapt_widget_size.dart @@ -7,9 +7,7 @@ class AdaptWidgetSize extends StatelessWidget { Widget build(BuildContext context) { return LayoutBuilder( builder: (context, constraints) { - final size = constraints.maxWidth > constraints.maxHeight - ? constraints.maxHeight - : constraints.maxWidth; + final size = constraints.maxWidth > constraints.maxHeight ? constraints.maxHeight : constraints.maxWidth; final newSize = size * 0.35; final adapt = newSize > 50 ? 80.0 : newSize; diff --git a/lib/core/widgets/adaptive/padding/all_padding.dart b/lib/core/widgets/adaptive/padding/all_padding.dart index b2015c3..9447240 100644 --- a/lib/core/widgets/adaptive/padding/all_padding.dart +++ b/lib/core/widgets/adaptive/padding/all_padding.dart @@ -6,7 +6,6 @@ class AllPadding extends StatelessWidget { final Widget child; @override Widget build(BuildContext context) { - return _RPadding( - padding: REdgeInsetsDirectional.all(padding), child: child); + return _RPadding(padding: REdgeInsetsDirectional.all(padding), child: child); } } diff --git a/lib/core/widgets/adaptive/padding/bottom_padding.dart b/lib/core/widgets/adaptive/padding/bottom_padding.dart index 6b70b89..ef86b77 100644 --- a/lib/core/widgets/adaptive/padding/bottom_padding.dart +++ b/lib/core/widgets/adaptive/padding/bottom_padding.dart @@ -1,13 +1,11 @@ part of 'adaptive_padding.dart'; - class BottomPadding extends StatelessWidget { const BottomPadding({required this.padding, required this.child, super.key}); final double padding; final Widget child; @override Widget build(BuildContext context) { - return _RPadding( - padding: REdgeInsetsDirectional.only(bottom: padding), child: child); + return _RPadding(padding: REdgeInsetsDirectional.only(bottom: padding), child: child); } } diff --git a/lib/core/widgets/adaptive/text/bold_text.dart b/lib/core/widgets/adaptive/text/bold_text.dart index 7a8aaf9..b20f719 100644 --- a/lib/core/widgets/adaptive/text/bold_text.dart +++ b/lib/core/widgets/adaptive/text/bold_text.dart @@ -8,9 +8,9 @@ class BoldText extends _AdaptiveText { super.fontStyle = FontStyle.normal, super.color = ThemeEnum.focusColor, super.shadows, - super.fontWeight= FontWeightManager.bold, + super.fontWeight = FontWeightManager.bold, super.textAlign, super.maxLines = 2, super.key, - }) ; + }); } From 201c18bb659a81ba1967abac4180daf2f6507245 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:19 +0300 Subject: [PATCH 03/13] reformat the code --- lib/config/themes/app_theme.dart | 14 ++++++++++---- lib/core/widgets/custom_widgets/check_box.dart | 7 ++----- .../comparison/view/comparison_sort_page.dart | 8 +++----- .../view_model/comparison_sort_notifier.dart | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/config/themes/app_theme.dart b/lib/config/themes/app_theme.dart index d7e10b9..aa5631a 100644 --- a/lib/config/themes/app_theme.dart +++ b/lib/config/themes/app_theme.dart @@ -25,7 +25,10 @@ class AppTheme { surfaceTintColor: ColorManager.white, shadowColor: ColorManager.white, ), - dialogTheme: const DialogThemeData(surfaceTintColor: ColorManager.whiteD5), + dialogTheme: const DialogThemeData( + surfaceTintColor: ColorManager.whiteD5, + backgroundColor: ColorManager.whiteD1, + ), dividerColor: ColorManager.blackOp10, scaffoldBackgroundColor: ColorManager.white, iconTheme: const IconThemeData(color: ColorManager.black), @@ -44,7 +47,7 @@ class AppTheme { tabBarTheme: _tabBarTheme(), textTheme: _textTheme(), dividerTheme: const DividerThemeData(color: ColorManager.whiteD5), - bottomAppBarTheme: const BottomAppBarThemeData(color: ColorManager.blackOp30), + bottomAppBarTheme: const BottomAppBarThemeData(color: ColorManager.blackOp30), textSelectionTheme: const TextSelectionThemeData( cursorColor: ColorManager.teal, selectionColor: ColorManager.blackOp10, @@ -151,7 +154,10 @@ class AppTheme { surfaceTintColor: ColorManager.blackL5, shadowColor: ColorManager.blackL5, ), - dialogTheme: const DialogThemeData(surfaceTintColor: ColorManager.blackL5), + dialogTheme: const DialogThemeData( + surfaceTintColor: ColorManager.blackL5, + backgroundColor: ColorManager.blackL1, + ), dividerColor: ColorManager.whiteOp10, scaffoldBackgroundColor: ColorManager.blackBlue, iconTheme: const IconThemeData(color: ColorManager.white), @@ -169,7 +175,7 @@ class AppTheme { tabBarTheme: _tabBarDarkTheme(), textTheme: _textDarkTheme(), dividerTheme: const DividerThemeData(color: ColorManager.blackL5), - bottomAppBarTheme: const BottomAppBarThemeData(color: ColorManager.whiteOp30), + bottomAppBarTheme: const BottomAppBarThemeData(color: ColorManager.whiteOp30), textSelectionTheme: const TextSelectionThemeData( cursorColor: ColorManager.teal, selectionColor: ColorManager.greyD6, diff --git a/lib/core/widgets/custom_widgets/check_box.dart b/lib/core/widgets/custom_widgets/check_box.dart index c647ec7..145f2d9 100644 --- a/lib/core/widgets/custom_widgets/check_box.dart +++ b/lib/core/widgets/custom_widgets/check_box.dart @@ -26,9 +26,7 @@ class CustomCheckBox extends StatelessWidget { color: ColorManager.transparent, border: Border.all( width: 1.5.r, - color: isSelected - ? context.getColor(ThemeEnum.focusColor) - : context.getColor(ThemeEnum.whiteD5Color)), + color: isSelected ? context.getColor(ThemeEnum.focusColor) : context.getColor(ThemeEnum.whiteD5Color)), ), child: Padding( padding: const EdgeInsets.all(3), @@ -42,8 +40,7 @@ class CustomCheckBox extends StatelessWidget { shape: isCircle ? BoxShape.circle : BoxShape.rectangle, ), child: isSelected && withCheckIcon - ? const CustomIcon(Icons.check_rounded, - color: ColorManager.white, size: 18) + ? const CustomIcon(Icons.check_rounded, color: ColorManager.white, size: 18) : null, ), ), diff --git a/lib/features/sorting/comparison/view/comparison_sort_page.dart b/lib/features/sorting/comparison/view/comparison_sort_page.dart index ea16486..ac88ba9 100644 --- a/lib/features/sorting/comparison/view/comparison_sort_page.dart +++ b/lib/features/sorting/comparison/view/comparison_sort_page.dart @@ -136,11 +136,9 @@ class _DrawerMenu extends ConsumerWidget { ...List.generate( algorithms.length, (index) => ListTile( - trailing: - selectedAlgorithms.firstWhereOrNull((element) => element.name == algorithms[index]) != - null - ? const CustomIcon(Icons.check) - : null, + trailing: selectedAlgorithms.firstWhereOrNull((element) => element.name == algorithms[index]) != null + ? const CustomIcon(Icons.check) + : null, title: RegularText(algorithms[index]), onTap: () { ref.read(_notifierProvider.notifier).selectAlgorithm(algorithms[index]); diff --git a/lib/features/sorting/comparison/view_model/comparison_sort_notifier.dart b/lib/features/sorting/comparison/view_model/comparison_sort_notifier.dart index fef9d0d..aed02bd 100644 --- a/lib/features/sorting/comparison/view_model/comparison_sort_notifier.dart +++ b/lib/features/sorting/comparison/view_model/comparison_sort_notifier.dart @@ -142,8 +142,7 @@ class ComparisonSortNotifier extends StateNotifier playSorting(BuildContext context, WidgetRef ref) async { if (_getOperation == SortingEnum.played) return; - final playSorting = - state.selectedAlgorithms.map((e) => ref.read(e.provider.notifier).playSorting(context)); + final playSorting = state.selectedAlgorithms.map((e) => ref.read(e.provider.notifier).playSorting(context)); _setOperation = SortingEnum.played; await Future.wait(playSorting.toList()); @@ -158,6 +157,7 @@ class ComparisonSortNotifier extends StateNotifier cancelSorting(WidgetRef ref) async { final cancelSorting = state.selectedAlgorithms.map((e) => ref.read(e.provider.notifier).cancelSorting()); await Future.wait(cancelSorting.toList()); From f804c513769ac7b85470436590511e80c130a912 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:21 +0300 Subject: [PATCH 04/13] reformat the code --- .../custom_widgets/custom_bottom_sheet.dart | 14 ++-- .../custom_circulars_progress.dart | 65 ++++++------------- .../widgets/custom_widgets/custom_dialog.dart | 3 +- 3 files changed, 26 insertions(+), 56 deletions(-) diff --git a/lib/core/widgets/custom_widgets/custom_bottom_sheet.dart b/lib/core/widgets/custom_widgets/custom_bottom_sheet.dart index be9fa5f..61c4cfb 100644 --- a/lib/core/widgets/custom_widgets/custom_bottom_sheet.dart +++ b/lib/core/widgets/custom_widgets/custom_bottom_sheet.dart @@ -55,8 +55,7 @@ class CustomBottomSheet { ); } - static Future _showBottomSheet( - BuildContext context, Widget child) async { + static Future _showBottomSheet(BuildContext context, Widget child) async { return showModalBottomSheet( context: context, isScrollControlled: true, @@ -152,17 +151,12 @@ class _BottomSheetDash extends StatelessWidget { @override Widget build(BuildContext context) { return Padding( - padding: REdgeInsetsDirectional.only( - start: 10, - end: 10, - top: 10, - bottom: withLittleBottomPadding ? 5 : 10), + padding: REdgeInsetsDirectional.only(start: 10, end: 10, top: 10, bottom: withLittleBottomPadding ? 5 : 10), child: Container( width: 40.w, height: 3.5.h, - decoration: BoxDecoration( - color: context.getColor(ThemeEnum.hoverColor), - borderRadius: BorderRadius.circular(5)), + decoration: + BoxDecoration(color: context.getColor(ThemeEnum.hoverColor), borderRadius: BorderRadius.circular(5)), ), ); } diff --git a/lib/core/widgets/custom_widgets/custom_circulars_progress.dart b/lib/core/widgets/custom_widgets/custom_circulars_progress.dart index 6121fa9..8bbb3b7 100644 --- a/lib/core/widgets/custom_widgets/custom_circulars_progress.dart +++ b/lib/core/widgets/custom_widgets/custom_circulars_progress.dart @@ -2,8 +2,7 @@ import 'package:algorithm_visualizer/core/helpers/current_device.dart'; import 'package:algorithm_visualizer/core/resources/theme_manager.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/foundation.dart' - show TargetPlatform, defaultTargetPlatform; +import 'package:flutter/foundation.dart' show TargetPlatform, defaultTargetPlatform; import 'package:flutter_screenutil/flutter_screenutil.dart'; class CustomCircularProgress extends StatelessWidget { @@ -14,8 +13,7 @@ class CustomCircularProgress extends StatelessWidget { Widget build(BuildContext context) { bool isThatAndroid = defaultTargetPlatform == TargetPlatform.android; final color = this.color; - final tColor = - color == null ? Theme.of(context).focusColor : context.getColor(color); + final tColor = color == null ? Theme.of(context).focusColor : context.getColor(color); return isThatAndroid ? Column( @@ -27,14 +25,12 @@ class CustomCircularProgress extends StatelessWidget { child: SizedBox( width: 20.r, height: 20.r, - child: CircularProgressIndicator( - strokeWidth: 3.r, color: tColor), + child: CircularProgressIndicator(strokeWidth: 3.r, color: tColor), ), ), ], ) - : CupertinoActivityIndicator( - color: tColor, radius: 9.r, animating: true); + : CupertinoActivityIndicator(color: tColor, radius: 9.r, animating: true); } } @@ -46,20 +42,17 @@ class SmallCircularProgress extends StatelessWidget { Widget build(BuildContext context) { bool isThatAndroid = defaultTargetPlatform == TargetPlatform.android; final color = this.color; - final tColor = - color == null ? Theme.of(context).focusColor : context.getColor(color); + final tColor = color == null ? Theme.of(context).focusColor : context.getColor(color); return isThatAndroid ? SizedBox( width: 15.r, height: 15.r, child: ClipOval( - child: - CircularProgressIndicator(strokeWidth: 3.5.r, color: tColor), + child: CircularProgressIndicator(strokeWidth: 3.5.r, color: tColor), ), ) - : CupertinoActivityIndicator( - color: tColor, radius: 9.r, animating: true); + : CupertinoActivityIndicator(color: tColor, radius: 9.r, animating: true); } } @@ -67,22 +60,19 @@ class ThineCircularProgress extends StatelessWidget { final ThemeEnum? color; final ThemeEnum? backgroundColor; final double strokeWidth; - const ThineCircularProgress( - {super.key, this.color, this.backgroundColor, this.strokeWidth = 2}); + const ThineCircularProgress({super.key, this.color, this.backgroundColor, this.strokeWidth = 2}); @override Widget build(BuildContext context) { final color = this.color; - final tColor = - color == null ? Theme.of(context).focusColor : context.getColor(color); + final tColor = color == null ? Theme.of(context).focusColor : context.getColor(color); final backgroundColor = this.backgroundColor; return Center( child: CircularProgressIndicator.adaptive( strokeWidth: strokeWidth.r, valueColor: AlwaysStoppedAnimation(tColor), - backgroundColor: - backgroundColor != null ? context.getColor(backgroundColor) : null, + backgroundColor: backgroundColor != null ? context.getColor(backgroundColor) : null, ), ); } @@ -104,16 +94,14 @@ class ThineCircularProgressWithValue extends StatelessWidget { @override Widget build(BuildContext context) { final color = this.color; - final tColor = - color == null ? Theme.of(context).focusColor : context.getColor(color); + final tColor = color == null ? Theme.of(context).focusColor : context.getColor(color); final backgroundColor = this.backgroundColor; return Center( child: CircularProgressIndicator.adaptive( strokeWidth: strokeWidth.r, valueColor: AlwaysStoppedAnimation(tColor), - backgroundColor: - backgroundColor != null ? context.getColor(backgroundColor) : null, + backgroundColor: backgroundColor != null ? context.getColor(backgroundColor) : null, value: value, ), ); @@ -147,14 +135,12 @@ class CustomThineCircularProgress extends StatelessWidget { final ThemeEnum? color; final ThemeEnum? backgroundColor; final double strokeWidth; - const CustomThineCircularProgress( - {super.key, this.color, this.backgroundColor, this.strokeWidth = 2}); + const CustomThineCircularProgress({super.key, this.color, this.backgroundColor, this.strokeWidth = 2}); @override Widget build(BuildContext context) { final color = this.color; - final tColor = - color == null ? Theme.of(context).focusColor : context.getColor(color); + final tColor = color == null ? Theme.of(context).focusColor : context.getColor(color); final backgroundColor = this.backgroundColor; return Center( @@ -162,12 +148,9 @@ class CustomThineCircularProgress extends StatelessWidget { ? CircularProgressIndicator( strokeWidth: strokeWidth.r, valueColor: AlwaysStoppedAnimation(tColor), - backgroundColor: backgroundColor != null - ? context.getColor(backgroundColor) - : null, + backgroundColor: backgroundColor != null ? context.getColor(backgroundColor) : null, ) - : CupertinoActivityIndicator( - color: tColor, radius: strokeWidth.r, animating: true), + : CupertinoActivityIndicator(color: tColor, radius: strokeWidth.r, animating: true), ); } } @@ -188,8 +171,7 @@ class CustomThineCircularProgressWithValue extends StatelessWidget { @override Widget build(BuildContext context) { final color = this.color; - final tColor = - color == null ? Theme.of(context).focusColor : context.getColor(color); + final tColor = color == null ? Theme.of(context).focusColor : context.getColor(color); final backgroundColor = this.backgroundColor; return Center( @@ -197,13 +179,10 @@ class CustomThineCircularProgressWithValue extends StatelessWidget { ? CircularProgressIndicator( strokeWidth: strokeWidth.r, valueColor: AlwaysStoppedAnimation(tColor), - backgroundColor: backgroundColor != null - ? context.getColor(backgroundColor) - : null, + backgroundColor: backgroundColor != null ? context.getColor(backgroundColor) : null, value: value, ) - : CupertinoActivityIndicator( - color: tColor, radius: strokeWidth.r, animating: false), + : CupertinoActivityIndicator(color: tColor, radius: strokeWidth.r, animating: false), ); } } @@ -222,16 +201,14 @@ class BaseCircularProgress extends StatelessWidget { @override Widget build(BuildContext context) { final color = this.color; - final tColor = - color == null ? Theme.of(context).focusColor : context.getColor(color); + final tColor = color == null ? Theme.of(context).focusColor : context.getColor(color); final backgroundColor = this.backgroundColor; return Center( child: CircularProgressIndicator( strokeWidth: strokeWidth.r, valueColor: AlwaysStoppedAnimation(tColor), - backgroundColor: - backgroundColor != null ? context.getColor(backgroundColor) : null, + backgroundColor: backgroundColor != null ? context.getColor(backgroundColor) : null, ), ); } diff --git a/lib/core/widgets/custom_widgets/custom_dialog.dart b/lib/core/widgets/custom_widgets/custom_dialog.dart index 99c7aa0..f8257a8 100644 --- a/lib/core/widgets/custom_widgets/custom_dialog.dart +++ b/lib/core/widgets/custom_widgets/custom_dialog.dart @@ -22,8 +22,7 @@ class CustomAlertDialog { final BuildContext context; CustomAlertDialog(this.context); - Future solidDialog( - {required List parameters, bool barrierDismissible = true}) { + Future solidDialog({required List parameters, bool barrierDismissible = true}) { return showDialog( context: context, barrierDismissible: barrierDismissible, From af34d49ec1acc981ff60005a893f0563cea3dcb2 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:23 +0300 Subject: [PATCH 05/13] reformat the code --- lib/core/helpers/custom_alert_dialog.dart | 12 ++++-------- lib/core/widgets/custom_widgets/custom_icon.dart | 6 +++--- .../custom_rounded_elevated_button.dart | 6 ++---- lib/core/widgets/custom_widgets/custom_switch.dart | 8 +++----- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/lib/core/helpers/custom_alert_dialog.dart b/lib/core/helpers/custom_alert_dialog.dart index 2979d85..8f2d5e4 100644 --- a/lib/core/helpers/custom_alert_dialog.dart +++ b/lib/core/helpers/custom_alert_dialog.dart @@ -32,8 +32,7 @@ class CustomAlertDialog { final BuildContext context; CustomAlertDialog(this.context); - Future openDialog(DialogParameters parameters, - {bool barrierDismissible = true}) { + Future openDialog(DialogParameters parameters, {bool barrierDismissible = true}) { return showDialog( context: context, barrierDismissible: barrierDismissible, @@ -90,8 +89,7 @@ class _Content extends StatelessWidget { children: [ Padding( padding: REdgeInsets.symmetric(vertical: 10), - child: BoldText(parameters.actionText, - color: ThemeEnum.redColor), + child: BoldText(parameters.actionText, color: ThemeEnum.redColor), ), ], ), @@ -100,8 +98,7 @@ class _Content extends StatelessWidget { const CustomDivider(withHeight: false), InkWell( borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(_borderRadius.r), - bottomRight: Radius.circular(_borderRadius.r)), + bottomLeft: Radius.circular(_borderRadius.r), bottomRight: Radius.circular(_borderRadius.r)), onTap: () { final onTapCancel = parameters.onTapCancel; if (onTapCancel != null) onTapCancel(); @@ -117,8 +114,7 @@ class _Content extends StatelessWidget { children: [ Padding( padding: REdgeInsets.symmetric(vertical: 10), - child: RegularText(parameters.cancelText, - color: ThemeEnum.focusColor), + child: RegularText(parameters.cancelText, color: ThemeEnum.focusColor), ), ], ), diff --git a/lib/core/widgets/custom_widgets/custom_icon.dart b/lib/core/widgets/custom_widgets/custom_icon.dart index b9dd0c7..419e9d2 100644 --- a/lib/core/widgets/custom_widgets/custom_icon.dart +++ b/lib/core/widgets/custom_widgets/custom_icon.dart @@ -6,19 +6,19 @@ class CustomIcon extends StatelessWidget { const CustomIcon( this.icon, { this.size = 22, - this.color , + this.color, this.shadows, super.key, }); final IconData icon; - final Color ?color; + final Color? color; final double size; final List? shadows; @override Widget build(BuildContext context) { return Icon( icon, - color: color??ColorManager.black, + color: color ?? ColorManager.black, size: size.r, shadows: shadows, ); diff --git a/lib/core/widgets/custom_widgets/custom_rounded_elevated_button.dart b/lib/core/widgets/custom_widgets/custom_rounded_elevated_button.dart index ccdbb5e..1b690ee 100644 --- a/lib/core/widgets/custom_widgets/custom_rounded_elevated_button.dart +++ b/lib/core/widgets/custom_widgets/custom_rounded_elevated_button.dart @@ -26,8 +26,7 @@ class CustomRoundedElevatedButton extends StatelessWidget { Widget build(BuildContext context) { final backgroundColor = this.backgroundColor; final shadowColor = this.shadowColor; - final background = - backgroundColor == null ? null : context.getColor(backgroundColor); + final background = backgroundColor == null ? null : context.getColor(backgroundColor); final shadow = shadowColor == null ? null : context.getColor(shadowColor); return ElevatedButton( @@ -36,8 +35,7 @@ class CustomRoundedElevatedButton extends StatelessWidget { shadowColor: shadow ?? ColorManager.transparent, fixedSize: fitToContent ? Size.fromHeight(fixedSize.r) : Size.fromWidth(fixedSize.r), padding: EdgeInsets.symmetric(horizontal: 15.r), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(roundedRadius).r), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(roundedRadius).r), surfaceTintColor: background, foregroundColor: context.getColor(ThemeEnum.hintColor), ), diff --git a/lib/core/widgets/custom_widgets/custom_switch.dart b/lib/core/widgets/custom_widgets/custom_switch.dart index 902dd7b..a368e66 100644 --- a/lib/core/widgets/custom_widgets/custom_switch.dart +++ b/lib/core/widgets/custom_widgets/custom_switch.dart @@ -22,7 +22,7 @@ class CustomSwitch extends ConsumerWidget { value: value, onChanged: onChanged, activeTrackColor: context.getColor(ThemeEnum.focusColor), - activeColor: context.getColor(ThemeEnum.whiteD1Color), + activeThumbColor: context.getColor(ThemeEnum.whiteD1Color), inactiveThumbColor: context.getColor(ThemeEnum.whiteColor), thumbIcon: WidgetStatePropertyAll( Icon( @@ -30,10 +30,8 @@ class CustomSwitch extends ConsumerWidget { color: context.getColor(ThemeEnum.transparentColor), ), ), - inactiveTrackColor: - isLight ? ColorManager.whiteD5 : ColorManager.blackL3, - trackOutlineColor: - const WidgetStatePropertyAll(ColorManager.transparent), + inactiveTrackColor: isLight ? ColorManager.whiteD5 : ColorManager.blackL3, + trackOutlineColor: const WidgetStatePropertyAll(ColorManager.transparent), ), ); } From 1d4c4f2f7b69a6bd4a75ca351447977ed1f16090 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:25 +0300 Subject: [PATCH 06/13] reformat the code --- .../widgets/adaptive/padding/end_padding.dart | 3 +-- .../widgets/custom_widgets/error_screen.dart | 6 ++--- .../searching/view_model/grid_notifier.dart | 26 ++++++------------- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/lib/core/widgets/adaptive/padding/end_padding.dart b/lib/core/widgets/adaptive/padding/end_padding.dart index ca4bdbc..e8e48af 100644 --- a/lib/core/widgets/adaptive/padding/end_padding.dart +++ b/lib/core/widgets/adaptive/padding/end_padding.dart @@ -6,7 +6,6 @@ class EndPadding extends StatelessWidget { final Widget child; @override Widget build(BuildContext context) { - return _RPadding( - padding: REdgeInsetsDirectional.only(end: padding), child: child); + return _RPadding(padding: REdgeInsetsDirectional.only(end: padding), child: child); } } diff --git a/lib/core/widgets/custom_widgets/error_screen.dart b/lib/core/widgets/custom_widgets/error_screen.dart index a7cb014..243407c 100644 --- a/lib/core/widgets/custom_widgets/error_screen.dart +++ b/lib/core/widgets/custom_widgets/error_screen.dart @@ -14,12 +14,10 @@ class ErrorScreen extends StatelessWidget { padding: 20, child: foundation.kReleaseMode ? const Center( - child: RegularText(StringsManager.sorryForInconvenience, - fontSize: 18), + child: RegularText(StringsManager.sorryForInconvenience, fontSize: 18), ) : Center( - child: RegularText('Exception Details: $detailsException', - maxLines: 5), + child: RegularText('Exception Details: $detailsException', maxLines: 5), ), ), ); diff --git a/lib/features/searching/view_model/grid_notifier.dart b/lib/features/searching/view_model/grid_notifier.dart index 5c63c64..d8f59cf 100644 --- a/lib/features/searching/view_model/grid_notifier.dart +++ b/lib/features/searching/view_model/grid_notifier.dart @@ -138,8 +138,7 @@ class SearchingNotifier extends StateNotifier { await cancelSearching(); - _cancelableSearch = - CancelableOperation.fromFuture(_clearTheGridFun(clearAnyway: clearAnyway, keepWall: keepWall)); + _cancelableSearch = CancelableOperation.fromFuture(_clearTheGridFun(clearAnyway: clearAnyway, keepWall: keepWall)); try { await _cancelableSearch?.value; @@ -174,9 +173,7 @@ class SearchingNotifier extends StateNotifier { /// when you try to draw on the right border if you make the arrow closly to the border it will draw the wall in the left side (the next index) /// those two lines to prevent that final calcIndex = (event.localPosition.dx / _gridSquareSize).floor(); - if (calcIndex != 0 && - calcIndex % state.columnCrossAxisCount == 0 && - index % state.columnCrossAxisCount == 0) { + if (calcIndex != 0 && calcIndex % state.columnCrossAxisCount == 0 && index % state.columnCrossAxisCount == 0) { index--; } @@ -300,8 +297,7 @@ class SearchingNotifier extends StateNotifier { } /// for marking the current grid as visited - if (gridData[currentIndex] != GridStatus.startPoint && - gridData[currentIndex] != GridStatus.targetPoint) { + if (gridData[currentIndex] != GridStatus.startPoint && gridData[currentIndex] != GridStatus.targetPoint) { gridData[currentIndex] = GridStatus.searcher; state = state.copyWith(gridData: List.from(gridData)); await Future.delayed(drawSearcherDuration); @@ -384,8 +380,7 @@ class SearchingNotifier extends StateNotifier { previous[neighborIndex] = currentIndex; pq.add(neighborIndex); - if (gridData[neighborIndex] != GridStatus.startPoint && - gridData[neighborIndex] != GridStatus.targetPoint) { + if (gridData[neighborIndex] != GridStatus.startPoint && gridData[neighborIndex] != GridStatus.targetPoint) { gridData[neighborIndex] = GridStatus.searcher; state = state.copyWith(gridData: List.from(gridData)); await Future.delayed(drawSearcherDuration); @@ -397,17 +392,14 @@ class SearchingNotifier extends StateNotifier { _isSearched = true; } - bool _isValidNeighbor( - int currentIndex, int neighborIndex, int direction, int cross, List gridData) { + bool _isValidNeighbor(int currentIndex, int neighborIndex, int direction, int cross, List gridData) { final isFirstLeftInRowIndex = neighborIndex % cross == 0; final isEndRightInRowIndex = (neighborIndex + 1) % cross == 0; if (direction == 1 && isFirstLeftInRowIndex) return false; if (direction == -1 && isEndRightInRowIndex) return false; - return neighborIndex >= 0 && - neighborIndex < gridData.length && - gridData[neighborIndex] != GridStatus.wall; + return neighborIndex >= 0 && neighborIndex < gridData.length && gridData[neighborIndex] != GridStatus.wall; } Future _tracePath(List previous, int currentIndex) async { @@ -505,8 +497,7 @@ class SearchingNotifier extends StateNotifier { pq.add(neighborIndex); } - if (gridData[neighborIndex] != GridStatus.startPoint && - gridData[neighborIndex] != GridStatus.targetPoint) { + if (gridData[neighborIndex] != GridStatus.startPoint && gridData[neighborIndex] != GridStatus.targetPoint) { gridData[neighborIndex] = GridStatus.searcher; state = state.copyWith(gridData: List.from(gridData)); await Future.delayed(drawSearcherDuration); @@ -614,8 +605,7 @@ class SearchingNotifier extends StateNotifier { final newRow = row + direction.rowDelta * 2; final newCol = col + direction.colDelta * 2; - if (_isValidCell(newRow, newCol) && - gridData[newRow * state.columnCrossAxisCount + newCol] == GridStatus.empty) { + if (_isValidCell(newRow, newCol) && gridData[newRow * state.columnCrossAxisCount + newCol] == GridStatus.empty) { final betweenRow = row + direction.rowDelta; final betweenCol = col + direction.colDelta; From b059a4061d707b740a690db5086eb542009bb0e1 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:27 +0300 Subject: [PATCH 07/13] reformat the code --- lib/core/draggable_progress.dart | 5 ++-- lib/features/searching/view/grid_page.dart | 15 +++++------- .../view_model/grid_notifier_state.dart | 23 +++++++++++-------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/core/draggable_progress.dart b/lib/core/draggable_progress.dart index e13a5c7..80d4a5a 100644 --- a/lib/core/draggable_progress.dart +++ b/lib/core/draggable_progress.dart @@ -30,9 +30,8 @@ class LinearSliderState extends State { @override Widget build(BuildContext context) { return Slider( - activeColor: widget.isActive - ? context.getColor(ThemeEnum.mediumBlueColor) - : context.getColor(ThemeEnum.whiteD7Color), + activeColor: + widget.isActive ? context.getColor(ThemeEnum.mediumBlueColor) : context.getColor(ThemeEnum.whiteD7Color), value: sliderValue, onChanged: (v) { setState(() { diff --git a/lib/features/searching/view/grid_page.dart b/lib/features/searching/view/grid_page.dart index 2e21d1b..5e326d2 100644 --- a/lib/features/searching/view/grid_page.dart +++ b/lib/features/searching/view/grid_page.dart @@ -64,8 +64,7 @@ class _ControlButtons extends StatefulWidget { class _ControlButtonsState extends State<_ControlButtons> { PopupMenuItem buildPopupMenuItem(String value, [ThemeEnum? color]) { final isLargeScreen = MediaQuery.sizeOf(context).width > 500; - return PopupMenuItem( - value: value, child: RegularText(value, fontSize: isLargeScreen ? 16 : 14, color: color)); + return PopupMenuItem(value: value, child: RegularText(value, fontSize: isLargeScreen ? 16 : 14, color: color)); } @override @@ -120,8 +119,8 @@ class _ControlButtonsState extends State<_ControlButtons> { child: Center( child: PopupMenuButton( position: PopupMenuPosition.under, - style: const ButtonStyle( - backgroundColor: WidgetStatePropertyAll(ColorManager.finishedSearcherBlue)), + style: + const ButtonStyle(backgroundColor: WidgetStatePropertyAll(ColorManager.finishedSearcherBlue)), onSelected: (value) { if (value == StringsManager.dijkstra) { ref.read(_gridNotifierProvider.notifier).performDijkstra(); @@ -227,8 +226,7 @@ class _BuildGridItems extends ConsumerWidget { @override Widget build(BuildContext context, ref) { final gridCount = ref.watch(_gridNotifierProvider.select((it) => it.gridCount)); - final watchColumnCrossAxisCount = - ref.watch(_gridNotifierProvider.select((it) => it.columnCrossAxisCount)); + final watchColumnCrossAxisCount = ref.watch(_gridNotifierProvider.select((it) => it.columnCrossAxisCount)); if (gridCount == 0) { return const Center(child: MediumText(StringsManager.notInitializeGridYet)); @@ -269,9 +267,8 @@ class _SquareState extends ConsumerState<_Square> { .select((it) => it.gridData.length > widget.index ? it.gridData[widget.index] : GridStatus.empty)); final isColored = isSelected != GridStatus.empty; - final showBorder = isSelected != GridStatus.empty && - isSelected != GridStatus.startPoint && - isSelected != GridStatus.targetPoint; + final showBorder = + isSelected != GridStatus.empty && isSelected != GridStatus.startPoint && isSelected != GridStatus.targetPoint; return Container( key: ValueKey(widget.index), diff --git a/lib/features/searching/view_model/grid_notifier_state.dart b/lib/features/searching/view_model/grid_notifier_state.dart index 621118f..4f262fe 100644 --- a/lib/features/searching/view_model/grid_notifier_state.dart +++ b/lib/features/searching/view_model/grid_notifier_state.dart @@ -42,16 +42,21 @@ final class GridNotifierState { List? gridData, int? currentTappedIndex, }) { - return GridNotifierState( - columnCrossAxisCount: columnCrossAxisCount!=this.columnCrossAxisCount?(columnCrossAxisCount ?? this.columnCrossAxisCount):this.columnCrossAxisCount, - rowMainAxisCount: rowMainAxisCount!=this.rowMainAxisCount?(rowMainAxisCount ?? this.rowMainAxisCount):this.rowMainAxisCount, - gridSize: gridSize!=this.gridSize?(gridSize ?? this.gridSize):this.gridSize, - gridCount: gridCount!=this.gridCount?(gridCount ?? this.gridCount):this.gridCount, - screenHeight: screenHeight!=this.screenHeight?(screenHeight ?? this.screenHeight):this.screenHeight, - screenWidth: screenWidth!=this.screenWidth?(screenWidth ?? this.screenWidth):this.screenWidth, - gridData: gridData!=this.gridData?(gridData ?? this.gridData):this.gridData, - currentTappedIndex: currentTappedIndex!=this.currentTappedIndex?(currentTappedIndex ?? this.currentTappedIndex):this.currentTappedIndex, + columnCrossAxisCount: columnCrossAxisCount != this.columnCrossAxisCount + ? (columnCrossAxisCount ?? this.columnCrossAxisCount) + : this.columnCrossAxisCount, + rowMainAxisCount: rowMainAxisCount != this.rowMainAxisCount + ? (rowMainAxisCount ?? this.rowMainAxisCount) + : this.rowMainAxisCount, + gridSize: gridSize != this.gridSize ? (gridSize ?? this.gridSize) : this.gridSize, + gridCount: gridCount != this.gridCount ? (gridCount ?? this.gridCount) : this.gridCount, + screenHeight: screenHeight != this.screenHeight ? (screenHeight ?? this.screenHeight) : this.screenHeight, + screenWidth: screenWidth != this.screenWidth ? (screenWidth ?? this.screenWidth) : this.screenWidth, + gridData: gridData != this.gridData ? (gridData ?? this.gridData) : this.gridData, + currentTappedIndex: currentTappedIndex != this.currentTappedIndex + ? (currentTappedIndex ?? this.currentTappedIndex) + : this.currentTappedIndex, ); } } From f72a243ac37d25d0f768bb9bfe7fc618fe4f09cd Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:30 +0300 Subject: [PATCH 08/13] reformat the code --- lib/core/widgets/adaptive/padding/horizontal_padding.dart | 6 ++---- lib/core/widgets/custom_widgets/keyboard_detected.dart | 6 ++---- lib/features/base/view/movable_pins.dart | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/core/widgets/adaptive/padding/horizontal_padding.dart b/lib/core/widgets/adaptive/padding/horizontal_padding.dart index 7de2415..ebed56f 100644 --- a/lib/core/widgets/adaptive/padding/horizontal_padding.dart +++ b/lib/core/widgets/adaptive/padding/horizontal_padding.dart @@ -1,13 +1,11 @@ part of '../../../../core/widgets/adaptive/padding/adaptive_padding.dart'; class HorizontalPadding extends StatelessWidget { - const HorizontalPadding( - {required this.padding, required this.child, super.key}); + const HorizontalPadding({required this.padding, required this.child, super.key}); final double padding; final Widget child; @override Widget build(BuildContext context) { - return _RPadding( - padding: REdgeInsets.symmetric(horizontal: padding), child: child); + return _RPadding(padding: REdgeInsets.symmetric(horizontal: padding), child: child); } } diff --git a/lib/core/widgets/custom_widgets/keyboard_detected.dart b/lib/core/widgets/custom_widgets/keyboard_detected.dart index abd2e71..4758c67 100644 --- a/lib/core/widgets/custom_widgets/keyboard_detected.dart +++ b/lib/core/widgets/custom_widgets/keyboard_detected.dart @@ -15,12 +15,10 @@ class KeyboardVisibilityBuilder extends StatefulWidget { }); @override - KeyboardVisibilityBuilderState createState() => - KeyboardVisibilityBuilderState(); + KeyboardVisibilityBuilderState createState() => KeyboardVisibilityBuilderState(); } -class KeyboardVisibilityBuilderState extends State - with WidgetsBindingObserver { +class KeyboardVisibilityBuilderState extends State with WidgetsBindingObserver { var _isKeyboardVisible = false; @override diff --git a/lib/features/base/view/movable_pins.dart b/lib/features/base/view/movable_pins.dart index 322163d..2918c71 100644 --- a/lib/features/base/view/movable_pins.dart +++ b/lib/features/base/view/movable_pins.dart @@ -178,7 +178,7 @@ class ParticlePainter extends CustomPainter { void paint(Canvas canvas, Size size) { final circlePaint = Paint()..color = pinColor; final linePaint = Paint() - ..color = pinColor.withOpacity(0.2) + ..color = pinColor.withValues(alpha: 0.2) ..strokeWidth = 0.5; const maxDistance = 150.0; @@ -190,7 +190,7 @@ class ParticlePainter extends CustomPainter { if (p == other) continue; final dist = (p.position - other.position).distance; if (dist < maxDistance) { - linePaint.color = pinColor.withOpacity(1 - dist / maxDistance); + linePaint.color = pinColor.withValues(alpha: 1 - dist / maxDistance); canvas.drawLine(p.position, other.position, linePaint); } } From 46374ddaf9986a7d4a766b712059fa0a1294ce84 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:32 +0300 Subject: [PATCH 09/13] reformat the code --- lib/core/extensions/navigators.dart | 28 ++++++++-------------------- lib/core/helpers/random_text.dart | 1 - lib/core/material_app/my_app.dart | 3 +-- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/lib/core/extensions/navigators.dart b/lib/core/extensions/navigators.dart index 62bf92a..d9116b5 100644 --- a/lib/core/extensions/navigators.dart +++ b/lib/core/extensions/navigators.dart @@ -4,10 +4,8 @@ import 'package:go_router/go_router.dart'; extension Navigators on BuildContext { String? get currentRoute => ModalRoute.of(this)?.settings.name; - (String?, Object?) get currentRouteSettings => ( - ModalRoute.of(this)?.settings.name, - ModalRoute.of(this)?.settings.arguments - ); + (String?, Object?) get currentRouteSettings => + (ModalRoute.of(this)?.settings.name, ModalRoute.of(this)?.settings.arguments); void unFocusKeyboard() { try { if (mounted) FocusScope.of(this).unfocus(); @@ -53,9 +51,7 @@ extension Navigators on BuildContext { final currentValue = currentRouteSettings.$2; - if (currentValue is Map && - currentRoute == path.name && - arguments == currentValue[path.pathParamsName]) { + if (currentValue is Map && currentRoute == path.name && arguments == currentValue[path.pathParamsName]) { return; } } @@ -64,13 +60,8 @@ extension Navigators on BuildContext { .pushNamed( path.name, extra: arguments, - pathParameters: pathParametersRaw ?? - (pathParameters.isNotEmpty - ? {path.pathParamsName: pathParameters} - : {}), - queryParameters: queryParameters.isNotEmpty - ? {path.queryParamsName: queryParameters} - : {}, + pathParameters: pathParametersRaw ?? (pathParameters.isNotEmpty ? {path.pathParamsName: pathParameters} : {}), + queryParameters: queryParameters.isNotEmpty ? {path.queryParamsName: queryParameters} : {}, ) .then((value) { unFocusKeyboard(); @@ -87,8 +78,7 @@ extension Navigators on BuildContext { .pushReplacementNamed( path.name, extra: arguments, - pathParameters: - pathParameters.isEmpty ? {} : {path.pathParamsName: pathParameters}, + pathParameters: pathParameters.isEmpty ? {} : {path.pathParamsName: pathParameters}, ) .then((value) { unFocusKeyboard(); @@ -110,8 +100,7 @@ extension Navigators on BuildContext { .pushReplacementNamed( path.name, extra: arguments, - pathParameters: - pathParameters.isEmpty ? {} : {path.pathParamsName: pathParameters}, + pathParameters: pathParameters.isEmpty ? {} : {path.pathParamsName: pathParameters}, ) .then((value) { unFocusKeyboard(); @@ -133,8 +122,7 @@ extension Navigators on BuildContext { .pushNamed( path.name, extra: arguments, - pathParameters: - pathParameters.isEmpty ? {} : {path.pathParamsName: pathParameters}, + pathParameters: pathParameters.isEmpty ? {} : {path.pathParamsName: pathParameters}, ) .then((value) { unFocusKeyboard(); diff --git a/lib/core/helpers/random_text.dart b/lib/core/helpers/random_text.dart index df9b8b6..4756949 100644 --- a/lib/core/helpers/random_text.dart +++ b/lib/core/helpers/random_text.dart @@ -1,4 +1,3 @@ - class HashCode { static String generateIdentifier(List userIds) { userIds.sort(); diff --git a/lib/core/material_app/my_app.dart b/lib/core/material_app/my_app.dart index 0fba7c5..6f38a6d 100644 --- a/lib/core/material_app/my_app.dart +++ b/lib/core/material_app/my_app.dart @@ -30,8 +30,7 @@ class MyApp extends StatelessWidget { return LayoutBuilder( builder: (context, constraints) { - final padding = - constraints.maxWidth < 450 ? 0.0 : ((constraints.maxWidth - defaultSize.width) / 2.3); + final padding = constraints.maxWidth < 450 ? 0.0 : ((constraints.maxWidth - defaultSize.width) / 2.3); return SystemOverlay( isBlackTheme: isDarkMode, From 19c5d14b20b9a363a5b3a9a5732f7931f1dc7009 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:34 +0300 Subject: [PATCH 10/13] reformat the code --- lib/core/helpers/random_int.dart | 2 +- .../custom_widgets/rounded_outlined_button.dart | 13 ++++--------- .../widgets/custom_widgets/scale_transition.dart | 3 +-- .../sorting/selection/view/selection_sort_page.dart | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/core/helpers/random_int.dart b/lib/core/helpers/random_int.dart index d0cbbe3..a3f8cae 100644 --- a/lib/core/helpers/random_int.dart +++ b/lib/core/helpers/random_int.dart @@ -10,4 +10,4 @@ class CustomRandom { return numbers.sublist(0, length); } -} \ No newline at end of file +} diff --git a/lib/core/widgets/custom_widgets/rounded_outlined_button.dart b/lib/core/widgets/custom_widgets/rounded_outlined_button.dart index 8bc4769..411fdbb 100644 --- a/lib/core/widgets/custom_widgets/rounded_outlined_button.dart +++ b/lib/core/widgets/custom_widgets/rounded_outlined_button.dart @@ -23,22 +23,17 @@ class RoundedOutlinedButton extends StatelessWidget { @override Widget build(BuildContext context) { final backgroundColor = this.backgroundColor; - final background = - backgroundColor == null ? null : context.getColor(backgroundColor); + final background = backgroundColor == null ? null : context.getColor(backgroundColor); return OutlinedButton( style: OutlinedButton.styleFrom( - backgroundColor: - backgroundColor == null ? null : context.getColor(backgroundColor), - fixedSize: size == OutlineEnumFixedSize.small - ? Size.fromHeight(smallRounded ? 30.h : 35.h) - : null, + backgroundColor: backgroundColor == null ? null : context.getColor(backgroundColor), + fixedSize: size == OutlineEnumFixedSize.small ? Size.fromHeight(smallRounded ? 30.h : 35.h) : null, padding: REdgeInsets.symmetric(horizontal: 15), surfaceTintColor: background, foregroundColor: context.getColor(ThemeEnum.hintColor), side: BorderSide(color: context.getColor(borderColor), width: 1.5.r), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(smallRounded ? 5 : 50)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(smallRounded ? 5 : 50)), ), onPressed: onPressed, child: child, diff --git a/lib/core/widgets/custom_widgets/scale_transition.dart b/lib/core/widgets/custom_widgets/scale_transition.dart index 227b2f1..8bafdaf 100644 --- a/lib/core/widgets/custom_widgets/scale_transition.dart +++ b/lib/core/widgets/custom_widgets/scale_transition.dart @@ -12,8 +12,7 @@ class CustomScaleTransition extends StatefulWidget { State createState() => _CustomScaleTransitionState(); } -class _CustomScaleTransitionState extends State - with TickerProviderStateMixin { +class _CustomScaleTransitionState extends State with TickerProviderStateMixin { bool remove = false; @override diff --git a/lib/features/sorting/selection/view/selection_sort_page.dart b/lib/features/sorting/selection/view/selection_sort_page.dart index d4b27af..2e2e003 100644 --- a/lib/features/sorting/selection/view/selection_sort_page.dart +++ b/lib/features/sorting/selection/view/selection_sort_page.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; final _notifierProvider = StateNotifierProvider( - (ref) => SelectionSortNotifier(), + (ref) => SelectionSortNotifier(), ); class SelectionSortPage extends StatelessWidget { @@ -14,6 +14,6 @@ class SelectionSortPage extends StatelessWidget { @override Widget build(BuildContext context) { - return SortingPage(instance: _notifierProvider,title: StringsManager.selectionSort); + return SortingPage(instance: _notifierProvider, title: StringsManager.selectionSort); } } From e68810768bb631746bab7b6f22430f4552f39241 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:36 +0300 Subject: [PATCH 11/13] reformat the code --- lib/core/widgets/adaptive/padding/only_padding.dart | 1 - lib/core/widgets/adaptive/padding/start_padding.dart | 9 ++++----- lib/features/sorting/base/view/sorting_page.dart | 3 +-- lib/features/sorting/base/widgets/size_draggable.dart | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/core/widgets/adaptive/padding/only_padding.dart b/lib/core/widgets/adaptive/padding/only_padding.dart index 5bce7ea..14809ec 100644 --- a/lib/core/widgets/adaptive/padding/only_padding.dart +++ b/lib/core/widgets/adaptive/padding/only_padding.dart @@ -16,7 +16,6 @@ class OnlyPadding extends StatelessWidget { final Widget child; @override Widget build(BuildContext context) { - return _RPadding( padding: REdgeInsetsDirectional.only( start: startPadding, diff --git a/lib/core/widgets/adaptive/padding/start_padding.dart b/lib/core/widgets/adaptive/padding/start_padding.dart index ea313c5..1639a50 100644 --- a/lib/core/widgets/adaptive/padding/start_padding.dart +++ b/lib/core/widgets/adaptive/padding/start_padding.dart @@ -1,12 +1,11 @@ -part of'../../../../core/widgets/adaptive/padding/adaptive_padding.dart'; +part of '../../../../core/widgets/adaptive/padding/adaptive_padding.dart'; + class StartPadding extends StatelessWidget { - const StartPadding( - {required this.padding, required this.child, super.key}); + const StartPadding({required this.padding, required this.child, super.key}); final double padding; final Widget child; @override Widget build(BuildContext context) { - return _RPadding( - padding: REdgeInsetsDirectional.only(start: padding), child: child); + return _RPadding(padding: REdgeInsetsDirectional.only(start: padding), child: child); } } diff --git a/lib/features/sorting/base/view/sorting_page.dart b/lib/features/sorting/base/view/sorting_page.dart index 57a32c8..e5788e2 100644 --- a/lib/features/sorting/base/view/sorting_page.dart +++ b/lib/features/sorting/base/view/sorting_page.dart @@ -162,8 +162,7 @@ class _BuildItem extends ConsumerWidget { Widget build(BuildContext context, ref) { final size = ref.watch(instance.select((state) => state.size)); final itemWidth = SortingNotifier.calculateItemWidth(context, size); - final currentItem = - ref.watch(instance.select((state) => index < state.list.length ? state.list[index] : null)); + final currentItem = ref.watch(instance.select((state) => index < state.list.length ? state.list[index] : null)); return Padding( padding: EdgeInsets.symmetric(horizontal: SortingNotifier.itemsPadding / 2), diff --git a/lib/features/sorting/base/widgets/size_draggable.dart b/lib/features/sorting/base/widgets/size_draggable.dart index 49cbc3f..f21d154 100644 --- a/lib/features/sorting/base/widgets/size_draggable.dart +++ b/lib/features/sorting/base/widgets/size_draggable.dart @@ -1,7 +1,7 @@ part of '../view/sorting_page.dart'; class _SizeDraggable extends ConsumerWidget { - const _SizeDraggable({ required this.instance}); + const _SizeDraggable({required this.instance}); final StateNotifierProvider instance; From 5275c45718091612d3d43d8205dde2506440ac68 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:39 +0300 Subject: [PATCH 12/13] reformat the code --- lib/core/helpers/svg_picture.dart | 4 +--- lib/core/helpers/system_overlay_style.dart | 7 +++---- lib/core/resources/theme_manager.dart | 15 +++++---------- .../adaptive/padding/symmetric_padding.dart | 3 +-- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/lib/core/helpers/svg_picture.dart b/lib/core/helpers/svg_picture.dart index 7a6874a..4df9f6a 100644 --- a/lib/core/helpers/svg_picture.dart +++ b/lib/core/helpers/svg_picture.dart @@ -25,9 +25,7 @@ class CustomAssetsSvg extends StatelessWidget { path, height: size?.r, semanticsLabel: semanticLabel, - colorFilter: color == null - ? null - : ColorFilter.mode(context.getColor(color), BlendMode.srcIn), + colorFilter: color == null ? null : ColorFilter.mode(context.getColor(color), BlendMode.srcIn), ); } } diff --git a/lib/core/helpers/system_overlay_style.dart b/lib/core/helpers/system_overlay_style.dart index 6401eea..98aee52 100644 --- a/lib/core/helpers/system_overlay_style.dart +++ b/lib/core/helpers/system_overlay_style.dart @@ -48,9 +48,8 @@ class TransparentSystemOverlay extends StatelessWidget { SystemUiOverlayStyle transparentTheme() { return const SystemUiOverlayStyle( - statusBarColor: Colors.transparent, - systemNavigationBarColor: Colors.transparent, - systemNavigationBarDividerColor: ColorManager.transparent - ); + statusBarColor: Colors.transparent, + systemNavigationBarColor: Colors.transparent, + systemNavigationBarDividerColor: ColorManager.transparent); } } diff --git a/lib/core/resources/theme_manager.dart b/lib/core/resources/theme_manager.dart index 0bfab25..1bdefd4 100644 --- a/lib/core/resources/theme_manager.dart +++ b/lib/core/resources/theme_manager.dart @@ -50,13 +50,10 @@ extension ThemeExtension on BuildContext { ThemeEnum.hintColor: Theme.of(this).hintColor, /// what ever dark or light. Maybe if we have multiple themes, it will save a lot of time. - ThemeEnum.whiteD1Color: Theme.of(this).dialogBackgroundColor, + ThemeEnum.whiteD1Color: Theme.of(this).dialogTheme.backgroundColor!, ThemeEnum.whiteD2Color: Theme.of(this).primaryColorLight, - ThemeEnum.bottomSheetColor: - Theme.of(this).bottomSheetTheme.backgroundColor ?? - Theme.of(this).primaryColorLight, - ThemeEnum.whiteD3Color: - Theme.of(this).textTheme.headlineLarge?.color ?? ColorManager.grey, + ThemeEnum.bottomSheetColor: Theme.of(this).bottomSheetTheme.backgroundColor ?? Theme.of(this).primaryColorLight, + ThemeEnum.whiteD3Color: Theme.of(this).textTheme.headlineLarge?.color ?? ColorManager.grey, ThemeEnum.whiteD4Color: Theme.of(this).colorScheme.primaryContainer, ThemeEnum.whiteD5Color: ColorManager.whiteD5, ThemeEnum.whiteD7Color: ColorManager.whiteD7, @@ -79,8 +76,7 @@ extension ThemeExtension on BuildContext { ThemeEnum.greyColor: ColorManager.grey, ThemeEnum.grey5Color: ColorManager.greyD9, - ThemeEnum.darkGreyColor: - Theme.of(this).textTheme.bodyLarge?.color ?? ColorManager.greyD3, + ThemeEnum.darkGreyColor: Theme.of(this).textTheme.bodyLarge?.color ?? ColorManager.greyD3, ThemeEnum.blueColor: ColorManager.blue, ThemeEnum.darkBlueColor: ColorManager.darkBlue, ThemeEnum.mediumBlueColor: ColorManager.mediumBlue, @@ -92,6 +88,5 @@ extension ThemeExtension on BuildContext { }; } - Color getColor(ThemeEnum color) => - _colors[color] ?? Theme.of(this).primaryColor; + Color getColor(ThemeEnum color) => _colors[color] ?? Theme.of(this).primaryColor; } diff --git a/lib/core/widgets/adaptive/padding/symmetric_padding.dart b/lib/core/widgets/adaptive/padding/symmetric_padding.dart index 133deb5..c6cdab1 100644 --- a/lib/core/widgets/adaptive/padding/symmetric_padding.dart +++ b/lib/core/widgets/adaptive/padding/symmetric_padding.dart @@ -12,7 +12,6 @@ class SymmetricPadding extends StatelessWidget { final Widget child; @override Widget build(BuildContext context) { - return _RPadding( - padding: REdgeInsets.symmetric(horizontal: horizontal, vertical: vertical), child: child); + return _RPadding(padding: REdgeInsets.symmetric(horizontal: horizontal, vertical: vertical), child: child); } } From 6a9b2f390df4e8a02dcf382b6c972a95a1aefd63 Mon Sep 17 00:00:00 2001 From: Ahmed Abdo <88978546+AhmedAbdoElhawary@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:37:41 +0300 Subject: [PATCH 13/13] reformat the code --- lib/core/widgets/adaptive/padding/top_padding.dart | 9 ++++----- lib/core/widgets/adaptive/padding/vertical_padding.dart | 6 ++---- .../custom_widgets/vertical_animation_hero_page.dart | 3 +-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/core/widgets/adaptive/padding/top_padding.dart b/lib/core/widgets/adaptive/padding/top_padding.dart index 2ec83b5..3b7edcd 100644 --- a/lib/core/widgets/adaptive/padding/top_padding.dart +++ b/lib/core/widgets/adaptive/padding/top_padding.dart @@ -1,12 +1,11 @@ -part of'../../../../core/widgets/adaptive/padding/adaptive_padding.dart'; +part of '../../../../core/widgets/adaptive/padding/adaptive_padding.dart'; + class TopPadding extends StatelessWidget { - const TopPadding( - {required this.padding, required this.child, super.key}); + const TopPadding({required this.padding, required this.child, super.key}); final double padding; final Widget child; @override Widget build(BuildContext context) { - return _RPadding( - padding: REdgeInsetsDirectional.only(top: padding), child: child); + return _RPadding(padding: REdgeInsetsDirectional.only(top: padding), child: child); } } diff --git a/lib/core/widgets/adaptive/padding/vertical_padding.dart b/lib/core/widgets/adaptive/padding/vertical_padding.dart index bd7369d..c3c39a0 100644 --- a/lib/core/widgets/adaptive/padding/vertical_padding.dart +++ b/lib/core/widgets/adaptive/padding/vertical_padding.dart @@ -1,13 +1,11 @@ part of '../../../../core/widgets/adaptive/padding/adaptive_padding.dart'; class VerticalPadding extends StatelessWidget { - const VerticalPadding( - {required this.padding, required this.child, super.key}); + const VerticalPadding({required this.padding, required this.child, super.key}); final double padding; final Widget child; @override Widget build(BuildContext context) { - return _RPadding( - padding: REdgeInsets.symmetric(vertical: padding), child: child); + return _RPadding(padding: REdgeInsets.symmetric(vertical: padding), child: child); } } diff --git a/lib/core/widgets/custom_widgets/vertical_animation_hero_page.dart b/lib/core/widgets/custom_widgets/vertical_animation_hero_page.dart index 9e77dc7..89f9559 100644 --- a/lib/core/widgets/custom_widgets/vertical_animation_hero_page.dart +++ b/lib/core/widgets/custom_widgets/vertical_animation_hero_page.dart @@ -9,8 +9,7 @@ class VerticalAnimationHeroPage extends StatefulWidget { final VoidCallback onSwipe; final Widget child; @override - State createState() => - _VerticalAnimationHeroPageState(); + State createState() => _VerticalAnimationHeroPageState(); } class _VerticalAnimationHeroPageState extends State {