diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..46587b8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,31 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v1.3.0 + - name: Install Dependencies + run: flutter packages get + - name: Format + run: flutter format --set-exit-if-changed lib test + - name: Analyze + run: flutter analyze lib test + - name: Run tests + run: flutter test --no-pub --coverage --test-randomize-ordering-seed random diff --git a/README.md b/README.md index 6e2a2ef..4dfa8ff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ + # Sticky grouped list package for Flutter. +[![Pub](https://img.shields.io/pub/v/sticky_grouped_list.svg)](https://pub.dev/packages/sticky_grouped_list) +![CI](https://github.com/Dimibe/sticky_grouped_list/workflows/CI/badge.svg?branch=master) A ListView with sticky headers in which list items can be grouped to sections. Based on [scrollable_positioned_list](https://pub.dev/packages/scrollable_positioned_list). diff --git a/test/sticky_grouped_list_test.dart b/test/sticky_grouped_list_test.dart index ae59fd1..d3059d9 100644 --- a/test/sticky_grouped_list_test.dart +++ b/test/sticky_grouped_list_test.dart @@ -3,17 +3,16 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:sticky_grouped_list/sticky_grouped_list.dart'; - final List _elements = [ {'name': 'John', 'group': 'Team A'}, //{'name': 'Will', 'group': 'Team B'}, - // {'name': 'Beth', 'group': 'Team A'}, + // {'name': 'Beth', 'group': 'Team A'}, {'name': 'Miranda', 'group': 'Team B'}, - // {'name': 'Mike', 'group': 'Team C'}, - {'name': 'Danny', 'group': 'Team C'}, + // {'name': 'Mike', 'group': 'Team C'}, + {'name': 'Danny', 'group': 'Team C'}, ]; void main() { -Widget _buildGroupSeperator(dynamic element) { + Widget _buildGroupSeperator(dynamic element) { return Text(element['group']); } @@ -24,7 +23,7 @@ Widget _buildGroupSeperator(dynamic element) { body: StickyGroupedListView( groupBy: (element) => element['group'], elements: _elements, - order:StickyGroupedListOrder.DESC, + order: StickyGroupedListOrder.DESC, groupSeparatorBuilder: _buildGroupSeperator, itemBuilder: (context, element) => Text(element['name']), ), @@ -54,7 +53,8 @@ Widget _buildGroupSeperator(dynamic element) { ); }); - testWidgets('finds only one group separator per group', (WidgetTester tester) async { + testWidgets('finds only one group separator per group', + (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold(