From 16e0a86d083d92bc5574d8d0dc43ebbe4a0ba68e Mon Sep 17 00:00:00 2001 From: Muhammad Mateen Date: Sat, 6 Aug 2022 12:12:57 +0200 Subject: [PATCH 1/7] Upgrade flutter version and support minCacheExtent --- CHANGELOG.md | 6 ++ README.md | 2 +- example/lib/common/models.dart | 11 +-- example/lib/main.dart | 1 + example/lib/ui/car_models_page.dart | 4 +- example/lib/ui/citylist_page.dart | 101 +++++++++++++------------- example/pubspec.lock | 107 +++++++++++++--------------- example/pubspec.yaml | 8 +-- lib/src/az_listview.dart | 12 +++- lib/src/index_bar.dart | 16 ++--- lib/src/suspension_view.dart | 37 ++++++---- pubspec.lock | 78 +++++++++----------- pubspec.yaml | 7 +- 13 files changed, 194 insertions(+), 196 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18c6bc8..dcbbabf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.0.1 release +* TODO: + - Upgrade version of [scrollable_positioned_list: ^0.3.2](https://pub.flutter-io.cn/packages/scrollable_positioned_list), + - Upgrade flutter version + - Add property to support of minCacheExtent in list + ## 2.0.0 release * TODO: scrollable_positioned_list: ^0.2.3, Indexbar add haptic feedback. diff --git a/README.md b/README.md index f390572..de6fb44 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ AzListView, SuspensionView, IndexBar. ## Pub ```yaml dependencies: - azlistview: ^2.0.0 + azlistview: ^2.0.1 ``` ## Screenshots diff --git a/example/lib/common/models.dart b/example/lib/common/models.dart index 59c3e16..c82f937 100644 --- a/example/lib/common/models.dart +++ b/example/lib/common/models.dart @@ -19,11 +19,11 @@ class CityModel extends ISuspensionBean { CityModel.fromJson(Map json) : name = json['name']; Map toJson() => { - 'name': name, + 'name': name, // 'tagIndex': tagIndex, // 'namePinyin': namePinyin, // 'isShowSuspension': isShowSuspension - }; + }; @override String getSuspensionTag() => tagIndex!; @@ -63,13 +63,13 @@ class ContactInfo extends ISuspensionBean { Map toJson() => { // 'id': id, - 'name': name, - 'img': img, + 'name': name, + 'img': img, // 'firstletter': firstletter, // 'tagIndex': tagIndex, // 'namePinyin': namePinyin, // 'isShowSuspension': isShowSuspension - }; + }; @override String getSuspensionTag() => tagIndex!; @@ -88,6 +88,7 @@ class Languages extends GithubLanguage with ISuspensionBean { @override Map toJson() { final Map map = super.toJson(); + // ignore: unused_element void addIfNonNull(String fieldName, dynamic value) { if (value != null) { map[fieldName] = value; diff --git a/example/lib/main.dart b/example/lib/main.dart index 9b6df88..c828b40 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -20,6 +20,7 @@ class MyApp extends StatelessWidget { title: 'AzListView Demo', theme: ThemeData( primaryColor: Colors.white, + // ignore: deprecated_member_use accentColor: Colors.grey, //primarySwatch: Colors.white, visualDensity: VisualDensity.adaptivePlatformDensity, diff --git a/example/lib/ui/car_models_page.dart b/example/lib/ui/car_models_page.dart index 2f902b2..aa189dd 100644 --- a/example/lib/ui/car_models_page.dart +++ b/example/lib/ui/car_models_page.dart @@ -1,5 +1,3 @@ -import 'dart:developer'; - import 'package:azlistview/azlistview.dart'; import 'package:azlistview_example/common/index.dart'; import 'package:flutter/material.dart'; @@ -114,7 +112,7 @@ class _CarModelsPageState extends State { selectTextStyle: TextStyle( fontSize: 12, color: Colors.white, fontWeight: FontWeight.w500), selectItemDecoration: - BoxDecoration(shape: BoxShape.circle, color: Color(0xFF333333)), + BoxDecoration(shape: BoxShape.circle, color: Color(0xFF333333)), indexHintWidth: 96, indexHintHeight: 97, indexHintDecoration: BoxDecoration( diff --git a/example/lib/ui/citylist_page.dart b/example/lib/ui/citylist_page.dart index 60de164..bbddd48 100644 --- a/example/lib/ui/citylist_page.dart +++ b/example/lib/ui/citylist_page.dart @@ -74,14 +74,14 @@ class _CityListPageState extends State { children: [ Expanded( child: TextField( - autofocus: false, - decoration: InputDecoration( - contentPadding: EdgeInsets.only(left: 10, right: 10), - border: InputBorder.none, - labelStyle: TextStyle(fontSize: 14, color: Color(0xFF333333)), - hintText: '城市中文名或拼音', - hintStyle: TextStyle(fontSize: 14, color: Color(0xFFCCCCCC))), - )), + autofocus: false, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(left: 10, right: 10), + border: InputBorder.none, + labelStyle: TextStyle(fontSize: 14, color: Color(0xFF333333)), + hintText: '城市中文名或拼音', + hintStyle: TextStyle(fontSize: 14, color: Color(0xFFCCCCCC))), + )), Container( width: 0.33, height: 14.0, @@ -110,51 +110,52 @@ class _CityListPageState extends State { resizeToAvoidBottomInset: false, body: SafeArea( child: Column( - children: [ - header(), - Expanded( - child: Material( - color: Color(0x80000000), - child: Card( - clipBehavior: Clip.hardEdge, - margin: const EdgeInsets.only(left: 8, top: 8, right: 8), - shape: const RoundedRectangleBorder( - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(4.0), - topRight: Radius.circular(4.0)), - ), - child: Column( - children: [ - Container( - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 15.0), - height: 50.0, - child: Text("当前城市: 成都市"), - ), - Expanded( - child: AzListView( - data: cityList, - itemCount: cityList.length, - itemBuilder: (BuildContext context, int index) { - CityModel model = cityList[index]; - return Utils.getListItem(context, model); - }, - padding: EdgeInsets.zero, - susItemBuilder: (BuildContext context, int index) { - CityModel model = cityList[index]; - String tag = model.getSuspensionTag(); - return Utils.getSusItem(context, tag); - }, - indexBarData: ['★', ...kIndexBarData], + children: [ + header(), + Expanded( + child: Material( + color: Color(0x80000000), + child: Card( + clipBehavior: Clip.hardEdge, + margin: const EdgeInsets.only(left: 8, top: 8, right: 8), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(4.0), + topRight: Radius.circular(4.0), ), - ) - ], + ), + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + padding: const EdgeInsets.only(left: 15.0), + height: 50.0, + child: Text("当前城市: 成都市"), + ), + Expanded( + child: AzListView( + data: cityList, + itemCount: cityList.length, + itemBuilder: (BuildContext context, int index) { + CityModel model = cityList[index]; + return Utils.getListItem(context, model); + }, + padding: EdgeInsets.zero, + susItemBuilder: (BuildContext context, int index) { + CityModel model = cityList[index]; + String tag = model.getSuspensionTag(); + return Utils.getSusItem(context, tag); + }, + indexBarData: ['★', ...kIndexBarData], + ), + ) + ], + ), + ), ), ), - ), - ), - ], - )), + ], + )), ); } } diff --git a/example/pubspec.lock b/example/pubspec.lock index e45ad9a..89f8d9b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,93 +5,86 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" azlistview: dependency: "direct main" description: path: ".." relative: true source: path - version: "2.0.0" + version: "2.0.1" 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" - source: hosted - version: "1.3.1" + version: "1.2.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" common_utils: dependency: "direct main" description: name: common_utils - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.1.0" convert: dependency: transitive description: name: convert - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.2" crypto: dependency: transitive description: name: crypto - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.5" decimal: dependency: transitive description: name: decimal - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "2.2.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 @@ -108,58 +101,58 @@ packages: path: "." ref: HEAD resolved-ref: b4f88207ebc0c5dcc8baa1676a0fd7796974173a - url: "git://github.com/Sky24n/github_language_colors.git" + url: "https://github.com/Sky24n/github_language_colors.git" source: git version: "2.0.0" lpinyin: dependency: "direct main" description: name: lpinyin - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.3" matcher: 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.5" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.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.2" rational: dependency: transitive description: name: rational - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "2.2.0" scrollable_positioned_list: dependency: transitive description: name: scrollable_positioned_list - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "0.3.2" sky_engine: dependency: transitive description: flutter @@ -169,58 +162,58 @@ 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.9.0" 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" + version: "1.1.1" 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" + version: "0.4.9" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" 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" - flutter: ">=1.17.0" + dart: ">=2.18.0-44.1.beta <3.0.0" + flutter: ">=2.12.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 37aa579..182487f 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -28,10 +28,10 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.3 - common_utils: ^2.0.0 + cupertino_icons: ^1.0.5 + common_utils: ^2.1.0 # 汉字转拼音 - lpinyin: ^2.0.0 + lpinyin: ^2.0.3 azlistview: path: ../ @@ -41,7 +41,7 @@ dependencies: # url: git://github.com/Sky24n/github_language_colors.git github_language_colors: git: - url: git://github.com/Sky24n/github_language_colors.git + url: https://github.com/Sky24n/github_language_colors.git dev_dependencies: flutter_test: diff --git a/lib/src/az_listview.dart b/lib/src/az_listview.dart index 9175002..3d3fde1 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.minCacheExtent, }) : super(key: key); /// with ISuspensionBean Data @@ -93,6 +94,10 @@ class AzListView extends StatefulWidget { /// IndexBar options. final IndexBarOptions indexBarOptions; + /// The minimum cache extent used by the underlying scroll lists. + /// See [ScrollView.cacheExtent]. + final double? minCacheExtent; + @override _AzListViewState createState() => _AzListViewState(); } @@ -166,9 +171,9 @@ class _AzListViewState extends State { ItemPosition itemPosition = positions .where((ItemPosition position) => position.itemTrailingEdge > 0) .reduce((ItemPosition min, ItemPosition position) => - position.itemTrailingEdge < min.itemTrailingEdge - ? position - : min); + position.itemTrailingEdge < min.itemTrailingEdge + ? position + : min); int index = itemPosition.index; String tag = widget.data[index].getSuspensionTag(); if (selectTag != tag) { @@ -193,6 +198,7 @@ class _AzListViewState extends State { susPosition: widget.susPosition, padding: widget.padding, physics: widget.physics, + minCacheExtent: widget.minCacheExtent, ), Align( alignment: widget.indexBarAlignment, diff --git a/lib/src/index_bar.dart b/lib/src/index_bar.dart index f93251e..f6f0d7b 100644 --- a/lib/src/index_bar.dart +++ b/lib/src/index_bar.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'dart:math' as math; @@ -23,7 +21,7 @@ abstract class IndexBarDragListener { class IndexBarDragNotifier implements IndexBarDragListener { @override final ValueNotifier dragDetails = - ValueNotifier(IndexBarDragDetails()); + ValueNotifier(IndexBarDragDetails()); } /// IndexModel. @@ -130,7 +128,7 @@ class IndexBarOptions { borderRadius: BorderRadius.all(Radius.circular(6)), ), this.indexHintTextStyle = - const TextStyle(fontSize: 24.0, color: Colors.white), + const TextStyle(fontSize: 24.0, color: Colors.white), this.indexHintChildAlignment = Alignment.center, this.indexHintAlignment = Alignment.center, this.indexHintPosition, @@ -280,7 +278,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 +317,7 @@ class _IndexBarState extends State { void dispose() { widget.controller?._detach(); _removeOverlay(); - widget.indexBarDragNotifier?.dragDetails?.removeListener(_valueChanged); + widget.indexBarDragNotifier?.dragDetails.removeListener(_valueChanged); super.dispose(); } @@ -414,7 +412,7 @@ class _IndexBarState extends State { : widget.options.textStyle; } else if (widget.options.selectItemDecoration != null) { decoration = - (selectIndex == index) ? widget.options.selectItemDecoration : null; + (selectIndex == index) ? widget.options.selectItemDecoration : null; textStyle = (selectIndex == index) ? widget.options.selectTextStyle : widget.options.textStyle; @@ -527,7 +525,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], @@ -550,7 +548,7 @@ class _BaseIndexBarState extends State { List children = List.generate(widget.data.length, (index) { Widget child = widget.itemBuilder == null ? Center( - child: Text('${widget.data[index]}', style: widget.textStyle)) + child: Text('${widget.data[index]}', style: widget.textStyle)) : widget.itemBuilder!(context, index); return SizedBox( width: widget.width, diff --git a/lib/src/suspension_view.dart b/lib/src/suspension_view.dart index b1d0515..50d0047 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.minCacheExtent, }) : super(key: key); /// Suspension data. @@ -57,6 +58,10 @@ class SuspensionView extends StatefulWidget { /// The amount of space by which to inset the children. final EdgeInsets? padding; + /// The minimum cache extent used by the underlying scroll lists. + /// See [ScrollView.cacheExtent]. + final double? minCacheExtent; + @override _SuspensionViewState createState() => _SuspensionViewState(); } @@ -85,21 +90,22 @@ class _SuspensionViewState extends State { /// build sus widget. Widget _buildSusWidget(BuildContext context) { if (widget.susItemBuilder == null) { - return Container(); + return const Offstage(); } return ValueListenableBuilder>( valueListenable: itemPositionsListener.itemPositions, builder: (ctx, positions, child) { if (positions.isEmpty || widget.itemCount == 0) { - return Container(); + return const Offstage(); } ItemPosition itemPosition = positions .where((ItemPosition position) => position.itemTrailingEdge > 0) .reduce((ItemPosition min, ItemPosition position) => - position.itemTrailingEdge < min.itemTrailingEdge - ? position - : min); - if (itemPosition.itemLeadingEdge > 0) return Container(); + position.itemTrailingEdge < min.itemTrailingEdge + ? position + : min); + if (itemPosition.itemLeadingEdge > 0) return const Offstage(); + int index = itemPosition.index; double left = 0; double top = 0; @@ -112,7 +118,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; @@ -149,15 +155,16 @@ class _SuspensionViewState extends State { return Stack( children: [ widget.itemCount == 0 - ? Container() + ? const Offstage() : ScrollablePositionedList.builder( - itemCount: widget.itemCount, - itemBuilder: (context, index) => _buildItem(context, index), - itemScrollController: itemScrollController, - itemPositionsListener: itemPositionsListener, - physics: widget.physics, - padding: widget.padding, - ), + itemCount: widget.itemCount, + itemBuilder: (context, index) => _buildItem(context, index), + itemScrollController: itemScrollController, + itemPositionsListener: itemPositionsListener, + physics: widget.physics, + padding: widget.padding, + minCacheExtent: widget.minCacheExtent, + ), _buildSusWidget(context), ], ); diff --git a/pubspec.lock b/pubspec.lock index 1cb79b0..f16ae1e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,51 +5,44 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" 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" - source: hosted - version: "1.3.1" + version: "1.2.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,37 +57,37 @@ 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.5" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.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.2" 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" + version: "0.3.2" sky_engine: dependency: transitive description: flutter @@ -104,58 +97,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.9.0" 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" + version: "1.1.1" 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" - source: hosted - version: "0.4.8" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" 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" - flutter: ">=1.13.8" + dart: ">=2.18.0-44.1.beta <3.0.0" + flutter: ">=2.12.0" diff --git a/pubspec.yaml b/pubspec.yaml index d725b1b..4120a8e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,16 +1,17 @@ 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: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.18.0-44.1.beta <3.0.0" + flutter: ">=1.24.0-6.0.pre <2.0.0" 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 11cf4c1570b3f64e5d0398a8458ad3262a8dcb95 Mon Sep 17 00:00:00 2001 From: Muhammad Mateen Date: Sat, 6 Aug 2022 12:14:23 +0200 Subject: [PATCH 2/7] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcbbabf..04e424e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.0.1 release +## 2.0.1 * TODO: - Upgrade version of [scrollable_positioned_list: ^0.3.2](https://pub.flutter-io.cn/packages/scrollable_positioned_list), - Upgrade flutter version From 5aa45f6a20964681d6824f4fdd6ac0f8462a17f5 Mon Sep 17 00:00:00 2001 From: Muhammad Mateen Date: Sat, 6 Aug 2022 12:15:44 +0200 Subject: [PATCH 3/7] Adjust the file format --- example/lib/common/models.dart | 10 +-- example/lib/ui/car_models_page.dart | 2 +- example/lib/ui/citylist_page.dart | 102 ++++++++++++++-------------- lib/src/az_listview.dart | 6 +- lib/src/index_bar.dart | 8 +-- lib/src/suspension_view.dart | 22 +++--- 6 files changed, 75 insertions(+), 75 deletions(-) diff --git a/example/lib/common/models.dart b/example/lib/common/models.dart index c82f937..2116d40 100644 --- a/example/lib/common/models.dart +++ b/example/lib/common/models.dart @@ -19,11 +19,11 @@ class CityModel extends ISuspensionBean { CityModel.fromJson(Map json) : name = json['name']; Map toJson() => { - 'name': name, + 'name': name, // 'tagIndex': tagIndex, // 'namePinyin': namePinyin, // 'isShowSuspension': isShowSuspension - }; + }; @override String getSuspensionTag() => tagIndex!; @@ -63,13 +63,13 @@ class ContactInfo extends ISuspensionBean { Map toJson() => { // 'id': id, - 'name': name, - 'img': img, + 'name': name, + 'img': img, // 'firstletter': firstletter, // 'tagIndex': tagIndex, // 'namePinyin': namePinyin, // 'isShowSuspension': isShowSuspension - }; + }; @override String getSuspensionTag() => tagIndex!; diff --git a/example/lib/ui/car_models_page.dart b/example/lib/ui/car_models_page.dart index aa189dd..d3b27bd 100644 --- a/example/lib/ui/car_models_page.dart +++ b/example/lib/ui/car_models_page.dart @@ -112,7 +112,7 @@ class _CarModelsPageState extends State { selectTextStyle: TextStyle( fontSize: 12, color: Colors.white, fontWeight: FontWeight.w500), selectItemDecoration: - BoxDecoration(shape: BoxShape.circle, color: Color(0xFF333333)), + BoxDecoration(shape: BoxShape.circle, color: Color(0xFF333333)), indexHintWidth: 96, indexHintHeight: 97, indexHintDecoration: BoxDecoration( diff --git a/example/lib/ui/citylist_page.dart b/example/lib/ui/citylist_page.dart index bbddd48..fb872ef 100644 --- a/example/lib/ui/citylist_page.dart +++ b/example/lib/ui/citylist_page.dart @@ -74,14 +74,14 @@ class _CityListPageState extends State { children: [ Expanded( child: TextField( - autofocus: false, - decoration: InputDecoration( - contentPadding: EdgeInsets.only(left: 10, right: 10), - border: InputBorder.none, - labelStyle: TextStyle(fontSize: 14, color: Color(0xFF333333)), - hintText: '城市中文名或拼音', - hintStyle: TextStyle(fontSize: 14, color: Color(0xFFCCCCCC))), - )), + autofocus: false, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(left: 10, right: 10), + border: InputBorder.none, + labelStyle: TextStyle(fontSize: 14, color: Color(0xFF333333)), + hintText: '城市中文名或拼音', + hintStyle: TextStyle(fontSize: 14, color: Color(0xFFCCCCCC))), + )), Container( width: 0.33, height: 14.0, @@ -110,52 +110,52 @@ class _CityListPageState extends State { resizeToAvoidBottomInset: false, body: SafeArea( child: Column( - children: [ - header(), - Expanded( - child: Material( - color: Color(0x80000000), - child: Card( - clipBehavior: Clip.hardEdge, - margin: const EdgeInsets.only(left: 8, top: 8, right: 8), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(4.0), - topRight: Radius.circular(4.0), - ), - ), - child: Column( - children: [ - Container( - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 15.0), - height: 50.0, - child: Text("当前城市: 成都市"), - ), - Expanded( - child: AzListView( - data: cityList, - itemCount: cityList.length, - itemBuilder: (BuildContext context, int index) { - CityModel model = cityList[index]; - return Utils.getListItem(context, model); - }, - padding: EdgeInsets.zero, - susItemBuilder: (BuildContext context, int index) { - CityModel model = cityList[index]; - String tag = model.getSuspensionTag(); - return Utils.getSusItem(context, tag); - }, - indexBarData: ['★', ...kIndexBarData], - ), - ) - ], - ), + children: [ + header(), + Expanded( + child: Material( + color: Color(0x80000000), + child: Card( + clipBehavior: Clip.hardEdge, + margin: const EdgeInsets.only(left: 8, top: 8, right: 8), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(4.0), + topRight: Radius.circular(4.0), ), ), + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + padding: const EdgeInsets.only(left: 15.0), + height: 50.0, + child: Text("当前城市: 成都市"), + ), + Expanded( + child: AzListView( + data: cityList, + itemCount: cityList.length, + itemBuilder: (BuildContext context, int index) { + CityModel model = cityList[index]; + return Utils.getListItem(context, model); + }, + padding: EdgeInsets.zero, + susItemBuilder: (BuildContext context, int index) { + CityModel model = cityList[index]; + String tag = model.getSuspensionTag(); + return Utils.getSusItem(context, tag); + }, + indexBarData: ['★', ...kIndexBarData], + ), + ) + ], + ), ), - ], - )), + ), + ), + ], + )), ); } } diff --git a/lib/src/az_listview.dart b/lib/src/az_listview.dart index 3d3fde1..9170517 100644 --- a/lib/src/az_listview.dart +++ b/lib/src/az_listview.dart @@ -171,9 +171,9 @@ class _AzListViewState extends State { ItemPosition itemPosition = positions .where((ItemPosition position) => position.itemTrailingEdge > 0) .reduce((ItemPosition min, ItemPosition position) => - position.itemTrailingEdge < min.itemTrailingEdge - ? position - : min); + position.itemTrailingEdge < min.itemTrailingEdge + ? position + : min); int index = itemPosition.index; String tag = widget.data[index].getSuspensionTag(); if (selectTag != tag) { diff --git a/lib/src/index_bar.dart b/lib/src/index_bar.dart index f6f0d7b..d87094a 100644 --- a/lib/src/index_bar.dart +++ b/lib/src/index_bar.dart @@ -21,7 +21,7 @@ abstract class IndexBarDragListener { class IndexBarDragNotifier implements IndexBarDragListener { @override final ValueNotifier dragDetails = - ValueNotifier(IndexBarDragDetails()); + ValueNotifier(IndexBarDragDetails()); } /// IndexModel. @@ -128,7 +128,7 @@ class IndexBarOptions { borderRadius: BorderRadius.all(Radius.circular(6)), ), this.indexHintTextStyle = - const TextStyle(fontSize: 24.0, color: Colors.white), + const TextStyle(fontSize: 24.0, color: Colors.white), this.indexHintChildAlignment = Alignment.center, this.indexHintAlignment = Alignment.center, this.indexHintPosition, @@ -412,7 +412,7 @@ class _IndexBarState extends State { : widget.options.textStyle; } else if (widget.options.selectItemDecoration != null) { decoration = - (selectIndex == index) ? widget.options.selectItemDecoration : null; + (selectIndex == index) ? widget.options.selectItemDecoration : null; textStyle = (selectIndex == index) ? widget.options.selectTextStyle : widget.options.textStyle; @@ -548,7 +548,7 @@ class _BaseIndexBarState extends State { List children = List.generate(widget.data.length, (index) { Widget child = widget.itemBuilder == null ? Center( - child: Text('${widget.data[index]}', style: widget.textStyle)) + child: Text('${widget.data[index]}', style: widget.textStyle)) : widget.itemBuilder!(context, index); return SizedBox( width: widget.width, diff --git a/lib/src/suspension_view.dart b/lib/src/suspension_view.dart index 50d0047..f2196a2 100644 --- a/lib/src/suspension_view.dart +++ b/lib/src/suspension_view.dart @@ -101,9 +101,9 @@ class _SuspensionViewState extends State { ItemPosition itemPosition = positions .where((ItemPosition position) => position.itemTrailingEdge > 0) .reduce((ItemPosition min, ItemPosition position) => - position.itemTrailingEdge < min.itemTrailingEdge - ? position - : min); + position.itemTrailingEdge < min.itemTrailingEdge + ? position + : min); if (itemPosition.itemLeadingEdge > 0) return const Offstage(); int index = itemPosition.index; @@ -157,14 +157,14 @@ class _SuspensionViewState extends State { widget.itemCount == 0 ? const Offstage() : ScrollablePositionedList.builder( - itemCount: widget.itemCount, - itemBuilder: (context, index) => _buildItem(context, index), - itemScrollController: itemScrollController, - itemPositionsListener: itemPositionsListener, - physics: widget.physics, - padding: widget.padding, - minCacheExtent: widget.minCacheExtent, - ), + itemCount: widget.itemCount, + itemBuilder: (context, index) => _buildItem(context, index), + itemScrollController: itemScrollController, + itemPositionsListener: itemPositionsListener, + physics: widget.physics, + padding: widget.padding, + minCacheExtent: widget.minCacheExtent, + ), _buildSusWidget(context), ], ); From 8d67641c8d01afe7b9841789f39afa687a4d96f2 Mon Sep 17 00:00:00 2001 From: Muhammad Mateen Date: Sat, 6 Aug 2022 12:18:40 +0200 Subject: [PATCH 4/7] Update the change log --- CHANGELOG.md | 2 +- example/lib/ui/citylist_page.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04e424e..d2b685d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## 2.0.1 * TODO: - Upgrade version of [scrollable_positioned_list: ^0.3.2](https://pub.flutter-io.cn/packages/scrollable_positioned_list), - - Upgrade flutter version + - Upgrade flutter version and libraries - Add property to support of minCacheExtent in list ## 2.0.0 release diff --git a/example/lib/ui/citylist_page.dart b/example/lib/ui/citylist_page.dart index fb872ef..dced7d2 100644 --- a/example/lib/ui/citylist_page.dart +++ b/example/lib/ui/citylist_page.dart @@ -119,7 +119,7 @@ class _CityListPageState extends State { clipBehavior: Clip.hardEdge, margin: const EdgeInsets.only(left: 8, top: 8, right: 8), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(4.0), topRight: Radius.circular(4.0), ), From 53883077c6de7ef2473f02685e51fea400722a47 Mon Sep 17 00:00:00 2001 From: Muhammad Mateen Date: Sat, 6 Aug 2022 12:30:58 +0200 Subject: [PATCH 5/7] Undo changes in changelog --- CHANGELOG.md | 6 ------ README.md | 2 +- pubspec.yaml | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2b685d..18c6bc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,3 @@ -## 2.0.1 -* TODO: - - Upgrade version of [scrollable_positioned_list: ^0.3.2](https://pub.flutter-io.cn/packages/scrollable_positioned_list), - - Upgrade flutter version and libraries - - Add property to support of minCacheExtent in list - ## 2.0.0 release * TODO: scrollable_positioned_list: ^0.2.3, Indexbar add haptic feedback. diff --git a/README.md b/README.md index de6fb44..f390572 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ AzListView, SuspensionView, IndexBar. ## Pub ```yaml dependencies: - azlistview: ^2.0.1 + azlistview: ^2.0.0 ``` ## Screenshots diff --git a/pubspec.yaml b/pubspec.yaml index 4120a8e..662ba94 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.1 +version: 2.0.0 homepage: https://github.com/flutterchina/azlistview environment: From de7b6159572ab65e398865ea544a223eb2d6bfb2 Mon Sep 17 00:00:00 2001 From: Muhammad Mateen Date: Mon, 8 Aug 2022 00:20:54 +0200 Subject: [PATCH 6/7] Support lower versions --- example/pubspec.lock | 4 ++-- pubspec.lock | 2 +- pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 89f8d9b..c4d8dfd 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -14,7 +14,7 @@ packages: path: ".." relative: true source: path - version: "2.0.1" + version: "2.0.0" boolean_selector: dependency: transitive description: @@ -215,5 +215,5 @@ packages: source: hosted version: "2.1.2" sdks: - dart: ">=2.18.0-44.1.beta <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.12.0" diff --git a/pubspec.lock b/pubspec.lock index f16ae1e..b1bfd88 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -143,5 +143,5 @@ packages: source: hosted version: "2.1.2" sdks: - dart: ">=2.18.0-44.1.beta <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.12.0" diff --git a/pubspec.yaml b/pubspec.yaml index 662ba94..6832989 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 2.0.0 homepage: https://github.com/flutterchina/azlistview environment: - sdk: ">=2.18.0-44.1.beta <3.0.0" + sdk: ">=2.16.1 <3.0.0" flutter: ">=1.24.0-6.0.pre <2.0.0" dependencies: From 4e75a3743f18cd75c961f4c7cb3a3d1744f8a1e2 Mon Sep 17 00:00:00 2001 From: Muhammad Mateen Date: Mon, 8 Aug 2022 00:22:34 +0200 Subject: [PATCH 7/7] undo changes --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 6832989..662ba94 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 2.0.0 homepage: https://github.com/flutterchina/azlistview environment: - sdk: ">=2.16.1 <3.0.0" + sdk: ">=2.18.0-44.1.beta <3.0.0" flutter: ">=1.24.0-6.0.pre <2.0.0" dependencies: