diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f9b303465f19b5fbf5ec669cd083c9cc38ecda9a --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1 @@ +include: package:flutter_lints/flutter.yaml diff --git a/android/gradle.properties b/android/gradle.properties index 663881258a10822c0b4abc064b6e0bc0ccf48833..81949dfd2077495aaea8a6bc81ad9c75442f9ebb 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=0.0.13 -app.versionCode=13 +app.versionName=0.0.14 +app.versionCode=14 diff --git a/fastlane/metadata/android/en-US/changelogs/14.txt b/fastlane/metadata/android/en-US/changelogs/14.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ab11150150fc75a46c9acc317890208e5a120b9 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/14.txt @@ -0,0 +1 @@ +Add automatic flutter linter. Apply code lints. Update dependencies. diff --git a/fastlane/metadata/android/fr-FR/changelogs/14.txt b/fastlane/metadata/android/fr-FR/changelogs/14.txt new file mode 100644 index 0000000000000000000000000000000000000000..315dd65b6fea52abf09c73bd8b62e0a6e41082b7 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/14.txt @@ -0,0 +1 @@ +Ajout d'un correcteur automatique de code. Application des correction. Mise à jour des dépendances. diff --git a/lib/game_board.dart b/lib/game_board.dart index c25070df20791326fbc9866ed1cc1730186b71d5..6f179274660694cbb233518be0e57d56ace034bd 100644 --- a/lib/game_board.dart +++ b/lib/game_board.dart @@ -24,8 +24,8 @@ class Position { /// An immutable representation of a reversi game's board. class GameBoard { - static final int height = 8; - static final int width = 8; + static const int height = 8; + static const int width = 8; final List<List<PieceType>> rows; // Because calculating out all the available moves for a player can be diff --git a/lib/main.dart b/lib/main.dart index d81b47f33c700071e401f8e295ccfbab5de81555..a248c75c34922242245401157ea2b47dde5ccd66 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,12 +21,14 @@ void main() { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - runApp(FlutterFlipApp()); + runApp(const FlutterFlipApp()); } /// The App class. Unlike many Flutter apps, this one does not use Material /// widgets, so there's no [MaterialApp] or [Theme] objects. class FlutterFlipApp extends StatelessWidget { + const FlutterFlipApp({super.key}); + @override Widget build(BuildContext context) { return MaterialApp( @@ -35,7 +37,7 @@ class FlutterFlipApp extends StatelessWidget { primaryColor: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), - home: GameScreen(), + home: const GameScreen(), ); } } @@ -43,6 +45,8 @@ class FlutterFlipApp extends StatelessWidget { /// The [GameScreen] Widget represents the entire game /// display, from scores to board state and everything in between. class GameScreen extends StatefulWidget { + const GameScreen({super.key}); + @override State createState() => _GameScreenState(); } @@ -90,7 +94,7 @@ class _GameScreenState extends State<GameScreen> { while (newModel.player == PieceType.white) { final finder = MoveFinder(newModel.board); - final move = await Future.delayed(Duration(milliseconds: 2000), () { + final move = await Future.delayed(const Duration(milliseconds: 2000), () { return finder.findNextMove(newModel.player, 5); }); if (move != null) { @@ -136,7 +140,7 @@ class _GameScreenState extends State<GameScreen> { Widget _buildScoreBox(PieceType player, GameModel model) { var assetImageCode = player == PieceType.black ? 'black' : 'white'; String assetImageName = - 'assets/skins/' + model.skin + '_tile_' + assetImageCode + '.png'; + 'assets/skins/${model.skin}_tile_$assetImageCode.png'; var scoreText = player == PieceType.black ? '${model.blackScore}' : '${model.whiteScore}'; @@ -159,13 +163,13 @@ class _GameScreenState extends State<GameScreen> { fit: BoxFit.fill, ), ), - SizedBox( + const SizedBox( width: 10.0, ), Text( scoreText, textAlign: TextAlign.center, - style: TextStyle( + style: const TextStyle( fontSize: 35.0, color: Color(0xff000000), ), @@ -179,11 +183,11 @@ class _GameScreenState extends State<GameScreen> { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Spacer(flex: 1), + const Spacer(flex: 1), _buildScoreBox(PieceType.black, model), - Spacer(flex: 4), + const Spacer(flex: 4), _buildScoreBox(PieceType.white, model), - Spacer(flex: 1), + const Spacer(flex: 1), ], ); } @@ -197,11 +201,7 @@ class _GameScreenState extends State<GameScreen> { for (var x = 0; x < GameBoard.width; x++) { PieceType pieceType = model.board.getPieceAtLocation(x, y); String? assetImageCode = Styling.assetImageCodes[pieceType]; - String assetImageName = 'assets/skins/' + - model.skin + - '_tile_' + - (assetImageCode != null ? assetImageCode : 'empty') + - '.png'; + String assetImageName = 'assets/skins/${model.skin}_tile_${assetImageCode ?? 'empty'}.png'; Column cell = Column( children: [ @@ -212,7 +212,7 @@ class _GameScreenState extends State<GameScreen> { child: AnimatedSwitcher( duration: const Duration(milliseconds: 500), transitionBuilder: (Widget child, Animation<double> animation) { - return ScaleTransition(child: child, scale: animation); + return ScaleTransition(scale: animation, child: child); }, child: Image( image: AssetImage(assetImageName), @@ -237,7 +237,7 @@ class _GameScreenState extends State<GameScreen> { rows.add(TableRow(children: cells)); } - return Table(defaultColumnWidth: IntrinsicColumnWidth(), children: rows); + return Table(defaultColumnWidth: const IntrinsicColumnWidth(), children: rows); } Widget _buildThinkingIndicator(GameModel model) { @@ -254,7 +254,7 @@ class _GameScreenState extends State<GameScreen> { vertical: 5.0, horizontal: 15.0, ), - child: Image( + child: const Image( image: AssetImage('assets/icons/button_restart.png'), fit: BoxFit.fill, ), @@ -270,9 +270,9 @@ class _GameScreenState extends State<GameScreen> { ); return Container( - margin: EdgeInsets.all(2), - padding: EdgeInsets.all(2), - child: Table(defaultColumnWidth: IntrinsicColumnWidth(), children: [ + margin: const EdgeInsets.all(2), + padding: const EdgeInsets.all(2), + child: Table(defaultColumnWidth: const IntrinsicColumnWidth(), children: [ TableRow( children: [ Column(children: [decorationImage]), @@ -308,8 +308,8 @@ class _GameScreenState extends State<GameScreen> { width: 4, ), ), - margin: EdgeInsets.all(8), - child: Image( + margin: const EdgeInsets.all(8), + child: const Image( image: AssetImage('assets/icons/button_restart.png'), fit: BoxFit.fill, ), @@ -319,7 +319,7 @@ class _GameScreenState extends State<GameScreen> { ], ), body: Container( - padding: EdgeInsets.only( + padding: const EdgeInsets.only( top: 5.0, left: 5.0, right: 5.0, @@ -329,9 +329,9 @@ class _GameScreenState extends State<GameScreen> { child: Column( children: [ _buildScoreBoxes(model), - SizedBox(height: 5), + const SizedBox(height: 5), _buildGameBoardDisplay(context, model), - SizedBox(height: 5), + const SizedBox(height: 5), _buildThinkingIndicator(model), if (model.gameIsOver) _buildEndGameWidget(model), ], diff --git a/lib/styling.dart b/lib/styling.dart index 94ef6d29dd935ba08b317c535e751cd70d55b726..6372e69382566eaa5a48cc14e5a8be4f0bf4f7cf 100644 --- a/lib/styling.dart +++ b/lib/styling.dart @@ -54,7 +54,7 @@ abstract class Styling { ); static const activePlayerIndicator = BoxDecoration( - borderRadius: const BorderRadius.all(const Radius.circular(10.0)), + borderRadius: BorderRadius.all(Radius.circular(10.0)), border: Border( bottom: activePlayerIndicatorBorder, top: activePlayerIndicatorBorder, @@ -64,7 +64,7 @@ abstract class Styling { ); static const inactivePlayerIndicator = BoxDecoration( - borderRadius: const BorderRadius.all(const Radius.circular(10.0)), + borderRadius: BorderRadius.all(Radius.circular(10.0)), border: Border( bottom: inactivePlayerIndicatorBorder, top: inactivePlayerIndicatorBorder, diff --git a/lib/thinking_indicator.dart b/lib/thinking_indicator.dart index b4329fbce2ef78b5766bd02fad5ab8b34196c4f5..b64739c7614ab782772ee4580468d98128b4c4b1 100644 --- a/lib/thinking_indicator.dart +++ b/lib/thinking_indicator.dart @@ -12,14 +12,13 @@ class ThinkingIndicator extends ImplicitlyAnimatedWidget { final double height; final bool visible; - ThinkingIndicator({ + const ThinkingIndicator({ this.color = const Color(0xffffffff), this.height = 10.0, this.visible = true, - Key? key, + super.key, }) : super( duration: Styling.thinkingFadeDuration, - key: key, ); @override @@ -29,10 +28,6 @@ class ThinkingIndicator extends ImplicitlyAnimatedWidget { class _ThinkingIndicatorState extends AnimatedWidgetBaseState<ThinkingIndicator> { Tween<double>? _opacityTween; - @override - void dispose() { - super.dispose(); - } @override Widget build(BuildContext context) { @@ -69,8 +64,7 @@ class _AnimatedCircles extends StatefulWidget { const _AnimatedCircles({ required this.color, required this.height, - Key? key, - }) : super(key: key); + }); @override _AnimatedCirclesState createState() => _AnimatedCirclesState(); @@ -112,7 +106,7 @@ class _AnimatedCirclesState extends State<_AnimatedCircles> color: widget.color, width: 2.0, ), - borderRadius: BorderRadius.all(const Radius.circular(5.0)), + borderRadius: const BorderRadius.all(Radius.circular(5.0)), ), ); } diff --git a/pubspec.lock b/pubspec.lock index c5a3e12a5caef370e475706fa53cb592f670d83e..9c1fc4cc709e3e06d6e0cedfdcf31ed2a8a2b1bf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" file: dependency: transitive description: @@ -46,27 +46,43 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 + url: "https://pub.dev" + source: hosted + version: "3.0.1" flutter_web_plugins: dependency: transitive description: flutter source: sdk version: "0.0.0" + lints: + dependency: transitive + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" nested: dependency: transitive description: @@ -95,10 +111,10 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_windows: dependency: transitive description: @@ -111,18 +127,18 @@ packages: dependency: transitive description: name: platform - sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.8" provider: dependency: "direct main" description: @@ -151,10 +167,10 @@ packages: dependency: transitive description: name: shared_preferences_foundation - sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7" + sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" url: "https://pub.dev" source: hosted - version: "2.3.4" + version: "2.3.5" shared_preferences_linux: dependency: transitive description: @@ -167,10 +183,10 @@ packages: dependency: transitive description: name: shared_preferences_platform_interface - sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a + sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" shared_preferences_web: dependency: transitive description: @@ -204,26 +220,26 @@ packages: dependency: transitive description: name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05" url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.4.2" win32: dependency: transitive description: name: win32 - sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "5.2.0" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" sdks: - dart: ">=3.2.0 <4.0.0" + dart: ">=3.3.0-279.1.beta <4.0.0" flutter: ">=3.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index 011d38e997252d3f73378f1c37591e5e283853c3..9cf11d5eafecc1b61a81a7af7b8fba7ab26b1e3a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: simpler_reversi description: A reversi game application. publish_to: 'none' -version: 0.0.13+13 +version: 0.0.14+14 environment: sdk: '^3.0.0' @@ -13,6 +13,9 @@ dependencies: shared_preferences: ^2.2.1 async: ^2.11.0 +dev_dependencies: + flutter_lints: ^3.0.1 + flutter: uses-material-design: true assets: