improve gesture ui and matching
This commit is contained in:
@@ -39,6 +39,10 @@ const defaultGestureIntervalMs = 0;
|
||||
const minGestureIntervalMs = 0;
|
||||
const maxGestureIntervalMs = 2000;
|
||||
|
||||
const defaultGestureStrokeIntervalMs = 0;
|
||||
const minGestureStrokeIntervalMs = 0;
|
||||
const maxGestureStrokeIntervalMs = 500;
|
||||
|
||||
/// Minimum number of strokes drawn before the live overlay starts suggesting
|
||||
/// the other possible completions (mirrors the reference add-on's
|
||||
/// `toastMinStroke`).
|
||||
@@ -82,6 +86,11 @@ class GestureSettings with FastEquatable {
|
||||
/// gestures are ignored. 0 disables the cooldown.
|
||||
final int intervalMs;
|
||||
|
||||
/// Minimum milliseconds required between two consecutive direction changes
|
||||
/// within a single gesture. A faster direction change aborts the in-progress
|
||||
/// gesture, guarding against accidental fast scribbles. 0 disables the check.
|
||||
final int minStrokeIntervalMs;
|
||||
|
||||
/// Whether to show the live feedback overlay while a stroke is being drawn
|
||||
/// (the in-progress arrows plus the matching/possible actions).
|
||||
final bool showFeedback;
|
||||
@@ -108,6 +117,7 @@ class GestureSettings with FastEquatable {
|
||||
required this.timeoutMs,
|
||||
required this.maxFingers,
|
||||
required this.intervalMs,
|
||||
required this.minStrokeIntervalMs,
|
||||
required this.showFeedback,
|
||||
required this.suggestNext,
|
||||
required this.minSuggestionStroke,
|
||||
@@ -122,6 +132,7 @@ class GestureSettings with FastEquatable {
|
||||
int? timeoutMs,
|
||||
int? maxFingers,
|
||||
int? intervalMs,
|
||||
int? minStrokeIntervalMs,
|
||||
bool? showFeedback,
|
||||
bool? suggestNext,
|
||||
int? minSuggestionStroke,
|
||||
@@ -133,6 +144,8 @@ class GestureSettings with FastEquatable {
|
||||
timeoutMs = timeoutMs ?? defaultGestureTimeoutMs,
|
||||
maxFingers = maxFingers ?? defaultGestureMaxFingers,
|
||||
intervalMs = intervalMs ?? defaultGestureIntervalMs,
|
||||
minStrokeIntervalMs =
|
||||
minStrokeIntervalMs ?? defaultGestureStrokeIntervalMs,
|
||||
showFeedback = showFeedback ?? true,
|
||||
suggestNext = suggestNext ?? true,
|
||||
minSuggestionStroke =
|
||||
@@ -156,6 +169,7 @@ class GestureSettings with FastEquatable {
|
||||
timeoutMs,
|
||||
maxFingers,
|
||||
intervalMs,
|
||||
minStrokeIntervalMs,
|
||||
showFeedback,
|
||||
suggestNext,
|
||||
minSuggestionStroke,
|
||||
|
||||
@@ -19,6 +19,8 @@ abstract class _$GestureSettingsCWProxy {
|
||||
|
||||
GestureSettings intervalMs(int intervalMs);
|
||||
|
||||
GestureSettings minStrokeIntervalMs(int minStrokeIntervalMs);
|
||||
|
||||
GestureSettings showFeedback(bool showFeedback);
|
||||
|
||||
GestureSettings suggestNext(bool suggestNext);
|
||||
@@ -43,6 +45,7 @@ abstract class _$GestureSettingsCWProxy {
|
||||
int timeoutMs,
|
||||
int maxFingers,
|
||||
int intervalMs,
|
||||
int minStrokeIntervalMs,
|
||||
bool showFeedback,
|
||||
bool suggestNext,
|
||||
int minSuggestionStroke,
|
||||
@@ -76,6 +79,10 @@ class _$GestureSettingsCWProxyImpl implements _$GestureSettingsCWProxy {
|
||||
@override
|
||||
GestureSettings intervalMs(int intervalMs) => call(intervalMs: intervalMs);
|
||||
|
||||
@override
|
||||
GestureSettings minStrokeIntervalMs(int minStrokeIntervalMs) =>
|
||||
call(minStrokeIntervalMs: minStrokeIntervalMs);
|
||||
|
||||
@override
|
||||
GestureSettings showFeedback(bool showFeedback) =>
|
||||
call(showFeedback: showFeedback);
|
||||
@@ -111,6 +118,7 @@ class _$GestureSettingsCWProxyImpl implements _$GestureSettingsCWProxy {
|
||||
Object? timeoutMs = const $CopyWithPlaceholder(),
|
||||
Object? maxFingers = const $CopyWithPlaceholder(),
|
||||
Object? intervalMs = const $CopyWithPlaceholder(),
|
||||
Object? minStrokeIntervalMs = const $CopyWithPlaceholder(),
|
||||
Object? showFeedback = const $CopyWithPlaceholder(),
|
||||
Object? suggestNext = const $CopyWithPlaceholder(),
|
||||
Object? minSuggestionStroke = const $CopyWithPlaceholder(),
|
||||
@@ -145,6 +153,12 @@ class _$GestureSettingsCWProxyImpl implements _$GestureSettingsCWProxy {
|
||||
? _value.intervalMs
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: intervalMs as int,
|
||||
minStrokeIntervalMs:
|
||||
minStrokeIntervalMs == const $CopyWithPlaceholder() ||
|
||||
minStrokeIntervalMs == null
|
||||
? _value.minStrokeIntervalMs
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: minStrokeIntervalMs as int,
|
||||
showFeedback:
|
||||
showFeedback == const $CopyWithPlaceholder() || showFeedback == null
|
||||
? _value.showFeedback
|
||||
@@ -193,6 +207,7 @@ GestureSettings _$GestureSettingsFromJson(Map<String, dynamic> json) =>
|
||||
timeoutMs: (json['timeoutMs'] as num?)?.toInt(),
|
||||
maxFingers: (json['maxFingers'] as num?)?.toInt(),
|
||||
intervalMs: (json['intervalMs'] as num?)?.toInt(),
|
||||
minStrokeIntervalMs: (json['minStrokeIntervalMs'] as num?)?.toInt(),
|
||||
showFeedback: json['showFeedback'] as bool?,
|
||||
suggestNext: json['suggestNext'] as bool?,
|
||||
minSuggestionStroke: (json['minSuggestionStroke'] as num?)?.toInt(),
|
||||
@@ -212,6 +227,7 @@ Map<String, dynamic> _$GestureSettingsToJson(GestureSettings instance) =>
|
||||
'timeoutMs': instance.timeoutMs,
|
||||
'maxFingers': instance.maxFingers,
|
||||
'intervalMs': instance.intervalMs,
|
||||
'minStrokeIntervalMs': instance.minStrokeIntervalMs,
|
||||
'showFeedback': instance.showFeedback,
|
||||
'suggestNext': instance.suggestNext,
|
||||
'minSuggestionStroke': instance.minSuggestionStroke,
|
||||
|
||||
Reference in New Issue
Block a user