diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..dc01b9e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +charset = utf-8 +end_of_line = crlf +indent_size = 4 +indent_style = space +insert_final_newline = false +max_line_length = 100 +tab_width = 4 + +[*.dart] +max_line_length = 120 + +[*.yaml] +indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fa47f93..fdd79aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ name: CI -on: [push] +on: [push, pull_request] jobs: build: @@ -20,6 +20,9 @@ jobs: - run: flutter config --enable-web - run: flutter pub get + - name: Project format check + run: flutter format -l 120 -n . + - name: Flutter unit test run: flutter test --coverage --coverage-path=lcov.info diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c464379 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "[dart]": { + "editor.formatOnSave": true, + "editor.formatOnType": true, + "editor.rulers": [ + 80 + ], + "editor.selectionHighlight": false, + "editor.suggest.snippetsPreventQuickSuggestions": false, + "editor.suggestSelection": "first", + "editor.tabCompletion": "onlySnippets", + "editor.wordBasedSuggestions": false + }, + "dart.lineLength": 120 +} \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..a43eb34 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,5 @@ +linter: + # TODO: add more rules + rules: + - avoid_empty_else + # - lines_longer_than_80_chars # not yet tested \ No newline at end of file diff --git a/example/.gitignore b/example/.gitignore index 8487566..5f6d825 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -27,6 +27,7 @@ .pub-cache/ .pub/ build/ +.flutter-plugins-dependencies # Android related **/android/**/gradle-wrapper.jar diff --git a/example/lib/main.dart b/example/lib/main.dart index 494f7b9..4ce912a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -83,8 +83,7 @@ class _NavigationTiles extends StatelessWidget { ListTile( title: Text("Star On GitHub"), onTap: () { - Navigator.of(context).push( - MaterialPageRoute(builder: (context) => PageWithIme())); + Navigator.of(context).push(MaterialPageRoute(builder: (context) => PageWithIme())); }, ) ], diff --git a/test/overlay_support_test.dart b/test/overlay_support_test.dart index 217c66c..52dfb32 100644 --- a/test/overlay_support_test.dart +++ b/test/overlay_support_test.dart @@ -70,8 +70,7 @@ void main() { await tester.pumpWidget(_FakeOverlay(child: Builder(builder: (context) { return FlatButton( onPressed: () { - entry = - showSimpleNotification(Text('message'), autoDismiss: false); + entry = showSimpleNotification(Text('message'), autoDismiss: false); }, child: Text('notification')); }))); @@ -95,8 +94,7 @@ void main() { await tester.pumpWidget(_FakeOverlay(child: Builder(builder: (context) { return FlatButton( onPressed: () { - final entry = - showSimpleNotification(Text('message'), autoDismiss: false); + final entry = showSimpleNotification(Text('message'), autoDismiss: false); //dismiss immediately entry.dismiss(); }, @@ -163,14 +161,12 @@ void main() { children: [ FlatButton( onPressed: () { - showSimpleNotification(Text('message'), - autoDismiss: false, key: ValueKey('hello')); + showSimpleNotification(Text('message'), autoDismiss: false, key: ValueKey('hello')); }, child: Text('notification')), FlatButton( onPressed: () { - showSimpleNotification(Text('message2'), - autoDismiss: false, key: ValueKey('hello')); + showSimpleNotification(Text('message2'), autoDismiss: false, key: ValueKey('hello')); }, child: Text('notification2')), ], @@ -203,14 +199,12 @@ void main() { children: [ FlatButton( onPressed: () { - showSimpleNotification(Text('message'), - autoDismiss: false, key: ModalKey('hello')); + showSimpleNotification(Text('message'), autoDismiss: false, key: ModalKey('hello')); }, child: Text('notification')), FlatButton( onPressed: () { - showSimpleNotification(Text('message2'), - autoDismiss: false, key: ModalKey('hello')); + showSimpleNotification(Text('message2'), autoDismiss: false, key: ModalKey('hello')); }, child: Text('notification2')), ], @@ -237,8 +231,7 @@ void main() { await tester.pumpWidget(_FakeOverlay(child: Builder(builder: (context) { return FlatButton( onPressed: () { - showSimpleNotification(Text('message'), - trailing: Builder(builder: (context) { + showSimpleNotification(Text('message'), trailing: Builder(builder: (context) { return FlatButton( onPressed: () { entry = OverlaySupportEntry.of(context); @@ -265,8 +258,7 @@ void main() { await tester.pumpWidget(_FakeOverlay(child: Builder(builder: (context) { return FlatButton( onPressed: () { - entry = - showSimpleNotification(Text('message'), autoDismiss: true); + entry = showSimpleNotification(Text('message'), autoDismiss: true); }, child: Text('notification')); })));