Skip to content
Snippets Groups Projects
Commit ab2938f6 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '8-use-flutter-linter-and-apply-lints' into 'master'

Resolve "Use flutter linter and apply lints"

Closes #8

See merge request !5
parents afc71518 d8825b04
No related branches found
No related tags found
1 merge request!5Resolve "Use flutter linter and apply lints"
Pipeline #5119 passed
include: package:flutter_lints/flutter.yaml
......@@ -44,7 +44,7 @@ android {
defaultConfig {
applicationId "org.benoitharrault.midisynth"
minSdkVersion 16
minSdkVersion flutter.minSdkVersion
targetSdkVersion 30
versionCode appVersionCode.toInteger()
versionName appVersionName
......
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.5
app.versionCode=5
app.versionName=0.0.6
app.versionCode=6
Add automatic flutter linter. Apply code lints. Update dependencies.
Ajout d'un correcteur automatique de code. Application des corrections. Mise à jour des dépendances.
......@@ -2,15 +2,13 @@ import 'package:flutter/material.dart';
import 'package:midisynth/provider/data.dart';
class Board {
static Container buildGameBoard(Data myProvider, double screenWidth) {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(''),
],
),
static Widget buildGameBoard(Data myProvider, double screenWidth) {
return const Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(''),
],
);
}
}
......@@ -14,42 +14,40 @@ class Parameters {
static double buttonPadding = 0.0;
static double buttonMargin = 0.0;
static Container buildParametersSelector(Data myProvider) {
List<Widget> lines = [];
static Widget buildParametersSelector(Data myProvider) {
final List<Widget> lines = [];
List parameters = myProvider.availableParameters;
for (var index = 0; index < parameters.length; index++) {
final List<String> parameters = myProvider.availableParameters;
for (int index = 0; index < parameters.length; index++) {
lines.add(buildParameterSelector(myProvider, parameters[index]));
lines.add(SizedBox(height: separatorHeight));
}
Widget buttonsBlock = buildStartNewGameButton(myProvider);
final Widget buttonsBlock = buildStartNewGameButton(myProvider);
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: separatorHeight),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: lines,
),
),
SizedBox(height: separatorHeight),
Container(
child: buttonsBlock,
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: separatorHeight),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: lines,
),
],
),
),
SizedBox(height: separatorHeight),
Container(
child: buttonsBlock,
),
],
);
}
static Image buildImageWidget(String imageAssetCode) {
return Image(
image: AssetImage('assets/icons/' + imageAssetCode + '.png'),
image: AssetImage('assets/icons/$imageAssetCode.png'),
fit: BoxFit.fill,
);
}
......@@ -65,7 +63,7 @@ class Parameters {
children: [
TextButton(
child: buildImageContainerWidget('placeholder'),
onPressed: () => null,
onPressed: () {},
),
],
);
......@@ -76,7 +74,7 @@ class Parameters {
margin: EdgeInsets.all(blockMargin),
padding: EdgeInsets.all(blockPadding),
child: Table(
defaultColumnWidth: IntrinsicColumnWidth(),
defaultColumnWidth: const IntrinsicColumnWidth(),
children: [
TableRow(
children: [
......@@ -101,11 +99,11 @@ class Parameters {
List availableValues = myProvider.getParameterAvailableValues(parameterCode);
if (availableValues.length == 1) {
return SizedBox(height: 0.0);
return const SizedBox(height: 0.0);
}
return Table(
defaultColumnWidth: IntrinsicColumnWidth(),
defaultColumnWidth: const IntrinsicColumnWidth(),
children: [
TableRow(
children: [
......@@ -126,7 +124,7 @@ class Parameters {
String currentValue = myProvider.getParameterValue(parameterCode).toString();
bool isActive = (parameterValue == currentValue);
String imageAsset = parameterCode + '_' + parameterValue;
String imageAsset = '${parameterCode}_$parameterValue';
return TextButton(
child: Container(
......
......@@ -8,10 +8,12 @@ import 'package:overlay_support/overlay_support.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(),
},
),
);
......
......@@ -3,27 +3,30 @@ import 'package:shared_preferences/shared_preferences.dart';
class Data extends ChangeNotifier {
// Configuration available parameters
List _availableParameters = [];
final List<String> _availableParameters = [];
List get availableParameters => _availableParameters;
List<String> get availableParameters => _availableParameters;
// Application default configuration
// Application current configuration
String getParameterValue(String parameterCode) {
switch (parameterCode) {
//
}
return '';
}
List getParameterAvailableValues(String parameterCode) {
switch (parameterCode) {
//
}
return [];
}
void setParameterValue(String parameterCode, String parameterValue) async {
switch (parameterCode) {
//
}
final prefs = await SharedPreferences.getInstance();
prefs.setString(parameterCode, parameterValue);
......
......@@ -7,13 +7,15 @@ import 'package:provider/provider.dart';
import 'package:overlay_support/overlay_support.dart';
class Home extends StatefulWidget {
const Home({super.key});
static const String id = 'home';
@override
_HomeState createState() => _HomeState();
HomeState createState() => HomeState();
}
class _HomeState extends State<Home> {
class HomeState extends State<Home> {
@override
void initState() {
super.initState();
......@@ -21,13 +23,13 @@ class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
Data myProvider = Provider.of<Data>(context);
double screenWidth = MediaQuery.of(context).size.width;
final Data myProvider = Provider.of<Data>(context);
final double screenWidth = MediaQuery.of(context).size.width;
List<Widget> menuActions = [];
final List<Widget> menuActions = [];
if (myProvider.isGameRunning) {
menuActions = [
menuActions.add(
TextButton(
child: Container(
decoration: BoxDecoration(
......@@ -37,7 +39,7 @@ class _HomeState extends State<Home> {
width: 4,
),
),
child: Image(
child: const Image(
image: AssetImage('assets/icons/button_back.png'),
fit: BoxFit.fill,
),
......@@ -45,7 +47,7 @@ class _HomeState extends State<Home> {
onPressed: () => toast('Long press to quit game...'),
onLongPress: () => GameUtils.quitGame(myProvider),
),
];
);
}
return Scaffold(
......
......@@ -21,52 +21,68 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
ffi:
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:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "6.1.4"
version: "7.0.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"
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: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.11.0"
nested:
dependency: transitive
description:
......@@ -87,10 +103,10 @@ packages:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
path_provider_linux:
dependency: transitive
description:
......@@ -103,10 +119,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:
......@@ -119,34 +135,34 @@ packages:
dependency: transitive
description:
name: platform
sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
version: "3.1.4"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.6"
version: "2.1.8"
provider:
dependency: "direct main"
description:
name: provider
sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f
sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096"
url: "https://pub.dev"
source: hosted
version: "6.0.5"
version: "6.1.1"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: b7f41bad7e521d205998772545de63ff4e6c97714775902c199353f8bf1511ac
sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
version: "2.2.2"
shared_preferences_android:
dependency: transitive
description:
......@@ -159,42 +175,42 @@ 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:
name: shared_preferences_linux
sha256: c2eb5bf57a2fe9ad6988121609e47d3e07bb3bdca5b6f8444e4cf302428a128a
sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
version: "2.3.2"
shared_preferences_platform_interface:
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:
name: shared_preferences_web
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
version: "2.2.2"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: f763a101313bd3be87edffe0560037500967de9c394a714cd598d945517f694f
sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
version: "2.3.2"
sky_engine:
dependency: transitive
description: flutter
......@@ -212,26 +228,26 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05"
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.4.2"
win32:
dependency: transitive
description:
name: win32
sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3"
sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8"
url: "https://pub.dev"
source: hosted
version: "5.0.9"
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.1.0-185.0.dev <4.0.0"
flutter: ">=3.7.0"
dart: ">=3.3.0-279.1.beta <4.0.0"
flutter: ">=3.16.0"
name: midisynth
description: MIDI Synth
publish_to: 'none'
version: 1.0.0+1
version: 0.0.6+6
environment:
sdk: '^3.0.0'
......@@ -13,6 +13,9 @@ dependencies:
shared_preferences: ^2.2.1
overlay_support: ^2.1.0
dev_dependencies:
flutter_lints: ^3.0.1
flutter:
uses-material-design: true
assets:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment