Flutter format is removed, now dart format (#168)
It was removed in 3.12: https://github.com/flutter/flutter/pull/129360 This updates the README and our CI job.
This commit is contained in:
parent
13b75cdbb4
commit
cc0ee7cbc2
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
DIRS="lib test"
|
|
||||||
EXIT=0
|
|
||||||
|
|
||||||
for DIR in $DIRS; do
|
|
||||||
OUT="$(flutter format -l 120 --suppress-analytics "$DIR" | sed -e "s/^Formatted \(.*\)/::error file=$DIR\/\1::Not formatted/g")"
|
|
||||||
echo "$OUT" | grep "::error" && EXIT=1
|
|
||||||
done
|
|
||||||
|
|
||||||
exit $EXIT
|
|
|
@ -23,5 +23,5 @@ jobs:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: flutter format
|
- name: Check formating
|
||||||
run: $GITHUB_WORKSPACE/.github/workflows/flutterfmt.sh
|
run: dart format -l120 lib/ --set-exit-if-changed --suppress-analytics --output none
|
|
@ -32,13 +32,16 @@ If you are having issues with iOS pods, try blowing it all away! `cd ios && rm -
|
||||||
|
|
||||||
# Formatting
|
# Formatting
|
||||||
|
|
||||||
`flutter format` can be used to format the code in `lib` and `test` but it's default is 80 char line limit, it's 2020
|
`dart format` can be used to format the code in `lib` and `test`. We use a line-length of 120 characters.
|
||||||
|
|
||||||
Use:
|
Use:
|
||||||
```sh
|
```sh
|
||||||
flutter format lib/ test/ -l 120
|
dart format lib/ test/ -l 120
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In Android Studio, set the line length using Preferences -> Editor -> Code Style -> Dart -> Line length, set it to 120. Enable auto-format with Preferences -> Languages & Frameworks -> Flutter -> Format code on save.
|
||||||
|
|
||||||
|
|
||||||
# Release
|
# Release
|
||||||
|
|
||||||
Update `version` in `pubspec.yaml` to reflect this release, then
|
Update `version` in `pubspec.yaml` to reflect this release, then
|
||||||
|
|
|
@ -85,44 +85,44 @@ class _AppState extends State<App> {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: brightness == Brightness.light ? lightTheme : darkTheme,
|
theme: brightness == Brightness.light ? lightTheme : darkTheme,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: PlatformProvider(
|
body: PlatformProvider(
|
||||||
//initialPlatform: initialPlatform,
|
//initialPlatform: initialPlatform,
|
||||||
builder: (context) => PlatformApp(
|
builder: (context) => PlatformApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
|
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
|
||||||
DefaultMaterialLocalizations.delegate,
|
DefaultMaterialLocalizations.delegate,
|
||||||
DefaultWidgetsLocalizations.delegate,
|
DefaultWidgetsLocalizations.delegate,
|
||||||
DefaultCupertinoLocalizations.delegate,
|
DefaultCupertinoLocalizations.delegate,
|
||||||
],
|
],
|
||||||
title: 'Nebula',
|
title: 'Nebula',
|
||||||
material: (_, __) {
|
material: (_, __) {
|
||||||
return new MaterialAppData(
|
return new MaterialAppData(
|
||||||
themeMode: brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark,
|
themeMode: brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark,
|
||||||
);
|
|
||||||
},
|
|
||||||
cupertino: (_, __) => CupertinoAppData(
|
|
||||||
theme: CupertinoThemeData(brightness: brightness),
|
|
||||||
),
|
|
||||||
onGenerateRoute: (settings) {
|
|
||||||
if (settings.name == '/') {
|
|
||||||
return platformPageRoute(context: context, builder: (context) => MainScreen(this.dnEnrolled));
|
|
||||||
}
|
|
||||||
|
|
||||||
final uri = Uri.parse(settings.name!);
|
|
||||||
if (uri.path == EnrollmentScreen.routeName) {
|
|
||||||
// TODO: maybe implement this as a dialog instead of a page, you can stack multiple enrollment screens which is annoying in dev
|
|
||||||
return platformPageRoute(
|
|
||||||
context: context,
|
|
||||||
builder: (context) =>
|
|
||||||
EnrollmentScreen(code: EnrollmentScreen.parseCode(settings.name!), stream: this.dnEnrolled),
|
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
cupertino: (_, __) => CupertinoAppData(
|
||||||
|
theme: CupertinoThemeData(brightness: brightness),
|
||||||
|
),
|
||||||
|
onGenerateRoute: (settings) {
|
||||||
|
if (settings.name == '/') {
|
||||||
|
return platformPageRoute(context: context, builder: (context) => MainScreen(this.dnEnrolled));
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
final uri = Uri.parse(settings.name!);
|
||||||
},
|
if (uri.path == EnrollmentScreen.routeName) {
|
||||||
|
// TODO: maybe implement this as a dialog instead of a page, you can stack multiple enrollment screens which is annoying in dev
|
||||||
|
return platformPageRoute(
|
||||||
|
context: context,
|
||||||
|
builder: (context) =>
|
||||||
|
EnrollmentScreen(code: EnrollmentScreen.parseCode(settings.name!), stream: this.dnEnrolled),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue