From b92d5adae00a0a7b216df8ea9a0b63204380d45b Mon Sep 17 00:00:00 2001 From: Gustavo Cesar Date: Wed, 5 Oct 2022 12:21:29 -0300 Subject: [PATCH 1/5] feat: Updating the scrollable_positioned_list --- .gitignore | 4 +++- pubspec.lock | 61 +++++++++++++++++++++++----------------------------- pubspec.yaml | 2 +- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index 1985397..8c1e8e3 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ @@ -72,3 +72,5 @@ build/ !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 + +.fvm/ \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 1cb79b0..e909f90 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,51 +5,51 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" clock: dependency: transitive description: name: clock - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" flutter: dependency: "direct main" description: flutter @@ -64,35 +64,35 @@ packages: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.7.0" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" scrollable_positioned_list: dependency: "direct main" description: name: scrollable_positioned_list - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.2.3" sky_engine: @@ -104,58 +104,51 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.4.8" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.0" + version: "0.4.9" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=1.13.8" diff --git a/pubspec.yaml b/pubspec.yaml index d725b1b..4e8e0fc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ dependencies: flutter: sdk: flutter # https://pub.flutter-io.cn/packages/scrollable_positioned_list - scrollable_positioned_list: ^0.2.3 + scrollable_positioned_list: ^0.3.2 dev_dependencies: flutter_test: From 392980e2dd958c299904b1d1b1dda74e9193cbce Mon Sep 17 00:00:00 2001 From: Gustavo Cesar Date: Wed, 5 Oct 2022 12:21:42 -0300 Subject: [PATCH 2/5] feat: Adding option to index builder --- lib/src/az_listview.dart | 5 +++++ lib/src/index_bar.dart | 13 +++++++++---- lib/src/suspension_view.dart | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/src/az_listview.dart b/lib/src/az_listview.dart index 9175002..f04f48f 100644 --- a/lib/src/az_listview.dart +++ b/lib/src/az_listview.dart @@ -28,6 +28,7 @@ class AzListView extends StatefulWidget { this.indexBarAlignment = Alignment.centerRight, this.indexBarMargin, this.indexBarOptions = const IndexBarOptions(), + this.indexBuilder, }) : super(key: key); /// with ISuspensionBean Data @@ -93,6 +94,9 @@ class AzListView extends StatefulWidget { /// IndexBar options. final IndexBarOptions indexBarOptions; + /// The builder of index. + final IndexWidgetBuilder? indexBuilder; + @override _AzListViewState createState() => _AzListViewState(); } @@ -206,6 +210,7 @@ class _AzListViewState extends State { indexBarDragListener: dragListener, options: widget.indexBarOptions, controller: indexBarController, + builder: widget.indexBuilder, ), ), ], diff --git a/lib/src/index_bar.dart b/lib/src/index_bar.dart index f93251e..af730df 100644 --- a/lib/src/index_bar.dart +++ b/lib/src/index_bar.dart @@ -8,6 +8,7 @@ import 'package:flutter/services.dart'; /// IndexHintBuilder. typedef IndexHintBuilder = Widget Function(BuildContext context, String tag); +typedef IndexWidgetBuilder = Widget Function(BuildContext context, int index); /// IndexBarDragListener. abstract class IndexBarDragListener { @@ -234,6 +235,7 @@ class IndexBar extends StatefulWidget { IndexBarDragListener? indexBarDragListener, this.options = const IndexBarOptions(), this.controller, + this.builder, }) : indexBarDragNotifier = indexBarDragListener as IndexBarDragNotifier?, super(key: key); @@ -264,6 +266,9 @@ class IndexBar extends StatefulWidget { /// IndexBarController. If non-null, this can be used to control the state of the IndexBar. final IndexBarController? controller; + /// The builder of index. + final IndexWidgetBuilder? builder; + @override _IndexBarState createState() => _IndexBarState(); } @@ -280,7 +285,7 @@ class _IndexBarState extends State { @override void initState() { super.initState(); - widget.indexBarDragNotifier?.dragDetails?.addListener(_valueChanged); + widget.indexBarDragNotifier?.dragDetails.addListener(_valueChanged); widget.controller?._attach(this); } @@ -319,7 +324,7 @@ class _IndexBarState extends State { void dispose() { widget.controller?._detach(); _removeOverlay(); - widget.indexBarDragNotifier?.dragDetails?.removeListener(_valueChanged); + widget.indexBarDragNotifier?.dragDetails.removeListener(_valueChanged); super.dispose(); } @@ -466,7 +471,7 @@ class _IndexBarState extends State { width: widget.width, itemHeight: widget.itemHeight, hapticFeedback: widget.options.hapticFeedback, - itemBuilder: (BuildContext context, int index) { + itemBuilder: widget.builder ?? (BuildContext context, int index) { return _buildItem(context, index); }, indexBarDragNotifier: widget.indexBarDragNotifier, @@ -527,7 +532,7 @@ class _BaseIndexBarState extends State { action == IndexBarDragDetails.actionUpdate)) { HapticFeedback.vibrate(); } - widget.indexBarDragNotifier?.dragDetails?.value = IndexBarDragDetails( + widget.indexBarDragNotifier?.dragDetails.value = IndexBarDragDetails( action: action, index: lastIndex, tag: widget.data[lastIndex], diff --git a/lib/src/suspension_view.dart b/lib/src/suspension_view.dart index b1d0515..b7b5708 100644 --- a/lib/src/suspension_view.dart +++ b/lib/src/suspension_view.dart @@ -112,7 +112,7 @@ class _SuspensionViewState extends State { ISuspensionBean bean = widget.data[next]; if (bean.isShowSuspension) { double height = - context.findRenderObject()?.paintBounds?.height ?? 0; + context.findRenderObject()?.paintBounds.height ?? 0; double topTemp = itemPosition.itemTrailingEdge * height; top = math.min(widget.susItemHeight, topTemp) - widget.susItemHeight; From e60beed7578879143fd4aa8a9a12608a0168623a Mon Sep 17 00:00:00 2001 From: Gustavo Cesar Date: Wed, 5 Oct 2022 17:33:47 -0300 Subject: [PATCH 3/5] fix: Adding scroll to index list --- lib/src/index_bar.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/index_bar.dart b/lib/src/index_bar.dart index af730df..e14c0cc 100644 --- a/lib/src/index_bar.dart +++ b/lib/src/index_bar.dart @@ -595,9 +595,11 @@ class _BaseIndexBarState extends State { //_triggerDragEvent(IndexBarDragDetails.actionUp); }, behavior: HitTestBehavior.translucent, - child: Column( - mainAxisSize: MainAxisSize.min, - children: children, + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: children, + ), ), ); } From 54245e5456377ffa2464518da947fe3aacec0d4b Mon Sep 17 00:00:00 2001 From: Gustavo Cesar Date: Wed, 26 Apr 2023 11:34:58 -0300 Subject: [PATCH 4/5] Adding shrinkWrap --- lib/src/az_listview.dart | 6 ++++++ lib/src/suspension_view.dart | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lib/src/az_listview.dart b/lib/src/az_listview.dart index f04f48f..c12fe24 100644 --- a/lib/src/az_listview.dart +++ b/lib/src/az_listview.dart @@ -29,6 +29,7 @@ class AzListView extends StatefulWidget { this.indexBarMargin, this.indexBarOptions = const IndexBarOptions(), this.indexBuilder, + this.shrinkWrap = false, }) : super(key: key); /// with ISuspensionBean Data @@ -96,6 +97,10 @@ class AzListView extends StatefulWidget { /// The builder of index. final IndexWidgetBuilder? indexBuilder; + /// The shrinkWrap of list. + /// + /// The default value is [false]. + final bool shrinkWrap; @override _AzListViewState createState() => _AzListViewState(); @@ -197,6 +202,7 @@ class _AzListViewState extends State { susPosition: widget.susPosition, padding: widget.padding, physics: widget.physics, + shrinkWrap: widget.shrinkWrap, ), Align( alignment: widget.indexBarAlignment, diff --git a/lib/src/suspension_view.dart b/lib/src/suspension_view.dart index b7b5708..912985f 100644 --- a/lib/src/suspension_view.dart +++ b/lib/src/suspension_view.dart @@ -19,6 +19,7 @@ class SuspensionView extends StatefulWidget { this.susPosition, this.physics, this.padding, + this.shrinkWrap = false, }) : super(key: key); /// Suspension data. @@ -56,6 +57,10 @@ class SuspensionView extends StatefulWidget { /// The amount of space by which to inset the children. final EdgeInsets? padding; + /// The shrinkWrap of list. + /// + /// Default value is [false]. + final bool shrinkWrap; @override _SuspensionViewState createState() => _SuspensionViewState(); @@ -157,6 +162,7 @@ class _SuspensionViewState extends State { itemPositionsListener: itemPositionsListener, physics: widget.physics, padding: widget.padding, + shrinkWrap: widget.shrinkWrap, ), _buildSusWidget(context), ], From 269f62381c51484f102355d0375fde3d146d71e2 Mon Sep 17 00:00:00 2001 From: Gustavo Cesar Date: Wed, 26 Apr 2023 11:41:49 -0300 Subject: [PATCH 5/5] update version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 4e8e0fc..9ed599c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: azlistview description: A Flutter sticky headers & index ListView. IndexBar. such as citylist, contactlist. index and hover effect. -version: 2.0.0 +version: 2.0.1 homepage: https://github.com/flutterchina/azlistview environment: