diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..b0b3e1fe2543143896ee06ae7b9984f8bd038f73 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.json] +indent_size = 2 + +[*.yaml] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index 361df94f91db934b411ea13244ac8db6f41f3888..54ae0222de3e722adfb2b48c14d77c4d074dafda 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related *.iml diff --git a/assets/fonts/Nunito-Bold.ttf b/assets/fonts/Nunito-Bold.ttf deleted file mode 100644 index 6519feb781449ebe0015cbc74dfd9e13110fbba9..0000000000000000000000000000000000000000 Binary files a/assets/fonts/Nunito-Bold.ttf and /dev/null differ diff --git a/assets/fonts/Nunito-Light.ttf b/assets/fonts/Nunito-Light.ttf deleted file mode 100644 index 8a0736c41cd6c2a1225d356bf274de1d0afc3497..0000000000000000000000000000000000000000 Binary files a/assets/fonts/Nunito-Light.ttf and /dev/null differ diff --git a/assets/fonts/Nunito-Medium.ttf b/assets/fonts/Nunito-Medium.ttf deleted file mode 100644 index 88fccdc0638b6f5d6ac49d9d269dc3d518618ad1..0000000000000000000000000000000000000000 Binary files a/assets/fonts/Nunito-Medium.ttf and /dev/null differ diff --git a/assets/fonts/Nunito-Regular.ttf b/assets/fonts/Nunito-Regular.ttf deleted file mode 100644 index e7b8375a896ef0cd8e06730a78c84532b377e784..0000000000000000000000000000000000000000 Binary files a/assets/fonts/Nunito-Regular.ttf and /dev/null differ diff --git a/fastlane/metadata/android/en-US/changelogs/21.txt b/fastlane/metadata/android/en-US/changelogs/21.txt new file mode 100644 index 0000000000000000000000000000000000000000..65ba5e83570223adc45ccea599a3487b24b8a7dd --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/21.txt @@ -0,0 +1 @@ +Use flutter_custom_toolbox for common features. diff --git a/fastlane/metadata/android/fr-FR/changelogs/21.txt b/fastlane/metadata/android/fr-FR/changelogs/21.txt new file mode 100644 index 0000000000000000000000000000000000000000..258c624fb3898d91b6b70d7d99db2719c1bf0751 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/21.txt @@ -0,0 +1 @@ +Utilisation de flutter_custom_toolbox pour les fonctionnalités communes. diff --git a/lib/config/default_game_settings.dart b/lib/config/default_game_settings.dart index 00143db91b64210d3c22e0996cd8b245f778b3a5..488f63aa09cd5179136c56bd049e0788b489a3ac 100644 --- a/lib/config/default_game_settings.dart +++ b/lib/config/default_game_settings.dart @@ -1,4 +1,4 @@ -import 'package:reversi/utils/tools.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; class DefaultGameSettings { // available game parameters codes diff --git a/lib/config/default_global_settings.dart b/lib/config/default_global_settings.dart index 2de24e5d146fecb47acfccf2a125828e74d0cf19..d92229c2e02064684ed4a2caeb272ff63325776a 100644 --- a/lib/config/default_global_settings.dart +++ b/lib/config/default_global_settings.dart @@ -1,4 +1,4 @@ -import 'package:reversi/utils/tools.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; class DefaultGlobalSettings { // available global parameters codes diff --git a/lib/config/menu.dart b/lib/config/menu.dart index b09d6841a3e2d01a875f7ebd33bc246ad02016fb..febed649bd1d3938359fe487c47c9f77d3e4ab64 100644 --- a/lib/config/menu.dart +++ b/lib/config/menu.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:unicons/unicons.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/ui/screens/page_about.dart'; import 'package:reversi/ui/screens/page_game.dart'; diff --git a/lib/config/theme.dart b/lib/config/theme.dart deleted file mode 100644 index 74f532fd5abf693979118609564d29167e902009..0000000000000000000000000000000000000000 --- a/lib/config/theme.dart +++ /dev/null @@ -1,190 +0,0 @@ -import 'package:flutter/material.dart'; - -/// Colors from Tailwind CSS (v3.0) - June 2022 -/// -/// https://tailwindcss.com/docs/customizing-colors - -const int _primaryColor = 0xFF6366F1; -const MaterialColor primarySwatch = MaterialColor(_primaryColor, <int, Color>{ - 50: Color(0xFFEEF2FF), // indigo-50 - 100: Color(0xFFE0E7FF), // indigo-100 - 200: Color(0xFFC7D2FE), // indigo-200 - 300: Color(0xFFA5B4FC), // indigo-300 - 400: Color(0xFF818CF8), // indigo-400 - 500: Color(_primaryColor), // indigo-500 - 600: Color(0xFF4F46E5), // indigo-600 - 700: Color(0xFF4338CA), // indigo-700 - 800: Color(0xFF3730A3), // indigo-800 - 900: Color(0xFF312E81), // indigo-900 -}); - -const int _textColor = 0xFF64748B; -const MaterialColor textSwatch = MaterialColor(_textColor, <int, Color>{ - 50: Color(0xFFF8FAFC), // slate-50 - 100: Color(0xFFF1F5F9), // slate-100 - 200: Color(0xFFE2E8F0), // slate-200 - 300: Color(0xFFCBD5E1), // slate-300 - 400: Color(0xFF94A3B8), // slate-400 - 500: Color(_textColor), // slate-500 - 600: Color(0xFF475569), // slate-600 - 700: Color(0xFF334155), // slate-700 - 800: Color(0xFF1E293B), // slate-800 - 900: Color(0xFF0F172A), // slate-900 -}); - -const Color errorColor = Color(0xFFDC2626); // red-600 - -final ColorScheme lightColorScheme = ColorScheme.light( - primary: primarySwatch.shade500, - secondary: primarySwatch.shade500, - onSecondary: Colors.white, - error: errorColor, - onSurface: textSwatch.shade500, - surface: textSwatch.shade50, - surfaceContainerHighest: Colors.white, - shadow: textSwatch.shade900.withOpacity(.1), -); - -final ColorScheme darkColorScheme = ColorScheme.dark( - primary: primarySwatch.shade500, - secondary: primarySwatch.shade500, - onSecondary: Colors.white, - error: errorColor, - onSurface: textSwatch.shade300, - surface: const Color(0xFF262630), - surfaceContainerHighest: const Color(0xFF282832), - shadow: textSwatch.shade900.withOpacity(.2), -); - -final ThemeData lightTheme = ThemeData( - colorScheme: lightColorScheme, - fontFamily: 'Nunito', - textTheme: TextTheme( - displayLarge: TextStyle( - color: textSwatch.shade700, - fontFamily: 'Nunito', - ), - displayMedium: TextStyle( - color: textSwatch.shade600, - fontFamily: 'Nunito', - ), - displaySmall: TextStyle( - color: textSwatch.shade500, - fontFamily: 'Nunito', - ), - headlineLarge: TextStyle( - color: textSwatch.shade700, - fontFamily: 'Nunito', - ), - headlineMedium: TextStyle( - color: textSwatch.shade600, - fontFamily: 'Nunito', - ), - headlineSmall: TextStyle( - color: textSwatch.shade500, - fontFamily: 'Nunito', - ), - titleLarge: TextStyle( - color: textSwatch.shade700, - fontFamily: 'Nunito', - ), - titleMedium: TextStyle( - color: textSwatch.shade600, - fontFamily: 'Nunito', - ), - titleSmall: TextStyle( - color: textSwatch.shade500, - fontFamily: 'Nunito', - ), - bodyLarge: TextStyle( - color: textSwatch.shade700, - fontFamily: 'Nunito', - ), - bodyMedium: TextStyle( - color: textSwatch.shade600, - fontFamily: 'Nunito', - ), - bodySmall: TextStyle( - color: textSwatch.shade500, - fontFamily: 'Nunito', - ), - labelLarge: TextStyle( - color: textSwatch.shade700, - fontFamily: 'Nunito', - ), - labelMedium: TextStyle( - color: textSwatch.shade600, - fontFamily: 'Nunito', - ), - labelSmall: TextStyle( - color: textSwatch.shade500, - fontFamily: 'Nunito', - ), - ), -); - -final ThemeData darkTheme = lightTheme.copyWith( - colorScheme: darkColorScheme, - textTheme: TextTheme( - displayLarge: TextStyle( - color: textSwatch.shade200, - fontFamily: 'Nunito', - ), - displayMedium: TextStyle( - color: textSwatch.shade300, - fontFamily: 'Nunito', - ), - displaySmall: TextStyle( - color: textSwatch.shade400, - fontFamily: 'Nunito', - ), - headlineLarge: TextStyle( - color: textSwatch.shade200, - fontFamily: 'Nunito', - ), - headlineMedium: TextStyle( - color: textSwatch.shade300, - fontFamily: 'Nunito', - ), - headlineSmall: TextStyle( - color: textSwatch.shade400, - fontFamily: 'Nunito', - ), - titleLarge: TextStyle( - color: textSwatch.shade200, - fontFamily: 'Nunito', - ), - titleMedium: TextStyle( - color: textSwatch.shade300, - fontFamily: 'Nunito', - ), - titleSmall: TextStyle( - color: textSwatch.shade400, - fontFamily: 'Nunito', - ), - bodyLarge: TextStyle( - color: textSwatch.shade200, - fontFamily: 'Nunito', - ), - bodyMedium: TextStyle( - color: textSwatch.shade300, - fontFamily: 'Nunito', - ), - bodySmall: TextStyle( - color: textSwatch.shade400, - fontFamily: 'Nunito', - ), - labelLarge: TextStyle( - color: textSwatch.shade200, - fontFamily: 'Nunito', - ), - labelMedium: TextStyle( - color: textSwatch.shade300, - fontFamily: 'Nunito', - ), - labelSmall: TextStyle( - color: textSwatch.shade400, - fontFamily: 'Nunito', - ), - ), -); diff --git a/lib/cubit/game_cubit.dart b/lib/cubit/game_cubit.dart index face7682f0b74048fde6d297245d5ccd08fad3d2..8a9617fe293b3bba39753c7ad236f6b45f17a546 100644 --- a/lib/cubit/game_cubit.dart +++ b/lib/cubit/game_cubit.dart @@ -1,6 +1,5 @@ -import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:hydrated_bloc/hydrated_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/models/game/game.dart'; import 'package:reversi/models/settings/settings_game.dart'; diff --git a/lib/cubit/nav_cubit.dart b/lib/cubit/nav_cubit.dart index 141a1f6785c7d3d8281f085fc127d75d78313563..30c64fdc8b88d82ee2adca51ee25c98bdec3aa87 100644 --- a/lib/cubit/nav_cubit.dart +++ b/lib/cubit/nav_cubit.dart @@ -1,4 +1,4 @@ -import 'package:hydrated_bloc/hydrated_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/config/menu.dart'; diff --git a/lib/cubit/settings_game_cubit.dart b/lib/cubit/settings_game_cubit.dart index ecfa21cc7d9a83d652421c52e148c3bcf09e0ae4..196c6eda0285156f6d6175936d73ddfcd1c3f4d9 100644 --- a/lib/cubit/settings_game_cubit.dart +++ b/lib/cubit/settings_game_cubit.dart @@ -1,6 +1,5 @@ -import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:hydrated_bloc/hydrated_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/config/default_game_settings.dart'; import 'package:reversi/models/settings/settings_game.dart'; diff --git a/lib/cubit/settings_global_cubit.dart b/lib/cubit/settings_global_cubit.dart index cb4094b21e3ca1fdfb44e621f7cc341947276caf..95bdb30e480e38e0f4aa853359f004cf10e4b343 100644 --- a/lib/cubit/settings_global_cubit.dart +++ b/lib/cubit/settings_global_cubit.dart @@ -1,6 +1,5 @@ -import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:hydrated_bloc/hydrated_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/config/default_global_settings.dart'; import 'package:reversi/models/settings/settings_global.dart'; diff --git a/lib/cubit/theme_cubit.dart b/lib/cubit/theme_cubit.dart index b793e895dbb0c672d451cd403e0036c3d9ac9b42..1ecab6014c67a0393eabbf704b8b85c9e988705e 100644 --- a/lib/cubit/theme_cubit.dart +++ b/lib/cubit/theme_cubit.dart @@ -1,6 +1,5 @@ -import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:hydrated_bloc/hydrated_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; part 'theme_state.dart'; diff --git a/lib/main.dart b/lib/main.dart index 10cc981cf005be1187a19262d802cbdf415639be..8466986177c0a2b36a0bd13d7c7732554b9a1c66 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,15 +1,10 @@ import 'dart:io'; -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:hive/hive.dart'; -import 'package:hydrated_bloc/hydrated_bloc.dart'; -import 'package:path_provider/path_provider.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/config/default_global_settings.dart'; -import 'package:reversi/config/theme.dart'; import 'package:reversi/cubit/game_cubit.dart'; import 'package:reversi/cubit/nav_cubit.dart'; import 'package:reversi/cubit/settings_game_cubit.dart'; diff --git a/lib/models/game/game.dart b/lib/models/game/game.dart index 22b2fd83a4de1d7741d4a7249b39fa0a7a18395b..76151f13a481b560e5f29ba73d6c42dbf0f92cf2 100644 --- a/lib/models/game/game.dart +++ b/lib/models/game/game.dart @@ -1,8 +1,9 @@ +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; + import 'package:reversi/models/game/game_board.dart'; import 'package:reversi/models/game/game_model.dart'; import 'package:reversi/models/settings/settings_game.dart'; import 'package:reversi/models/settings/settings_global.dart'; -import 'package:reversi/utils/tools.dart'; class Game { Game({ diff --git a/lib/models/settings/settings_game.dart b/lib/models/settings/settings_game.dart index 68831589adedbd206dd7ffe417c7ddce893f23b8..828755c323af49e329e9b88ca97f47f01fe2676a 100644 --- a/lib/models/settings/settings_game.dart +++ b/lib/models/settings/settings_game.dart @@ -1,5 +1,6 @@ +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; + import 'package:reversi/config/default_game_settings.dart'; -import 'package:reversi/utils/tools.dart'; class GameSettings { final String itemsCount; diff --git a/lib/models/settings/settings_global.dart b/lib/models/settings/settings_global.dart index 1260f1fb345b52dd649cab8698765c64eb838935..6aaf5c662960385cba1c0ef09a11325bfdb1c9b6 100644 --- a/lib/models/settings/settings_global.dart +++ b/lib/models/settings/settings_global.dart @@ -1,5 +1,6 @@ +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; + import 'package:reversi/config/default_global_settings.dart'; -import 'package:reversi/utils/tools.dart'; class GlobalSettings { String skin; diff --git a/lib/ui/helpers/app_titles.dart b/lib/ui/helpers/app_titles.dart deleted file mode 100644 index b98107b12fabc3114ebfbec994166b588abcf1ad..0000000000000000000000000000000000000000 --- a/lib/ui/helpers/app_titles.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/material.dart'; - -class AppHeader extends StatelessWidget { - const AppHeader({super.key, required this.text}); - - final String text; - - @override - Widget build(BuildContext context) { - return Text( - tr(text), - textAlign: TextAlign.start, - style: Theme.of(context).textTheme.headlineMedium!.apply(fontWeightDelta: 2), - ); - } -} - -class AppTitle extends StatelessWidget { - const AppTitle({super.key, required this.text}); - - final String text; - - @override - Widget build(BuildContext context) { - return Text( - tr(text), - textAlign: TextAlign.start, - style: Theme.of(context).textTheme.titleLarge!.apply(fontWeightDelta: 2), - ); - } -} diff --git a/lib/ui/helpers/styled_button.dart b/lib/ui/helpers/styled_button.dart deleted file mode 100644 index c79eada33578b6786a372cc0a4401f088eaa003c..0000000000000000000000000000000000000000 --- a/lib/ui/helpers/styled_button.dart +++ /dev/null @@ -1,210 +0,0 @@ -import 'package:auto_size_text/auto_size_text.dart'; -import 'package:flutter/material.dart'; - -import 'package:reversi/utils/color_extensions.dart'; - -class StyledButton extends StatelessWidget { - const StyledButton({ - super.key, - required this.color, - required this.onPressed, - this.onLongPress, - required this.child, - }); - - final Color color; - final VoidCallback? onPressed; - final VoidCallback? onLongPress; - final Widget child; - - factory StyledButton.text({ - Key? key, - required VoidCallback? onPressed, - VoidCallback? onLongPress, - required String caption, - required Color color, - }) { - final Widget captionWidget = AutoSizeText( - caption, - maxLines: 1, - style: TextStyle( - inherit: true, - fontWeight: FontWeight.w900, - color: color.darken(60), - shadows: [ - Shadow( - blurRadius: 5.0, - color: color.lighten(60), - offset: const Offset(2, 2), - ), - Shadow( - blurRadius: 5.0, - color: color.lighten(60), - offset: const Offset(2, -2), - ), - Shadow( - blurRadius: 5.0, - color: color.lighten(60), - offset: const Offset(-2, 2), - ), - Shadow( - blurRadius: 5.0, - color: color.lighten(60), - offset: const Offset(-2, -2), - ), - ], - ), - ); - - return StyledButton( - color: color, - onPressed: onPressed, - onLongPress: onLongPress, - child: captionWidget, - ); - } - - factory StyledButton.icon({ - Key? key, - required VoidCallback? onPressed, - VoidCallback? onLongPress, - required Icon icon, - required Color color, - required double iconSize, - }) { - return StyledButton( - color: color, - onPressed: onPressed, - onLongPress: onLongPress, - child: Icon( - icon.icon, - color: icon.color ?? color.darken(60), - size: iconSize, - shadows: [ - Shadow( - blurRadius: 5.0, - color: color.lighten(60), - offset: const Offset(2, 2), - ), - Shadow( - blurRadius: 5.0, - color: color.lighten(60), - offset: const Offset(2, -2), - ), - Shadow( - blurRadius: 5.0, - color: color.lighten(60), - offset: const Offset(-2, 2), - ), - Shadow( - blurRadius: 5.0, - color: color.lighten(60), - offset: const Offset(-2, -2), - ), - ], - ), - ); - } - - @override - Widget build(BuildContext context) { - const double borderWidth = 4; - final Color borderColor = color.darken(40); - const double borderRadius = 10; - - return Container( - margin: const EdgeInsets.all(2), - padding: const EdgeInsets.all(2), - decoration: BoxDecoration( - color: color, - border: Border.all( - color: borderColor, - width: borderWidth, - ), - borderRadius: BorderRadius.circular(borderRadius), - ), - child: CustomPaint( - painter: StyledButtonPainter( - baseColor: color, - ), - child: MaterialButton( - onPressed: onPressed, - onLongPress: onLongPress, - padding: const EdgeInsets.all(8), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - minWidth: 40, - child: child, - ), - ), - ); - } -} - -class StyledButtonPainter extends CustomPainter { - StyledButtonPainter({ - required this.baseColor, - }); - - final Color baseColor; - - @override - void paint(Canvas canvas, Size size) { - final Color lightColor = baseColor.lighten(20); - final Color darkColor = baseColor.darken(20); - - final Paint paint = Paint()..style = PaintingStyle.fill; - - const double cornerRadius = 6; - - Path topPath = Path() - ..moveTo(cornerRadius, 0) - ..lineTo(size.width - cornerRadius, 0) - ..arcToPoint( - Offset(size.width, cornerRadius), - radius: const Radius.circular(cornerRadius), - ) - ..lineTo(size.width, size.height * .35) - ..quadraticBezierTo( - size.width * .4, - size.height * .1, - 0, - size.height * .3, - ) - ..lineTo(0, cornerRadius) - ..arcToPoint( - const Offset(cornerRadius, 0), - radius: const Radius.circular(cornerRadius), - ); - - Path bottomPath = Path() - ..moveTo(cornerRadius, size.height) - ..lineTo(size.width - cornerRadius, size.height) - ..arcToPoint( - Offset(size.width, size.height - cornerRadius), - radius: const Radius.circular(cornerRadius), - clockwise: false, - ) - ..lineTo(size.width, size.height * .7) - ..quadraticBezierTo( - size.width * .6, - size.height * .9, - 0, - size.height * .7, - ) - ..lineTo(0, size.height - cornerRadius) - ..arcToPoint( - Offset(cornerRadius, size.height), - radius: const Radius.circular(cornerRadius), - clockwise: false, - ); - - paint.color = lightColor; - canvas.drawPath(topPath, paint); - - paint.color = darkColor; - canvas.drawPath(bottomPath, paint); - } - - @override - bool shouldRepaint(CustomPainter oldDelegate) => false; -} diff --git a/lib/ui/layouts/parameters_layout.dart b/lib/ui/layouts/parameters_layout.dart index 55acc0b5d209bd30097485811a7dd78de9b0e9ec..c8b9628299a8c2b4f7681ce7ee07ccef9cacc081 100644 --- a/lib/ui/layouts/parameters_layout.dart +++ b/lib/ui/layouts/parameters_layout.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/config/default_game_settings.dart'; import 'package:reversi/config/default_global_settings.dart'; diff --git a/lib/ui/parameters/parameter_painter.dart b/lib/ui/parameters/parameter_painter.dart index cc7b3edf4fd047b6275274498f016e33941f5f45..b0832cc7e80da10662ff98270fce0861c36c2009 100644 --- a/lib/ui/parameters/parameter_painter.dart +++ b/lib/ui/parameters/parameter_painter.dart @@ -1,11 +1,11 @@ import 'dart:math'; import 'package:flutter/material.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; + import 'package:reversi/models/settings/settings_game.dart'; import 'package:reversi/models/settings/settings_global.dart'; -import 'package:reversi/utils/tools.dart'; - class ParameterPainter extends CustomPainter { const ParameterPainter({ required this.code, diff --git a/lib/ui/parameters/parameter_widget.dart b/lib/ui/parameters/parameter_widget.dart index 6a6941d89607e41bb7f968b7a60208442ac76b0a..c18f8907468b877dd8724d43c7b2d8eda1d94c6f 100644 --- a/lib/ui/parameters/parameter_widget.dart +++ b/lib/ui/parameters/parameter_widget.dart @@ -1,10 +1,9 @@ import 'package:flutter/material.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; + import 'package:reversi/models/settings/settings_game.dart'; import 'package:reversi/models/settings/settings_global.dart'; -import 'package:reversi/ui/helpers/styled_button.dart'; -import 'package:reversi/utils/tools.dart'; - class ParameterWidget extends StatelessWidget { const ParameterWidget({ super.key, diff --git a/lib/ui/screens/page_about.dart b/lib/ui/screens/page_about.dart index 1706939b8183cd797d296a846c8e0c2602343050..ab73e304b8138295f6669330b928e0d1d0263565 100644 --- a/lib/ui/screens/page_about.dart +++ b/lib/ui/screens/page_about.dart @@ -1,8 +1,5 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:package_info_plus/package_info_plus.dart'; - -import 'package:reversi/ui/helpers/app_titles.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; class PageAbout extends StatelessWidget { const PageAbout({super.key}); diff --git a/lib/ui/screens/page_game.dart b/lib/ui/screens/page_game.dart index 8605ef24fb42bd12781ae310d997427493eb30fb..8d40a29ee62309992965999fe5ce08167d9ddad2 100644 --- a/lib/ui/screens/page_game.dart +++ b/lib/ui/screens/page_game.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/cubit/game_cubit.dart'; import 'package:reversi/models/game/game.dart'; diff --git a/lib/ui/screens/page_settings.dart b/lib/ui/screens/page_settings.dart index 3df22a1bb87618619ddcaa5d8fd118bef17137b1..a009c12b22462d2dfea676c0aca0b40bee9a75fd 100644 --- a/lib/ui/screens/page_settings.dart +++ b/lib/ui/screens/page_settings.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; -import 'package:reversi/ui/helpers/app_titles.dart'; import 'package:reversi/ui/settings/settings_form.dart'; class PageSettings extends StatelessWidget { diff --git a/lib/ui/settings/settings_form.dart b/lib/ui/settings/settings_form.dart index e7df8b8bd7043bede0900b9d63b913720c9e8b19..16ad2fe70807763eb44172cb1422412ebbe5fe0e 100644 --- a/lib/ui/settings/settings_form.dart +++ b/lib/ui/settings/settings_form.dart @@ -1,6 +1,5 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:unicons/unicons.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/ui/settings/theme_card.dart'; diff --git a/lib/ui/settings/theme_card.dart b/lib/ui/settings/theme_card.dart index 7581a2d3199384dfea7efb78741c519fb22ecac7..7bc40aea36cb7a67ec1ff143c4e19970ef4b15e8 100644 --- a/lib/ui/settings/theme_card.dart +++ b/lib/ui/settings/theme_card.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/cubit/theme_cubit.dart'; diff --git a/lib/ui/skeleton.dart b/lib/ui/skeleton.dart index a460301d4eb07994f60c7fabed5cb62968060d10..86353bcb1a0bb4d61456dbbcf98422c6bc659764 100644 --- a/lib/ui/skeleton.dart +++ b/lib/ui/skeleton.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/config/menu.dart'; import 'package:reversi/cubit/nav_cubit.dart'; diff --git a/lib/ui/widgets/actions/button_delete_saved_game.dart b/lib/ui/widgets/actions/button_delete_saved_game.dart index ddc09a1d0e0a1cce905fde156a2efe11952db330..74154366eab60115019cf6e57f8725ae3ca41f5b 100644 --- a/lib/ui/widgets/actions/button_delete_saved_game.dart +++ b/lib/ui/widgets/actions/button_delete_saved_game.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/cubit/game_cubit.dart'; -import 'package:reversi/ui/helpers/styled_button.dart'; class DeleteSavedGameButton extends StatelessWidget { const DeleteSavedGameButton({super.key}); diff --git a/lib/ui/widgets/actions/button_game_quit.dart b/lib/ui/widgets/actions/button_game_quit.dart index fbe48a34cf300c4d9e0650ffe31ff6e0aa37ab1e..d94c93b5119cf3a4fd96263bf93176e1dc542296 100644 --- a/lib/ui/widgets/actions/button_game_quit.dart +++ b/lib/ui/widgets/actions/button_game_quit.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/cubit/game_cubit.dart'; -import 'package:reversi/ui/helpers/styled_button.dart'; class QuitGameButton extends StatelessWidget { const QuitGameButton({super.key}); diff --git a/lib/ui/widgets/actions/button_game_start_new.dart b/lib/ui/widgets/actions/button_game_start_new.dart index 9e88d264825404f4f3a5c1515ef1bdbabb73b3cd..add9761b528f37b3dbae7dbe5dbbaf55d7cceddc 100644 --- a/lib/ui/widgets/actions/button_game_start_new.dart +++ b/lib/ui/widgets/actions/button_game_start_new.dart @@ -1,10 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/cubit/game_cubit.dart'; import 'package:reversi/cubit/settings_game_cubit.dart'; import 'package:reversi/cubit/settings_global_cubit.dart'; -import 'package:reversi/ui/helpers/styled_button.dart'; class StartNewGameButton extends StatelessWidget { const StartNewGameButton({super.key}); diff --git a/lib/ui/widgets/actions/button_resume_saved_game.dart b/lib/ui/widgets/actions/button_resume_saved_game.dart index d28b455eed3747dd4e9422c186176146ae48e00d..a7f8e57f1caa6d49713d94171d37051715f80246 100644 --- a/lib/ui/widgets/actions/button_resume_saved_game.dart +++ b/lib/ui/widgets/actions/button_resume_saved_game.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/cubit/game_cubit.dart'; -import 'package:reversi/ui/helpers/styled_button.dart'; class ResumeSavedGameButton extends StatelessWidget { const ResumeSavedGameButton({super.key}); diff --git a/lib/ui/widgets/game/game_board.dart b/lib/ui/widgets/game/game_board.dart index 5c8eb368149d15f5675774579a93d9be1c17a31e..24c26a7cdad851b540685e3759811e75c30a450a 100644 --- a/lib/ui/widgets/game/game_board.dart +++ b/lib/ui/widgets/game/game_board.dart @@ -1,10 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/cubit/game_cubit.dart'; import 'package:reversi/game/game_engine.dart'; import 'package:reversi/models/game/game.dart'; -import 'package:reversi/utils/tools.dart'; class GameBoardWidget extends StatelessWidget { const GameBoardWidget({super.key}); diff --git a/lib/ui/widgets/global_app_bar.dart b/lib/ui/widgets/global_app_bar.dart index ffc7930b886372a785f7de4eb71b35fe40577759..1e7ecf6d73e69a68470f4dc4087d964533c6c36a 100644 --- a/lib/ui/widgets/global_app_bar.dart +++ b/lib/ui/widgets/global_app_bar.dart @@ -1,12 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:reversi/config/menu.dart'; import 'package:reversi/cubit/game_cubit.dart'; import 'package:reversi/cubit/nav_cubit.dart'; import 'package:reversi/models/game/game.dart'; -import 'package:reversi/ui/helpers/app_titles.dart'; -import 'package:reversi/ui/helpers/styled_button.dart'; class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget { const GlobalAppBar({super.key}); @@ -38,7 +36,7 @@ class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget { // go to Settings page menuActions.add(ElevatedButton( onPressed: () { - context.read<NavCubit>().goToSettingsPage(); + BlocProvider.of<NavCubit>(context).goToSettingsPage(); }, style: ElevatedButton.styleFrom( shape: const CircleBorder(), @@ -49,7 +47,7 @@ class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget { // go to About page menuActions.add(ElevatedButton( onPressed: () { - context.read<NavCubit>().goToAboutPage(); + BlocProvider.of<NavCubit>(context).goToAboutPage(); }, style: ElevatedButton.styleFrom( shape: const CircleBorder(), @@ -60,7 +58,7 @@ class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget { // back to Home page menuActions.add(ElevatedButton( onPressed: () { - context.read<NavCubit>().goToGamePage(); + BlocProvider.of<NavCubit>(context).goToGamePage(); }, style: ElevatedButton.styleFrom( shape: const CircleBorder(), diff --git a/lib/utils/color_extensions.dart b/lib/utils/color_extensions.dart deleted file mode 100644 index 4e55e338f0d3ed98b233d1ef887b7b3e17e29d97..0000000000000000000000000000000000000000 --- a/lib/utils/color_extensions.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'dart:ui'; - -extension ColorExtension on Color { - Color darken([int percent = 40]) { - assert(1 <= percent && percent <= 100); - final value = 1 - percent / 100; - return Color.fromARGB( - alpha, - (red * value).round(), - (green * value).round(), - (blue * value).round(), - ); - } - - Color lighten([int percent = 40]) { - assert(1 <= percent && percent <= 100); - final value = percent / 100; - return Color.fromARGB( - alpha, - (red + ((255 - red) * value)).round(), - (green + ((255 - green) * value)).round(), - (blue + ((255 - blue) * value)).round(), - ); - } - - Color avg(Color other) { - final red = (this.red + other.red) ~/ 2; - final green = (this.green + other.green) ~/ 2; - final blue = (this.blue + other.blue) ~/ 2; - final alpha = (this.alpha + other.alpha) ~/ 2; - return Color.fromARGB(alpha, red, green, blue); - } -} diff --git a/lib/utils/tools.dart b/lib/utils/tools.dart deleted file mode 100644 index fd48b2b009b80b22248d6e7f08a63e96c4065bd7..0000000000000000000000000000000000000000 --- a/lib/utils/tools.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'package:flutter/foundation.dart'; - -void printlog(String message) { - if (!kReleaseMode) { - debugPrint(message); - } -} diff --git a/pubspec.lock b/pubspec.lock index c4807cc893593f0a6b2dbef258bfc7d941409824..f698c0201dd80293a9d4ad75aaee7c8e2b63f106 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -18,7 +18,7 @@ packages: source: hosted version: "2.12.0" auto_size_text: - dependency: "direct main" + dependency: transitive description: name: auto_size_text sha256: "3f5261cd3fb5f2a9ab4e2fc3fba84fd9fcaac8821f20a1d4e71f557521b22599" @@ -66,7 +66,7 @@ packages: source: hosted version: "3.0.6" easy_localization: - dependency: "direct main" + dependency: transitive description: name: easy_localization sha256: fa59bcdbbb911a764aa6acf96bbb6fa7a5cf8234354fc45ec1a43a0349ef0201 @@ -82,7 +82,7 @@ packages: source: hosted version: "0.0.2" equatable: - dependency: "direct main" + dependency: transitive description: name: equatable sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 @@ -111,13 +111,22 @@ packages: source: sdk version: "0.0.0" flutter_bloc: - dependency: "direct main" + dependency: transitive description: name: flutter_bloc sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a url: "https://pub.dev" source: hosted version: "8.1.6" + flutter_custom_toolbox: + dependency: "direct main" + description: + path: "." + ref: "0.1.1" + resolved-ref: ba7137ca9edec7e503ed3dbfe7f6ede7e9cfbf4d + url: "https://git.harrault.fr/android/flutter-toolbox.git" + source: git + version: "0.1.1" flutter_lints: dependency: "direct dev" description: @@ -137,7 +146,7 @@ packages: source: sdk version: "0.0.0" hive: - dependency: "direct main" + dependency: transitive description: name: hive sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" @@ -161,7 +170,7 @@ packages: source: hosted version: "4.0.2" hydrated_bloc: - dependency: "direct main" + dependency: transitive description: name: hydrated_bloc sha256: af35b357739fe41728df10bec03aad422cdc725a1e702e03af9d2a41ea05160c @@ -209,13 +218,13 @@ packages: source: hosted version: "1.0.0" package_info_plus: - dependency: "direct main" + dependency: transitive description: name: package_info_plus - sha256: "894f37107424311bdae3e476552229476777b8752c5a2a2369c0cb9a2d5442ef" + sha256: df3eb3e0aed5c1107bb0fdb80a8e82e778114958b1c5ac5644fb1ac9cae8a998 url: "https://pub.dev" source: hosted - version: "8.0.3" + version: "8.1.0" package_info_plus_platform_interface: dependency: transitive description: @@ -233,7 +242,7 @@ packages: source: hosted version: "1.9.0" path_provider: - dependency: "direct main" + dependency: transitive description: name: path_provider sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 @@ -284,10 +293,10 @@ packages: dependency: transitive description: name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" url: "https://pub.dev" source: hosted - version: "3.1.5" + version: "3.1.6" plugin_platform_interface: dependency: transitive description: @@ -377,10 +386,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + sha256: "0bd04f5bb74fcd6ff0606a888a30e917af9bd52820b178eaa464beb11dca84b6" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" synchronized: dependency: transitive description: @@ -401,12 +410,12 @@ packages: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" unicons: - dependency: "direct main" + dependency: transitive description: name: unicons sha256: f3eab9d87c226415ef857cfd2167e1d12ad81ea1f5783b46cf644224fea4eab7 @@ -433,10 +442,10 @@ packages: dependency: transitive description: name: win32 - sha256: e5c39a90447e7c81cfec14b041cdbd0d0916bd9ebbc7fe02ab69568be703b9bd + sha256: "2735daae5150e8b1dfeb3eb0544b4d3af0061e9e82cef063adcd583bdae4306a" url: "https://pub.dev" source: hosted - version: "5.6.0" + version: "5.7.0" xdg_directories: dependency: transitive description: @@ -446,5 +455,5 @@ packages: source: hosted version: "1.1.0" sdks: - dart: ">=3.5.0 <4.0.0" + dart: ">=3.5.3 <4.0.0" flutter: ">=3.24.0" diff --git a/pubspec.yaml b/pubspec.yaml index 7cf23d6c99793c2d75b97cce715fee294de5c44f..e1232edbee249db3779c470b8c03942997d7e3ae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,9 @@ name: reversi description: A reversi game application. -publish_to: 'none' -version: 0.1.2+20 +publish_to: "none" + +version: 0.2.0+21 environment: sdk: "^3.0.0" @@ -12,15 +13,10 @@ dependencies: sdk: flutter # base - auto_size_text: ^3.0.0 - easy_localization: ^3.0.1 - equatable: ^2.0.5 - flutter_bloc: ^8.1.1 - hive: ^2.2.3 - hydrated_bloc: ^9.0.0 - package_info_plus: ^8.0.0 - path_provider: ^2.0.11 - unicons: ^3.0.0 + flutter_custom_toolbox: + git: + url: https://git.harrault.fr/android/flutter-toolbox.git + ref: 0.1.1 # specific async: ^2.11.0 @@ -34,15 +30,3 @@ flutter: - assets/skins/ - assets/translations/ - assets/ui/ - - fonts: - - family: Nunito - fonts: - - asset: assets/fonts/Nunito-Bold.ttf - weight: 700 - - asset: assets/fonts/Nunito-Medium.ttf - weight: 500 - - asset: assets/fonts/Nunito-Regular.ttf - weight: 400 - - asset: assets/fonts/Nunito-Light.ttf - weight: 300