Skip to content

Commit

Permalink
v2.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
thl committed Feb 12, 2022
1 parent 89e86fd commit ea7e116
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 45 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.0 release
* TODO: scrollable_positioned_list: ^0.2.3, Indexbar add haptic feedback.

## 2.0.0
* TODO: Migrate to null-safety.

Expand Down
19 changes: 0 additions & 19 deletions azlistview.iml

This file was deleted.

1 change: 0 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher"
android:label="azlistview_example">
<activity
Expand Down
1 change: 1 addition & 0 deletions example/lib/ui/github_language_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class _GitHubLanguagePageState extends State<GitHubLanguagePage> {
},
indexBarOptions: IndexBarOptions(
needRebuild: true,
hapticFeedback: true,
selectTextStyle: TextStyle(
fontSize: 12,
color: Colors.white,
Expand Down
29 changes: 18 additions & 11 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.0"
version: "2.8.2"
azlistview:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "2.0.0-nullsafety.0"
version: "2.0.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -28,14 +28,14 @@ packages:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.3.1"
clock:
dependency: transitive
description:
Expand Down Expand Up @@ -124,14 +124,21 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.7.0"
path:
dependency: transitive
description:
Expand All @@ -152,7 +159,7 @@ packages:
name: scrollable_positioned_list
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0-nullsafety.0"
version: "0.2.3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -164,7 +171,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -199,7 +206,7 @@ packages:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.19"
version: "0.4.8"
typed_data:
dependency: transitive
description:
Expand All @@ -213,7 +220,7 @@ packages:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
version: "2.1.1"
sdks:
dart: ">=2.12.0 <3.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=1.17.0"
4 changes: 4 additions & 0 deletions lib/src/az_listview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class AzListView extends StatefulWidget {
this.indexBarWidth = kIndexBarWidth,
this.indexBarHeight,
this.indexBarItemHeight = kIndexBarItemHeight,
this.hapticFeedback = false,
this.indexBarAlignment = Alignment.centerRight,
this.indexBarMargin,
this.indexBarOptions = const IndexBarOptions(),
Expand Down Expand Up @@ -80,6 +81,9 @@ class AzListView extends StatefulWidget {
/// IndexBar Item Height.
final double indexBarItemHeight;

/// Haptic feedback.
final bool hapticFeedback;

/// IndexBar alignment.
final AlignmentGeometry indexBarAlignment;

Expand Down
20 changes: 19 additions & 1 deletion lib/src/index_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:math' as math;

import 'package:flutter/services.dart';

/// IndexHintBuilder.
typedef IndexHintBuilder = Widget Function(BuildContext context, String tag);

Expand Down Expand Up @@ -110,6 +112,7 @@ class IndexBarOptions {
const IndexBarOptions({
this.needRebuild = false,
this.ignoreDragCancel = false,
this.hapticFeedback = false,
this.color,
this.downColor,
this.decoration,
Expand Down Expand Up @@ -141,6 +144,9 @@ class IndexBarOptions {
/// Ignore DragCancel.
final bool ignoreDragCancel;

/// Haptic feedback.
final bool hapticFeedback;

/// IndexBar background color.
final Color? color;

Expand Down Expand Up @@ -459,6 +465,7 @@ class _IndexBarState extends State<IndexBar> {
data: widget.data,
width: widget.width,
itemHeight: widget.itemHeight,
hapticFeedback: widget.options.hapticFeedback,
itemBuilder: (BuildContext context, int index) {
return _buildItem(context, index);
},
Expand All @@ -474,8 +481,9 @@ class BaseIndexBar extends StatefulWidget {
this.data = kIndexBarData,
this.width = kIndexBarWidth,
this.itemHeight = kIndexBarItemHeight,
this.itemBuilder,
this.hapticFeedback = false,
this.textStyle = const TextStyle(fontSize: 12.0, color: Color(0xFF666666)),
this.itemBuilder,
this.indexBarDragNotifier,
}) : super(key: key);

Expand All @@ -488,6 +496,9 @@ class BaseIndexBar extends StatefulWidget {
/// IndexBar item height(def:16).
final double itemHeight;

/// Haptic feedback.
final bool hapticFeedback;

/// IndexBar text style.
final TextStyle textStyle;

Expand All @@ -511,6 +522,11 @@ class _BaseIndexBarState extends State<BaseIndexBar> {

/// trigger drag event.
_triggerDragEvent(int action) {
if (widget.hapticFeedback &&
(action == IndexBarDragDetails.actionDown ||
action == IndexBarDragDetails.actionUpdate)) {
HapticFeedback.vibrate();
}
widget.indexBarDragNotifier?.dragDetails?.value = IndexBarDragDetails(
action: action,
index: lastIndex,
Expand Down Expand Up @@ -559,6 +575,8 @@ class _BaseIndexBarState extends State<BaseIndexBar> {
int index = _getIndex(details.localPosition.dy);
if (index >= 0 && lastIndex != index) {
lastIndex = index;
//HapticFeedback.lightImpact();
//HapticFeedback.vibrate();
_triggerDragEvent(IndexBarDragDetails.actionUpdate);
}
},
Expand Down
27 changes: 17 additions & 10 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.0"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,14 +21,14 @@ packages:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.3.1"
clock:
dependency: transitive
description:
Expand Down Expand Up @@ -66,14 +66,21 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.7.0"
path:
dependency: transitive
description:
Expand All @@ -87,7 +94,7 @@ packages:
name: scrollable_positioned_list
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0-nullsafety.0"
version: "0.2.3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -99,7 +106,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -134,7 +141,7 @@ packages:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.19"
version: "0.4.8"
typed_data:
dependency: transitive
description:
Expand All @@ -148,7 +155,7 @@ packages:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
version: "2.1.1"
sdks:
dart: ">=2.12.0-259.9.beta <3.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=1.13.8"
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: azlistview
description: A Flutter sticky headers & index ListView. IndexBar. such as citylist, contactlist. index and hover effect.
version: 2.0.0-nullsafety.0
version: 2.0.0
homepage: https://github.com/flutterchina/azlistview

environment:
sdk: ">=2.12.0-259.9.beta <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
# https://pub.flutter-io.cn/packages/scrollable_positioned_list
scrollable_positioned_list: ^0.2.0-nullsafety.0
scrollable_positioned_list: ^0.2.3

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit ea7e116

Please sign in to comment.