diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b4e737..b114a0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.2 + +* TODO: Open ScrollController, ScrollPhysics... + ## 0.1.1 * TODO: fix IndexBar onTapUp. diff --git a/README.md b/README.md index cacb37a..0d8eda5 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ AzListView,Flutter 城市列表,联系人列表,自定义Header,索引 ```yaml dependencies: - azlistview: ^0.1.1 #latest version + azlistview: ^0.1.2 #latest version ``` ### Example diff --git a/lib/src/az_listview.dart b/lib/src/az_listview.dart index 6cd3f5c..3db5410 100644 --- a/lib/src/az_listview.dart +++ b/lib/src/az_listview.dart @@ -31,15 +31,19 @@ class AzListView extends StatefulWidget { this.data, this.topData, this.itemBuilder, + this.controller, + this.physics, + this.shrinkWrap = true, + this.padding = EdgeInsets.zero, this.suspensionWidget, - this.isUseRealIndex: true, - this.itemHeight: 50, - this.suspensionHeight: 40, + this.isUseRealIndex = true, + this.itemHeight = 50, + this.suspensionHeight = 40, this.onSusTagChanged, this.header, this.indexBarBuilder, this.indexHintBuilder, - this.showIndexHint: true}) + this.showIndexHint = true}) : assert(itemBuilder != null), super(key: key); @@ -51,6 +55,14 @@ class AzListView extends StatefulWidget { final ItemWidgetBuilder itemBuilder; + final ScrollController controller; + + final ScrollPhysics physics; + + final bool shrinkWrap; + + final EdgeInsetsGeometry padding; + ///suspension widget. final Widget suspensionWidget; @@ -92,12 +104,12 @@ class _AzListViewState extends State { @override void initState() { super.initState(); - _scrollController = ScrollController(); + _scrollController = widget.controller ?? ScrollController(); } @override void dispose() { - _scrollController.dispose(); + _scrollController?.dispose(); super.dispose(); } @@ -146,7 +158,9 @@ class _AzListViewState extends State { data: widget.header == null ? _cityList : _cityList.sublist(1), contentWidget: ListView.builder( controller: _scrollController, - shrinkWrap: true, + physics: widget.physics, + shrinkWrap: widget.shrinkWrap, + padding: widget.padding, itemCount: _cityList.length, itemBuilder: (BuildContext context, int index) { if (index == 0 && _cityList[index] is _Header) { diff --git a/lib/src/index_bar.dart b/lib/src/index_bar.dart index 84427b7..e870dbf 100644 --- a/lib/src/index_bar.dart +++ b/lib/src/index_bar.dart @@ -47,10 +47,10 @@ const List INDEX_DATA_DEF = const [ class IndexBar extends StatefulWidget { IndexBar( {Key key, - this.data: INDEX_DATA_DEF, + this.data = INDEX_DATA_DEF, @required this.onTouch, - this.width: 30, - this.itemHeight: 16, + this.width = 30, + this.itemHeight = 16, this.color = Colors.transparent, this.textStyle = const TextStyle(fontSize: 12.0, color: Color(0xFF666666)), @@ -137,10 +137,10 @@ class _IndexBar extends StatefulWidget { _IndexBar( {Key key, - this.data: INDEX_DATA_DEF, + this.data = INDEX_DATA_DEF, @required this.onTouch, - this.width: 30, - this.itemHeight: 16, + this.width = 30, + this.itemHeight = 16, this.textStyle, this.touchDownTextStyle}) : assert(onTouch != null), diff --git a/lib/src/suspension_view.dart b/lib/src/suspension_view.dart index 6e776a9..626d25f 100644 --- a/lib/src/suspension_view.dart +++ b/lib/src/suspension_view.dart @@ -38,8 +38,8 @@ class SuspensionView extends StatefulWidget { @required this.contentWidget, @required this.suspensionWidget, @required this.controller, - this.suspensionHeight: 40, - this.itemHeight: 50, + this.suspensionHeight = 40, + this.itemHeight = 50, this.onSusTagChanged, this.onSusSectionInited, this.header, diff --git a/pubspec.yaml b/pubspec.yaml index 0ba00df..5bf719f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: azlistview description: AzListView, SuspensionView, IndexBar. like as citylist, contactlist. index and hover effect. -version: 0.1.1 +version: 0.1.2 authors: - "wendux<824783146@qq.com>" - "sky24n<863764940@qq.com>"