diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46587b8..9d86f5d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,9 +6,9 @@ name: CI # events but only for the master branch on: push: - branches: [ master ] + branches: [ master, feature/null-safety ] pull_request: - branches: [ master ] + branches: [ master, feature/null-safety ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -20,7 +20,9 @@ jobs: # 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 + - uses: subosito/flutter-action@v1.4.0 + with: + channel: beta - name: Install Dependencies run: flutter packages get - name: Format diff --git a/CHANGELOG.md b/CHANGELOG.md index 213765d..9df067d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [2.0.0-nullsafety.1] - 28.03.2021 + +* Refactor code smells + +## [2.0.0-nullsafety.0] - 28.03.2021 + +* Sound null-safety + ## [1.3.0] - 15.11.2020 * Update dependencies diff --git a/LICENSE b/LICENSE index 2d752e3..e653f4a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Dimitrios Begnis +Copyright (c) 2021 Dimitrios Begnis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 504eda1..77cfa9a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The list will be scrolled to the end in the initial state and therefore scrollin Add the package to your pubspec.yaml: ```yaml - sticky_grouped_list: ^1.3.0 + sticky_grouped_list: ^2.0.0-nullsafety.1 ``` In your dart file, import the library: diff --git a/example/lib/chatExample.dart b/example/lib/chatExample.dart index b9427c8..e97e468 100644 --- a/example/lib/chatExample.dart +++ b/example/lib/chatExample.dart @@ -4,7 +4,7 @@ import 'package:sticky_grouped_list/sticky_grouped_list.dart'; void main() => runApp(MyApp()); -List _elements = [ +List _elements = [ Element(DateTime(2020, 6, 24, 9, 25), 'Hello how are you?'), Element(DateTime(2020, 6, 24, 9, 36), 'Fine and what about you?', true), Element(DateTime(2020, 6, 24, 9, 39), 'I am fine too'), @@ -60,7 +60,7 @@ class MyApp extends StatelessWidget { decoration: BoxDecoration( color: Colors.blue[300], border: Border.all( - color: Colors.blue[300], + color: Colors.blue[300]!, ), borderRadius: BorderRadius.all(Radius.circular(20.0)), ), diff --git a/example/lib/example.dart b/example/lib/example.dart index cbb00e6..b42406f 100644 --- a/example/lib/example.dart +++ b/example/lib/example.dart @@ -3,7 +3,7 @@ import 'package:sticky_grouped_list/sticky_grouped_list.dart'; void main() => runApp(MyApp()); -List _elements = [ +List _elements = [ Element(DateTime(2020, 6, 24, 18), 'Got to gym', Icons.fitness_center), Element(DateTime(2020, 6, 24, 9), 'Work', Icons.work), Element(DateTime(2020, 6, 25, 8), 'Buy groceries', Icons.shopping_basket), @@ -52,7 +52,7 @@ class MyApp extends StatelessWidget { decoration: BoxDecoration( color: Colors.blue[300], border: Border.all( - color: Colors.blue[300], + color: Colors.blue[300]!, ), borderRadius: BorderRadius.all(Radius.circular(20.0)), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index dbb9cfd..f57fcc1 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,49 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -66,35 +66,35 @@ packages: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "0.17.0" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" scrollable_positioned_list: dependency: transitive description: name: scrollable_positioned_list url: "https://pub.dartlang.org" source: hosted - version: "0.1.8" + version: "0.2.0-nullsafety.0" sky_engine: dependency: transitive description: flutter @@ -106,63 +106,63 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" sticky_grouped_list: dependency: "direct main" description: path: ".." relative: true source: path - version: "1.3.0" + version: "2.0.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.13.8" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c6214f2..bc7233e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,56 +1,18 @@ name: example description: A new Flutter package project. version: 0.0.1 -author: -homepage: +publish_to: 'none' environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: sdk: flutter sticky_grouped_list: path: ../ - intl: ^0.16.1 + intl: ^0.17.0 dev_dependencies: flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - - # To add assets to your package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # To add custom fonts to your package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages + sdk: flutter \ No newline at end of file diff --git a/lib/sticky_grouped_list.dart b/lib/sticky_grouped_list.dart index b96195c..dcbdf3f 100644 --- a/lib/sticky_grouped_list.dart +++ b/lib/sticky_grouped_list.dart @@ -10,7 +10,7 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; /// /// See [ScrollablePositionedList] class StickyGroupedListView extends StatefulWidget { - final Key key; + final Key? key; /// Items of which [itemBuilder] or [indexedItemBuilder] produce the list. final List elements; @@ -25,13 +25,13 @@ class StickyGroupedListView extends StatefulWidget { /// /// If not set groups will be sorted with their natural sorting order or their /// specific [Comparable] implementation. - final int Function(E value1, E value2) groupComparator; + final int Function(E value1, E value2)? groupComparator; /// Can be used to define a custom sorting for the elements inside each group. /// /// If not set elements will be sorted with their natural sorting order or /// their specific [Comparable] implementation. - final int Function(T element1, T element2) itemComparator; + final int Function(T element1, T element2)? itemComparator; /// Called to build group separators for each group. /// element is always the first element of the group. @@ -39,11 +39,11 @@ class StickyGroupedListView extends StatefulWidget { /// Called to build children for the list with /// 0 <= element < elements.length. - final Widget Function(BuildContext context, T element) itemBuilder; + final Widget Function(BuildContext context, T element)? itemBuilder; /// Called to build children for the list with /// 0 <= element, index < elements.length - final Widget Function(BuildContext context, T element, int index) + final Widget Function(BuildContext context, T element, int index)? indexedItemBuilder; /// Whether the sorting of the list is ascending or descending. @@ -62,10 +62,10 @@ class StickyGroupedListView extends StatefulWidget { final Color stickyHeaderBackgroundColor; /// Controller for jumping or scrolling to an item. - final GroupedItemScrollController itemScrollController; + final GroupedItemScrollController? itemScrollController; /// Notifier that reports the items laid out in the list after each frame. - final ItemPositionsListener itemPositionsListener; + final ItemPositionsListener? itemPositionsListener; /// The axis along which the scroll view scrolls. /// @@ -75,10 +75,10 @@ class StickyGroupedListView extends StatefulWidget { /// How the scroll view should respond to user input. /// /// See [ScrollView.physics]. - final ScrollPhysics physics; + final ScrollPhysics? physics; /// The amount of space by which to inset the children. - final EdgeInsetsGeometry padding; + final EdgeInsets? padding; /// Whether the view scrolls in the reading direction. /// @@ -109,12 +109,12 @@ class StickyGroupedListView extends StatefulWidget { /// scrolls, so using the [ScrollController.scrollTo] method may result /// in builds of widgets that would otherwise already be built in the /// cache extent. - final double minCacheExtent; + final double? minCacheExtent; /// The number of children that will contribute semantic information. /// /// See [ScrollView.semanticChildCount] for more information. - final int semanticChildCount; + final int? semanticChildCount; /// Index of an item to initially align within the viewport. final int initialScrollIndex; @@ -125,18 +125,18 @@ class StickyGroupedListView extends StatefulWidget { /// Creates a [StickyGroupedListView]. StickyGroupedListView({ - @required this.elements, - @required this.groupBy, - @required this.groupSeparatorBuilder, + this.key, + required this.elements, + required this.groupBy, + required this.groupSeparatorBuilder, this.groupComparator, this.itemBuilder, this.indexedItemBuilder, this.itemComparator, - this.order, + this.order = StickyGroupedListOrder.ASC, this.separator = const SizedBox.shrink(), this.floatingHeader = false, this.stickyHeaderBackgroundColor = const Color(0xffF7F7F7), - this.key, this.scrollDirection = Axis.vertical, this.itemScrollController, this.itemPositionsListener, @@ -150,7 +150,8 @@ class StickyGroupedListView extends StatefulWidget { this.semanticChildCount, this.initialAlignment = 0, this.initialScrollIndex = 0, - }) : super(key: key); + }) : assert(itemBuilder != null || indexedItemBuilder != null), + super(key: key); @override State createState() => _StickyGroupedListViewState(); @@ -159,16 +160,16 @@ class StickyGroupedListView extends StatefulWidget { class _StickyGroupedListViewState extends State> { StreamController _streamController = StreamController(); - ItemPositionsListener _listener; - GroupedItemScrollController _controller; - GlobalKey _groupHeaderKey; + late ItemPositionsListener _listener; + late GroupedItemScrollController _controller; + GlobalKey? _groupHeaderKey; List _sortedElements = []; GlobalKey _key = GlobalKey(); int _topElementIndex = 0; - RenderBox _headerBox; - RenderBox _listBox; - double _headerDimension; - bool Function(int) _isSeparator; + RenderBox? _headerBox; + RenderBox? _listBox; + double? _headerDimension; + bool Function(int)? _isSeparator; @override void initState() { @@ -223,7 +224,7 @@ class _StickyGroupedListViewState ); } - if (_isSeparator(index)) { + if (_isSeparator!(index)) { E curr = widget.groupBy(_sortedElements[actualIndex]); E prev = widget.groupBy( _sortedElements[actualIndex + (widget.reverse ? 1 : -1)]); @@ -239,7 +240,7 @@ class _StickyGroupedListViewState StreamBuilder( stream: _streamController.stream, initialData: _topElementIndex, - builder: (_, snapshot) => _showFixedGroupHeader(snapshot.data), + builder: (_, snapshot) => _showFixedGroupHeader(snapshot.data!), ) ], ); @@ -247,16 +248,17 @@ class _StickyGroupedListViewState Widget _buildItem(context, int actualIndex) { return widget.indexedItemBuilder == null - ? widget.itemBuilder(context, _sortedElements[actualIndex]) - : widget.indexedItemBuilder( + ? widget.itemBuilder!(context, _sortedElements[actualIndex]) + : widget.indexedItemBuilder!( context, _sortedElements[actualIndex], actualIndex); } _positionListener() { - _headerBox ??= _groupHeaderKey?.currentContext?.findRenderObject(); - double headerHeight = _headerBox?.size?.height ?? 0; - _listBox ??= _key?.currentContext?.findRenderObject(); - double height = _listBox?.size?.height ?? 0; + _headerBox ??= + _groupHeaderKey?.currentContext?.findRenderObject() as RenderBox?; + double headerHeight = _headerBox?.size.height ?? 0; + _listBox ??= _key.currentContext?.findRenderObject() as RenderBox?; + double height = _listBox?.size.height ?? 0; _headerDimension = headerHeight / height; ItemPosition reducePositions(ItemPosition pos, ItemPosition current) { @@ -268,11 +270,11 @@ class _StickyGroupedListViewState ItemPosition currentItem = _listener.itemPositions.value .where((ItemPosition position) => - !_isSeparator(position.index) && - position.itemTrailingEdge > _headerDimension) + !_isSeparator!(position.index) && + position.itemTrailingEdge > _headerDimension!) .reduce(reducePositions); - int index = (currentItem?.index ?? 0) ~/ 2; + int index = currentItem.index ~/ 2; if (_topElementIndex != index) { E curr = widget.groupBy(_sortedElements[index]); E prev = widget.groupBy(_sortedElements[_topElementIndex]); @@ -291,7 +293,7 @@ class _StickyGroupedListViewState // compare groups if (widget.groupComparator != null) { compareResult = - widget.groupComparator(widget.groupBy(e1), widget.groupBy(e2)); + widget.groupComparator!(widget.groupBy(e1), widget.groupBy(e2)); } else if (widget.groupBy(e1) is Comparable) { compareResult = (widget.groupBy(e1) as Comparable) .compareTo(widget.groupBy(e2) as Comparable); @@ -299,7 +301,7 @@ class _StickyGroupedListViewState // compare elements inside group if ((compareResult == null || compareResult == 0)) { if (widget.itemComparator != null) { - compareResult = widget.itemComparator(e1, e2); + compareResult = widget.itemComparator!(e1, e2); } else if (e1 is Comparable) { compareResult = e1.compareTo(e2); } @@ -332,7 +334,7 @@ class _StickyGroupedListViewState /// /// See [ItemScrollController]. class GroupedItemScrollController extends ItemScrollController { - _StickyGroupedListViewState _stickyGroupedListViewState; + _StickyGroupedListViewState? _stickyGroupedListViewState; /// Jumps to the element at [index]. The element will be placed under the /// group header. @@ -341,7 +343,7 @@ class GroupedItemScrollController extends ItemScrollController { /// See [ItemScrollController.jumpTo] @override void jumpTo( - {@required int index, + {required int index, double alignment = 0, bool automaticAlignment = true}) { if (automaticAlignment) { @@ -356,20 +358,24 @@ class GroupedItemScrollController extends ItemScrollController { /// /// See [ItemScrollController.scrollTo] @override - Future scrollTo( - {@required int index, - double alignment = 0, - bool automaticAlignment = true, - @required Duration duration, - Curve curve = Curves.linear}) { + Future scrollTo({ + required int index, + double alignment = 0, + bool automaticAlignment = true, + required Duration duration, + Curve curve = Curves.linear, + List opacityAnimationWeights = const [40, 20, 40], + }) { if (automaticAlignment) { alignment = _stickyGroupedListViewState?._headerDimension ?? alignment; } return super.scrollTo( - index: index * 2 + 1, - alignment: alignment, - duration: duration, - curve: curve); + index: index * 2 + 1, + alignment: alignment, + duration: duration, + curve: curve, + opacityAnimationWeights: opacityAnimationWeights, + ); } void _bind(_StickyGroupedListViewState stickyGroupedListViewState) { diff --git a/pubspec.lock b/pubspec.lock index 3825d94..623daa7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -66,28 +66,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" scrollable_positioned_list: dependency: "direct main" description: name: scrollable_positioned_list url: "https://pub.dartlang.org" source: hosted - version: "0.1.8" + version: "0.2.0-nullsafety.0" sky_engine: dependency: transitive description: flutter @@ -99,56 +99,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.13.8" diff --git a/pubspec.yaml b/pubspec.yaml index 3efb11e..a3ced0d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,54 +1,17 @@ name: sticky_grouped_list description: A ScrollablePositionedList where the list items can be grouped into sections. -version: 1.3.0 +version: 2.0.0-nullsafety.1 homepage: https://begnis.dev repository: https://github.com/Dimibe/sticky_grouped_list environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: sdk: flutter - scrollable_positioned_list: ^0.1.8 + scrollable_positioned_list: ^0.2.0-nullsafety.0 dev_dependencies: flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - - # To add assets to your package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # To add custom fonts to your package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages + sdk: flutter \ No newline at end of file diff --git a/test/sticky_grouped_list_test.dart b/test/sticky_grouped_list_test.dart index d3059d9..2a17057 100644 --- a/test/sticky_grouped_list_test.dart +++ b/test/sticky_grouped_list_test.dart @@ -21,11 +21,11 @@ void main() { MaterialApp( home: Scaffold( body: StickyGroupedListView( - groupBy: (element) => element['group'], + groupBy: (dynamic element) => element['group'], elements: _elements, order: StickyGroupedListOrder.DESC, groupSeparatorBuilder: _buildGroupSeperator, - itemBuilder: (context, element) => Text(element['name']), + itemBuilder: (context, dynamic element) => Text(element['name']), ), ), ), @@ -43,10 +43,10 @@ void main() { MaterialApp( home: Scaffold( body: StickyGroupedListView( - groupBy: (element) => element['group'], + groupBy: (dynamic element) => element['group'], elements: [], groupSeparatorBuilder: _buildGroupSeperator, - itemBuilder: (context, element) => Text(element['name']), + itemBuilder: (context, dynamic element) => Text(element['name']), ), ), ), @@ -59,10 +59,10 @@ void main() { MaterialApp( home: Scaffold( body: StickyGroupedListView( - groupBy: (element) => element['group'], + groupBy: (dynamic element) => element['group'], elements: _elements, groupSeparatorBuilder: _buildGroupSeperator, - itemBuilder: (context, element) => Text(element['name']), + itemBuilder: (context, dynamic element) => Text(element['name']), ), ), ),