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/app/build.gradle b/android/app/build.gradle index caa7866cbbce11271117795c936cc1b9c8015307..60323870b28eb43625256b9bc833e7649787d705 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -44,7 +44,7 @@ android { defaultConfig { applicationId "org.benoitharrault.petitbac" - minSdkVersion 16 + minSdkVersion flutter.minSdkVersion targetSdkVersion 30 versionCode appVersionCode.toInteger() versionName appVersionName diff --git a/android/gradle.properties b/android/gradle.properties index c898cbca85872ae08129d735bfddbbd5fe7f7eab..beb884dd1a9ac22c41e12aff9ebde505d52b2f53 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=1.2.24 -app.versionCode=30 +app.versionName=1.2.25 +app.versionCode=31 diff --git a/fastlane/metadata/android/en-US/changelogs/31.txt b/fastlane/metadata/android/en-US/changelogs/31.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ab11150150fc75a46c9acc317890208e5a120b9 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/31.txt @@ -0,0 +1 @@ +Add automatic flutter linter. Apply code lints. Update dependencies. diff --git a/fastlane/metadata/android/fr-FR/changelogs/31.txt b/fastlane/metadata/android/fr-FR/changelogs/31.txt new file mode 100644 index 0000000000000000000000000000000000000000..609f5cf6e95a8df0799865df2e1ebde8fa981e5a --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/31.txt @@ -0,0 +1 @@ +Ajout d'un correcteur automatique de code. Application des corrections. Mise à jour des dépendances. diff --git a/lib/main.dart b/lib/main.dart index eeded49d3a6bacdbc3c0985afba439c48505d709..e88a410255154b5ab92333941b78d5e1e0160e9a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -8,10 +8,12 @@ import 'screens/home.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]) - .then((value) => runApp(MyApp())); + .then((value) => runApp(const MyApp())); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + @override Widget build(BuildContext context) { return ChangeNotifierProvider( @@ -24,9 +26,9 @@ class MyApp extends StatelessWidget { primaryColor: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), - home: Home(), + home: const Home(), routes: { - Home.id: (context) => Home(), + Home.id: (context) => const Home(), }, ); }, diff --git a/lib/provider/data.dart b/lib/provider/data.dart index 6cec524ab5c858698f6d20ae81bfe98d4e64e31b..ebbe39723ff511713c8a73eb83a8e2107a873fa4 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -11,8 +11,8 @@ class Data extends ChangeNotifier { final int _recentCategoriesCount = 15; final int _recentLettersCount = 10; - List _recentCategories = []; - List _recentLetters = []; + List<String> _recentCategories = []; + List<String> _recentLetters = []; bool get searchingCategory => _searchingCategory; void setSearchingCategory(bool value) { diff --git a/lib/screens/home.dart b/lib/screens/home.dart index a54a0a8903dd9d560cf204e7ea5606c42e3f4096..1621dc93d0fbf7f3f3581fe1f94f48b6c9e4024a 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -8,6 +8,8 @@ import '../utils/random_pick_category.dart'; import '../utils/random_pick_letter.dart'; class Home extends StatelessWidget { + const Home({super.key}); + static const String id = 'home'; static Timer? _timer; @@ -22,13 +24,13 @@ class Home extends StatelessWidget { } Future<void> startTimer(Data myProvider) async { - const oneSec = const Duration(seconds: 1); + const oneSec = Duration(seconds: 1); if (_timer != null) { dispose(); } _countdownStart = 10; myProvider.updateCountdown(_countdownStart); - _timer = new Timer.periodic( + _timer = Timer.periodic( oneSec, (Timer timer) { if (_countdownStart < 0) { @@ -84,8 +86,11 @@ class Home extends StatelessWidget { } Container mainLetterButtonContainer( - Data myProvider, Color backgroundColor, double borderWidth) { - Color borderColor = darken(backgroundColor); + Data myProvider, + Color backgroundColor, + double borderWidth, + ) { + final Color borderColor = darken(backgroundColor); return Container( margin: EdgeInsets.all(borderWidth), @@ -102,7 +107,7 @@ class Home extends StatelessWidget { onPressed: () => pickLetter(myProvider), child: Text( myProvider.letter == '' ? "🔀" : myProvider.letter, - style: TextStyle( + style: const TextStyle( fontSize: 40, fontWeight: FontWeight.w600, color: Colors.black, @@ -113,13 +118,13 @@ class Home extends StatelessWidget { } Container previousLetterBlockContainer(Data myProvider, int position, bool displayed) { - double spacingWidth = 2; - double borderWidth = 3; + const double spacingWidth = 2; + const double borderWidth = 3; Color backgroundColor = Colors.grey; Color borderColor = darken(backgroundColor); Color fontColor = Colors.black; - String letter = myProvider.recentlyPickedLetter(position); + final String letter = myProvider.recentlyPickedLetter(position); if (letter == '' || displayed == false) { backgroundColor = Colors.white; @@ -128,8 +133,8 @@ class Home extends StatelessWidget { } return Container( - margin: EdgeInsets.all(spacingWidth), - padding: EdgeInsets.all(spacingWidth), + margin: const EdgeInsets.all(spacingWidth), + padding: const EdgeInsets.all(spacingWidth), decoration: BoxDecoration( color: backgroundColor, borderRadius: BorderRadius.circular(borderWidth), @@ -139,7 +144,7 @@ class Home extends StatelessWidget { ), ), child: Text( - ' ' + letter + ' ', + ' $letter ', style: TextStyle( fontSize: 35.0 - (7 * position), fontWeight: FontWeight.w600, @@ -150,10 +155,13 @@ class Home extends StatelessWidget { } Container _buildPickedLetterContainer( - Data myProvider, Color backgroundColor, double borderWidth) { - int previousLettersCountToShow = 3; + Data myProvider, + Color backgroundColor, + double borderWidth, + ) { + const int previousLettersCountToShow = 3; - List<Widget> cells = []; + final List<Widget> cells = []; // Add previous letters blocks for (var i = 0; i < previousLettersCountToShow; i++) { @@ -178,10 +186,10 @@ class Home extends StatelessWidget { } return Container( - margin: EdgeInsets.all(2), - padding: EdgeInsets.all(2), + margin: const EdgeInsets.all(2), + padding: const EdgeInsets.all(2), child: Table( - defaultColumnWidth: IntrinsicColumnWidth(), + defaultColumnWidth: const IntrinsicColumnWidth(), children: [ TableRow(children: cells), ], @@ -189,105 +197,107 @@ class Home extends StatelessWidget { ); } - Container _buildPickedCategoryContainer( - Data myProvider, Color backgroundColor, double borderWidth) { - Color borderColor = darken(backgroundColor); + Widget _buildPickedCategoryContainer( + Data myProvider, + Color backgroundColor, + double borderWidth, + ) { + final Color borderColor = darken(backgroundColor); - return Container( - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.all(borderWidth), - padding: EdgeInsets.all(borderWidth), - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: BorderRadius.circular(borderWidth), - border: Border.all( - color: borderColor, - width: borderWidth, - ), + return Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.all(borderWidth), + padding: EdgeInsets.all(borderWidth), + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: BorderRadius.circular(borderWidth), + border: Border.all( + color: borderColor, + width: borderWidth, ), - child: TextButton( - onPressed: () => pickCategory(myProvider), - child: Text( - myProvider.category == '' ? "🔀" : myProvider.category, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.w600, - color: Colors.black, - ), + ), + child: TextButton( + onPressed: () => pickCategory(myProvider), + child: Text( + myProvider.category == '' ? "🔀" : myProvider.category, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 30, + fontWeight: FontWeight.w600, + color: Colors.black, ), ), ), - ], - ), + ), + ], ); } - Container _buildMiniGameContainer( - Data myProvider, Color backgroundColor, double borderWidth) { - Color borderColor = darken(backgroundColor); + Widget _buildMiniGameContainer( + Data myProvider, + Color backgroundColor, + double borderWidth, + ) { + final Color borderColor = darken(backgroundColor); Color countDownColor = Colors.black; if (myProvider.countdown == 0) { countDownColor = Colors.red; } - return Container( - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.all(borderWidth), - padding: EdgeInsets.all(borderWidth), - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: BorderRadius.circular(borderWidth), - border: Border.all( - color: borderColor, - width: borderWidth, - ), + return Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.all(borderWidth), + padding: EdgeInsets.all(borderWidth), + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: BorderRadius.circular(borderWidth), + border: Border.all( + color: borderColor, + width: borderWidth, ), - child: TextButton( - onPressed: (myProvider.countdown >= 0) ? null : () => startMiniGame(myProvider), - child: Text( - (myProvider.countdown >= 0) ? myProvider.countdown.toString() : '🎲', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 50, - fontWeight: FontWeight.w600, - color: countDownColor, - ), + ), + child: TextButton( + onPressed: (myProvider.countdown >= 0) ? null : () => startMiniGame(myProvider), + child: Text( + (myProvider.countdown >= 0) ? myProvider.countdown.toString() : '🎲', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 50, + fontWeight: FontWeight.w600, + color: countDownColor, ), ), ), - ], - ), + ), + ], ); } @override Widget build(BuildContext context) { - Data _myProvider = Provider.of<Data>(context); - double borderWidth = 8; + final Data myProvider = Provider.of<Data>(context); + const double borderWidth = 8; return Scaffold( appBar: AppBar( - title: Text('Petit bac'), + title: const Text('Petit bac'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ - _buildPickedLetterContainer(_myProvider, Colors.orange, borderWidth), - SizedBox(height: 5), - _buildMiniGameContainer(_myProvider, Colors.blue, borderWidth), - SizedBox(height: 5), - _buildPickedCategoryContainer(_myProvider, Colors.green, borderWidth), + _buildPickedLetterContainer(myProvider, Colors.orange, borderWidth), + const SizedBox(height: 5), + _buildMiniGameContainer(myProvider, Colors.blue, borderWidth), + const SizedBox(height: 5), + _buildPickedCategoryContainer(myProvider, Colors.green, borderWidth), ], ), ), diff --git a/pubspec.lock b/pubspec.lock index d6c8af1258d48abed9fd1fa0287e7098c886d2fc..4abc6fe4745a68c7a413405f1ddfd8cad617a2bb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,31 +13,47 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" flutter: dependency: "direct main" 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" + 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: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.11.0" nested: dependency: transitive description: @@ -50,10 +66,10 @@ packages: dependency: "direct main" description: name: provider - sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" url: "https://pub.dev" source: hosted - version: "6.0.5" + version: "6.1.1" sky_engine: dependency: transitive description: flutter @@ -67,14 +83,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: - dependency: transitive - description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 - url: "https://pub.dev" - source: hosted - version: "0.1.4-beta" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" + dart: ">=3.2.0-0 <4.0.0" flutter: ">=1.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index d93afcbaa667c8f3e6347f4620e5748a43ff2714..69892205c350174f7328740a70d1485f8e3642f2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: petitbac description: A PetitBac game application. publish_to: 'none' -version: 1.0.0+1 +version: 1.2.25+31 environment: sdk: '^3.0.0' @@ -11,6 +11,9 @@ dependencies: sdk: flutter provider: ^6.0.5 +dev_dependencies: + flutter_lints: ^3.0.1 + flutter: uses-material-design: true assets: