From af1fa7316425defb8887f662a48bd91484d7ba2a Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Thu, 8 May 2025 02:37:36 +0530 Subject: [PATCH 01/10] feat: Add basic Stac Inkwell suppot Created StacInkWell and StacInkwellParser for Inkwell widget support --- .../widgets/stac_inkwell/stac_inkwell.dart | 15 +++++++++++++ .../stac_inkwell/stac_inkwell_parser.dart | 22 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.dart create mode 100644 packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.dart new file mode 100644 index 00000000..c250f1b0 --- /dev/null +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.dart @@ -0,0 +1,15 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'stac_inkwell.freezed.dart'; +part 'stac_inkwell.g.dart'; + +@freezed +abstract class StacInkWell with _$StacInkWell { + const factory StacInkWell({ + required Map? onTap, + required Map? child, + }) = _StacInkWell; + + factory StacInkWell.fromJson(Map json) => + _$StacInkWellFromJson(json); +} diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart new file mode 100644 index 00000000..7d9fb299 --- /dev/null +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/widgets/stac_inkwell/stac_inkwell.dart'; +import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac/stac.dart'; + +class StacInkwellParser extends StacParser { + const StacInkwellParser(); + @override + String get type => WidgetType.inkWell.name; + @override + StacInkWell getModel(Map json) { + return StacInkWell.fromJson(json); + } + + @override + Widget parse(BuildContext context, StacInkWell model) { + return InkWell( + onTap: () => Stac.onCallFromJson(model.onTap, context), + child: Stac.fromJson(model.child, context), + ); + } +} From e16f43adbdcc7c4458df2135e6408e16fa9f226c Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Thu, 8 May 2025 02:38:27 +0530 Subject: [PATCH 02/10] feat: Add StacInkWell model and JSON serialization support --- .../stac_inkwell/stac_inkwell.freezed.dart | 197 ++++++++++++++++++ .../widgets/stac_inkwell/stac_inkwell.g.dart | 18 ++ 2 files changed, 215 insertions(+) create mode 100644 packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.freezed.dart create mode 100644 packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.g.dart diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.freezed.dart new file mode 100644 index 00000000..41cac8b6 --- /dev/null +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.freezed.dart @@ -0,0 +1,197 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'stac_inkwell.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$StacInkWell { + Map? get onTap; + Map? get child; + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $StacInkWellCopyWith get copyWith => + _$StacInkWellCopyWithImpl(this as StacInkWell, _$identity); + + /// Serializes this StacInkWell to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is StacInkWell && + const DeepCollectionEquality().equals(other.onTap, onTap) && + const DeepCollectionEquality().equals(other.child, child)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(onTap), + const DeepCollectionEquality().hash(child)); + + @override + String toString() { + return 'StacInkWell(onTap: $onTap, child: $child)'; + } +} + +/// @nodoc +abstract mixin class $StacInkWellCopyWith<$Res> { + factory $StacInkWellCopyWith( + StacInkWell value, $Res Function(StacInkWell) _then) = + _$StacInkWellCopyWithImpl; + @useResult + $Res call({Map? onTap, Map? child}); +} + +/// @nodoc +class _$StacInkWellCopyWithImpl<$Res> implements $StacInkWellCopyWith<$Res> { + _$StacInkWellCopyWithImpl(this._self, this._then); + + final StacInkWell _self; + final $Res Function(StacInkWell) _then; + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? onTap = freezed, + Object? child = freezed, + }) { + return _then(_self.copyWith( + onTap: freezed == onTap + ? _self.onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + child: freezed == child + ? _self.child + : child // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _StacInkWell implements StacInkWell { + const _StacInkWell( + {required final Map? onTap, + required final Map? child}) + : _onTap = onTap, + _child = child; + factory _StacInkWell.fromJson(Map json) => + _$StacInkWellFromJson(json); + + final Map? _onTap; + @override + Map? get onTap { + final value = _onTap; + if (value == null) return null; + if (_onTap is EqualUnmodifiableMapView) return _onTap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _child; + @override + Map? get child { + final value = _child; + if (value == null) return null; + if (_child is EqualUnmodifiableMapView) return _child; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$StacInkWellCopyWith<_StacInkWell> get copyWith => + __$StacInkWellCopyWithImpl<_StacInkWell>(this, _$identity); + + @override + Map toJson() { + return _$StacInkWellToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _StacInkWell && + const DeepCollectionEquality().equals(other._onTap, _onTap) && + const DeepCollectionEquality().equals(other._child, _child)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_onTap), + const DeepCollectionEquality().hash(_child)); + + @override + String toString() { + return 'StacInkWell(onTap: $onTap, child: $child)'; + } +} + +/// @nodoc +abstract mixin class _$StacInkWellCopyWith<$Res> + implements $StacInkWellCopyWith<$Res> { + factory _$StacInkWellCopyWith( + _StacInkWell value, $Res Function(_StacInkWell) _then) = + __$StacInkWellCopyWithImpl; + @override + @useResult + $Res call({Map? onTap, Map? child}); +} + +/// @nodoc +class __$StacInkWellCopyWithImpl<$Res> implements _$StacInkWellCopyWith<$Res> { + __$StacInkWellCopyWithImpl(this._self, this._then); + + final _StacInkWell _self; + final $Res Function(_StacInkWell) _then; + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? onTap = freezed, + Object? child = freezed, + }) { + return _then(_StacInkWell( + onTap: freezed == onTap + ? _self._onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + child: freezed == child + ? _self._child + : child // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} + +// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.g.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.g.dart new file mode 100644 index 00000000..072f9243 --- /dev/null +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_inkwell.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_StacInkWell _$StacInkWellFromJson(Map json) => _StacInkWell( + onTap: json['onTap'] as Map?, + child: json['child'] as Map?, + ); + +Map _$StacInkWellToJson(_StacInkWell instance) => + { + 'onTap': instance.onTap, + 'child': instance.child, + }; From 11a36cd1280813becb276639e5576f202de26c77 Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Thu, 8 May 2025 02:39:07 +0530 Subject: [PATCH 03/10] feat: Register StacInkwellParser and update WidgetType enum to include inkWell --- packages/stac/lib/src/framework/stac.dart | 2 ++ packages/stac/lib/src/utils/widget_type.dart | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/stac/lib/src/framework/stac.dart b/packages/stac/lib/src/framework/stac.dart index 240dcf30..a81a8a2b 100644 --- a/packages/stac/lib/src/framework/stac.dart +++ b/packages/stac/lib/src/framework/stac.dart @@ -7,6 +7,7 @@ import 'package:flutter/services.dart'; import 'package:stac/src/framework/stac_registry.dart'; import 'package:stac/src/parsers/actions/stac_network_request/stac_network_request_parser.dart'; import 'package:stac/src/parsers/parsers.dart'; +import 'package:stac/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart'; import 'package:stac/src/services/stac_network_service.dart'; import 'package:stac/src/utils/log.dart'; import 'package:stac_framework/stac_framework.dart'; @@ -99,6 +100,7 @@ class Stac { const StacDropdownMenuParser(), const StacClipRRectParser(), const StacGestureDetectorParser(), + const StacInkwellParser(), ]; static final _actionParsers = [ diff --git a/packages/stac/lib/src/utils/widget_type.dart b/packages/stac/lib/src/utils/widget_type.dart index c84fb6d5..ef8dc155 100644 --- a/packages/stac/lib/src/utils/widget_type.dart +++ b/packages/stac/lib/src/utils/widget_type.dart @@ -38,6 +38,7 @@ enum WidgetType { icon, iconButton, image, + inkWell, limitedBox, linearProgressIndicator, listTile, From e3bd673066f135d7bbf81c594c6908f28f6a87f6 Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Thu, 8 May 2025 03:18:29 +0530 Subject: [PATCH 04/10] feat: Add Stac InkWell json --- .../stac_gallery/assets/json/home_screen.json | 23 ++++++++++++++++ .../assets/json/inkwell_example.json | 27 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 examples/stac_gallery/assets/json/inkwell_example.json diff --git a/examples/stac_gallery/assets/json/home_screen.json b/examples/stac_gallery/assets/json/home_screen.json index 54668640..bfcdd68c 100644 --- a/examples/stac_gallery/assets/json/home_screen.json +++ b/examples/stac_gallery/assets/json/home_screen.json @@ -1,4 +1,27 @@ [ + { + "type": "listTile", + "leading": { + "type": "icon", + "iconType": "cupertino", + "icon": "hand_draw" + }, + "title": { + "type": "text", + "data": "Stac InkWell" + }, + "subtitle": { + "type": "text", + "data": "Creates an Inkwell effect when tapped" + }, + "onTap": { + "actionType": "navigate", + "widgetJson": { + "type": "exampleScreen", + "assetPath": "assets/json/inkwell_example.json" + } + } + }, { "type": "listTile", "leading": { diff --git a/examples/stac_gallery/assets/json/inkwell_example.json b/examples/stac_gallery/assets/json/inkwell_example.json new file mode 100644 index 00000000..b5d89511 --- /dev/null +++ b/examples/stac_gallery/assets/json/inkwell_example.json @@ -0,0 +1,27 @@ +{ + "type": "scaffold", + "appBar": { + "type": "appBar", + "title": { + "type": "text", + "data": "InkWell" + } + }, + "body": { + "type": "listView", + "shrinkWrap": true, + "children": [ + { + "type": "sizedBox", + "height": 25 + }, + { + "type": "inkWell", + "child": { + "type": "text", + "data": "Hello, World! from Inkwell" + } + } + ] + } +} \ No newline at end of file From ae8123d701e2caf805bccb44bdf17720b74e5dfc Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Fri, 9 May 2025 03:00:01 +0530 Subject: [PATCH 05/10] feat: Enhance StacInkWell with additional gesture handlers and properties Added support for onDoubleTap, onLongPress, onTapDown, onTapUp, onTapCancel, onSecondaryTap, onSecondaryTapUp, onSecondaryTapDown, onSecondaryTapCancel, onHighlightChanged, and onHover in the StacInkWell model. --- .../widgets/stac_inkwell/stac_inkwell.dart | 35 +- .../stac_inkwell/stac_inkwell.freezed.dart | 936 +++++++++++++++++- .../widgets/stac_inkwell/stac_inkwell.g.dart | 110 +- .../stac_inkwell/stac_inkwell_parser.dart | 58 +- 4 files changed, 1103 insertions(+), 36 deletions(-) diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.dart index c250f1b0..8be95272 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.dart @@ -1,4 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:stac/src/parsers/widgets/stac_mouse_cursor/stac_mouse_cursor.dart'; +import 'package:stac/stac.dart'; part 'stac_inkwell.freezed.dart'; part 'stac_inkwell.g.dart'; @@ -6,8 +8,37 @@ part 'stac_inkwell.g.dart'; @freezed abstract class StacInkWell with _$StacInkWell { const factory StacInkWell({ - required Map? onTap, - required Map? child, + Map? child, + Map? onTap, + Map? onDoubleTap, + Map? onLongPress, + Map? onTapDown, + Map? onTapUp, + Map? onTapCancel, + Map? onSecondaryTap, + Map? onSecondaryTapUp, + Map? onSecondaryTapDown, + Map? onSecondaryTapCancel, + Map? onHighlightChanged, + Map? onHover, + StacMouseCursor? mouseCursor, + String? focusColor, + String? hoverColor, + String? highlightColor, + String? overlayColor, + String? splashColor, + Map? splashFactory, + double? radius, + StacBorderRadius? borderRadius, + StacBorder? customBorder, + @Default(true) bool enableFeedback, + @Default(false) bool excludeFromSemantics, + Map? focusNode, + @Default(true) bool canRequestFocus, + Map? onFocusChange, + @Default(false) bool autofocus, + Map? statesController, + StacDuration? hoverDuration, }) = _StacInkWell; factory StacInkWell.fromJson(Map json) => diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.freezed.dart index 41cac8b6..82c4631b 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.freezed.dart @@ -15,8 +15,37 @@ T _$identity(T value) => value; /// @nodoc mixin _$StacInkWell { - Map? get onTap; Map? get child; + Map? get onTap; + Map? get onDoubleTap; + Map? get onLongPress; + Map? get onTapDown; + Map? get onTapUp; + Map? get onTapCancel; + Map? get onSecondaryTap; + Map? get onSecondaryTapUp; + Map? get onSecondaryTapDown; + Map? get onSecondaryTapCancel; + Map? get onHighlightChanged; + Map? get onHover; + StacMouseCursor? get mouseCursor; + String? get focusColor; + String? get hoverColor; + String? get highlightColor; + String? get overlayColor; + String? get splashColor; + Map? get splashFactory; + double? get radius; + StacBorderRadius? get borderRadius; + StacBorder? get customBorder; + bool get enableFeedback; + bool get excludeFromSemantics; + Map? get focusNode; + bool get canRequestFocus; + Map? get onFocusChange; + bool get autofocus; + Map? get statesController; + StacDuration? get hoverDuration; /// Create a copy of StacInkWell /// with the given fields replaced by the non-null parameter values. @@ -33,20 +62,103 @@ mixin _$StacInkWell { return identical(this, other) || (other.runtimeType == runtimeType && other is StacInkWell && + const DeepCollectionEquality().equals(other.child, child) && const DeepCollectionEquality().equals(other.onTap, onTap) && - const DeepCollectionEquality().equals(other.child, child)); + const DeepCollectionEquality() + .equals(other.onDoubleTap, onDoubleTap) && + const DeepCollectionEquality() + .equals(other.onLongPress, onLongPress) && + const DeepCollectionEquality().equals(other.onTapDown, onTapDown) && + const DeepCollectionEquality().equals(other.onTapUp, onTapUp) && + const DeepCollectionEquality() + .equals(other.onTapCancel, onTapCancel) && + const DeepCollectionEquality() + .equals(other.onSecondaryTap, onSecondaryTap) && + const DeepCollectionEquality() + .equals(other.onSecondaryTapUp, onSecondaryTapUp) && + const DeepCollectionEquality() + .equals(other.onSecondaryTapDown, onSecondaryTapDown) && + const DeepCollectionEquality() + .equals(other.onSecondaryTapCancel, onSecondaryTapCancel) && + const DeepCollectionEquality() + .equals(other.onHighlightChanged, onHighlightChanged) && + const DeepCollectionEquality().equals(other.onHover, onHover) && + (identical(other.mouseCursor, mouseCursor) || + other.mouseCursor == mouseCursor) && + (identical(other.focusColor, focusColor) || + other.focusColor == focusColor) && + (identical(other.hoverColor, hoverColor) || + other.hoverColor == hoverColor) && + (identical(other.highlightColor, highlightColor) || + other.highlightColor == highlightColor) && + (identical(other.overlayColor, overlayColor) || + other.overlayColor == overlayColor) && + (identical(other.splashColor, splashColor) || + other.splashColor == splashColor) && + const DeepCollectionEquality() + .equals(other.splashFactory, splashFactory) && + (identical(other.radius, radius) || other.radius == radius) && + (identical(other.borderRadius, borderRadius) || + other.borderRadius == borderRadius) && + (identical(other.customBorder, customBorder) || + other.customBorder == customBorder) && + (identical(other.enableFeedback, enableFeedback) || + other.enableFeedback == enableFeedback) && + (identical(other.excludeFromSemantics, excludeFromSemantics) || + other.excludeFromSemantics == excludeFromSemantics) && + const DeepCollectionEquality().equals(other.focusNode, focusNode) && + (identical(other.canRequestFocus, canRequestFocus) || + other.canRequestFocus == canRequestFocus) && + const DeepCollectionEquality() + .equals(other.onFocusChange, onFocusChange) && + (identical(other.autofocus, autofocus) || + other.autofocus == autofocus) && + const DeepCollectionEquality() + .equals(other.statesController, statesController) && + (identical(other.hoverDuration, hoverDuration) || + other.hoverDuration == hoverDuration)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(onTap), - const DeepCollectionEquality().hash(child)); + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(child), + const DeepCollectionEquality().hash(onTap), + const DeepCollectionEquality().hash(onDoubleTap), + const DeepCollectionEquality().hash(onLongPress), + const DeepCollectionEquality().hash(onTapDown), + const DeepCollectionEquality().hash(onTapUp), + const DeepCollectionEquality().hash(onTapCancel), + const DeepCollectionEquality().hash(onSecondaryTap), + const DeepCollectionEquality().hash(onSecondaryTapUp), + const DeepCollectionEquality().hash(onSecondaryTapDown), + const DeepCollectionEquality().hash(onSecondaryTapCancel), + const DeepCollectionEquality().hash(onHighlightChanged), + const DeepCollectionEquality().hash(onHover), + mouseCursor, + focusColor, + hoverColor, + highlightColor, + overlayColor, + splashColor, + const DeepCollectionEquality().hash(splashFactory), + radius, + borderRadius, + customBorder, + enableFeedback, + excludeFromSemantics, + const DeepCollectionEquality().hash(focusNode), + canRequestFocus, + const DeepCollectionEquality().hash(onFocusChange), + autofocus, + const DeepCollectionEquality().hash(statesController), + hoverDuration + ]); @override String toString() { - return 'StacInkWell(onTap: $onTap, child: $child)'; + return 'StacInkWell(child: $child, onTap: $onTap, onDoubleTap: $onDoubleTap, onLongPress: $onLongPress, onTapDown: $onTapDown, onTapUp: $onTapUp, onTapCancel: $onTapCancel, onSecondaryTap: $onSecondaryTap, onSecondaryTapUp: $onSecondaryTapUp, onSecondaryTapDown: $onSecondaryTapDown, onSecondaryTapCancel: $onSecondaryTapCancel, onHighlightChanged: $onHighlightChanged, onHover: $onHover, mouseCursor: $mouseCursor, focusColor: $focusColor, hoverColor: $hoverColor, highlightColor: $highlightColor, overlayColor: $overlayColor, splashColor: $splashColor, splashFactory: $splashFactory, radius: $radius, borderRadius: $borderRadius, customBorder: $customBorder, enableFeedback: $enableFeedback, excludeFromSemantics: $excludeFromSemantics, focusNode: $focusNode, canRequestFocus: $canRequestFocus, onFocusChange: $onFocusChange, autofocus: $autofocus, statesController: $statesController, hoverDuration: $hoverDuration)'; } } @@ -56,7 +168,42 @@ abstract mixin class $StacInkWellCopyWith<$Res> { StacInkWell value, $Res Function(StacInkWell) _then) = _$StacInkWellCopyWithImpl; @useResult - $Res call({Map? onTap, Map? child}); + $Res call( + {Map? child, + Map? onTap, + Map? onDoubleTap, + Map? onLongPress, + Map? onTapDown, + Map? onTapUp, + Map? onTapCancel, + Map? onSecondaryTap, + Map? onSecondaryTapUp, + Map? onSecondaryTapDown, + Map? onSecondaryTapCancel, + Map? onHighlightChanged, + Map? onHover, + StacMouseCursor? mouseCursor, + String? focusColor, + String? hoverColor, + String? highlightColor, + String? overlayColor, + String? splashColor, + Map? splashFactory, + double? radius, + StacBorderRadius? borderRadius, + StacBorder? customBorder, + bool enableFeedback, + bool excludeFromSemantics, + Map? focusNode, + bool canRequestFocus, + Map? onFocusChange, + bool autofocus, + Map? statesController, + StacDuration? hoverDuration}); + + $StacBorderRadiusCopyWith<$Res>? get borderRadius; + $StacBorderCopyWith<$Res>? get customBorder; + $StacDurationCopyWith<$Res>? get hoverDuration; } /// @nodoc @@ -71,33 +218,274 @@ class _$StacInkWellCopyWithImpl<$Res> implements $StacInkWellCopyWith<$Res> { @pragma('vm:prefer-inline') @override $Res call({ - Object? onTap = freezed, Object? child = freezed, + Object? onTap = freezed, + Object? onDoubleTap = freezed, + Object? onLongPress = freezed, + Object? onTapDown = freezed, + Object? onTapUp = freezed, + Object? onTapCancel = freezed, + Object? onSecondaryTap = freezed, + Object? onSecondaryTapUp = freezed, + Object? onSecondaryTapDown = freezed, + Object? onSecondaryTapCancel = freezed, + Object? onHighlightChanged = freezed, + Object? onHover = freezed, + Object? mouseCursor = freezed, + Object? focusColor = freezed, + Object? hoverColor = freezed, + Object? highlightColor = freezed, + Object? overlayColor = freezed, + Object? splashColor = freezed, + Object? splashFactory = freezed, + Object? radius = freezed, + Object? borderRadius = freezed, + Object? customBorder = freezed, + Object? enableFeedback = null, + Object? excludeFromSemantics = null, + Object? focusNode = freezed, + Object? canRequestFocus = null, + Object? onFocusChange = freezed, + Object? autofocus = null, + Object? statesController = freezed, + Object? hoverDuration = freezed, }) { return _then(_self.copyWith( + child: freezed == child + ? _self.child + : child // ignore: cast_nullable_to_non_nullable + as Map?, onTap: freezed == onTap ? _self.onTap : onTap // ignore: cast_nullable_to_non_nullable as Map?, - child: freezed == child - ? _self.child - : child // ignore: cast_nullable_to_non_nullable + onDoubleTap: freezed == onDoubleTap + ? _self.onDoubleTap + : onDoubleTap // ignore: cast_nullable_to_non_nullable + as Map?, + onLongPress: freezed == onLongPress + ? _self.onLongPress + : onLongPress // ignore: cast_nullable_to_non_nullable + as Map?, + onTapDown: freezed == onTapDown + ? _self.onTapDown + : onTapDown // ignore: cast_nullable_to_non_nullable + as Map?, + onTapUp: freezed == onTapUp + ? _self.onTapUp + : onTapUp // ignore: cast_nullable_to_non_nullable + as Map?, + onTapCancel: freezed == onTapCancel + ? _self.onTapCancel + : onTapCancel // ignore: cast_nullable_to_non_nullable + as Map?, + onSecondaryTap: freezed == onSecondaryTap + ? _self.onSecondaryTap + : onSecondaryTap // ignore: cast_nullable_to_non_nullable + as Map?, + onSecondaryTapUp: freezed == onSecondaryTapUp + ? _self.onSecondaryTapUp + : onSecondaryTapUp // ignore: cast_nullable_to_non_nullable + as Map?, + onSecondaryTapDown: freezed == onSecondaryTapDown + ? _self.onSecondaryTapDown + : onSecondaryTapDown // ignore: cast_nullable_to_non_nullable + as Map?, + onSecondaryTapCancel: freezed == onSecondaryTapCancel + ? _self.onSecondaryTapCancel + : onSecondaryTapCancel // ignore: cast_nullable_to_non_nullable + as Map?, + onHighlightChanged: freezed == onHighlightChanged + ? _self.onHighlightChanged + : onHighlightChanged // ignore: cast_nullable_to_non_nullable + as Map?, + onHover: freezed == onHover + ? _self.onHover + : onHover // ignore: cast_nullable_to_non_nullable + as Map?, + mouseCursor: freezed == mouseCursor + ? _self.mouseCursor + : mouseCursor // ignore: cast_nullable_to_non_nullable + as StacMouseCursor?, + focusColor: freezed == focusColor + ? _self.focusColor + : focusColor // ignore: cast_nullable_to_non_nullable + as String?, + hoverColor: freezed == hoverColor + ? _self.hoverColor + : hoverColor // ignore: cast_nullable_to_non_nullable + as String?, + highlightColor: freezed == highlightColor + ? _self.highlightColor + : highlightColor // ignore: cast_nullable_to_non_nullable + as String?, + overlayColor: freezed == overlayColor + ? _self.overlayColor + : overlayColor // ignore: cast_nullable_to_non_nullable + as String?, + splashColor: freezed == splashColor + ? _self.splashColor + : splashColor // ignore: cast_nullable_to_non_nullable + as String?, + splashFactory: freezed == splashFactory + ? _self.splashFactory + : splashFactory // ignore: cast_nullable_to_non_nullable + as Map?, + radius: freezed == radius + ? _self.radius + : radius // ignore: cast_nullable_to_non_nullable + as double?, + borderRadius: freezed == borderRadius + ? _self.borderRadius + : borderRadius // ignore: cast_nullable_to_non_nullable + as StacBorderRadius?, + customBorder: freezed == customBorder + ? _self.customBorder + : customBorder // ignore: cast_nullable_to_non_nullable + as StacBorder?, + enableFeedback: null == enableFeedback + ? _self.enableFeedback + : enableFeedback // ignore: cast_nullable_to_non_nullable + as bool, + excludeFromSemantics: null == excludeFromSemantics + ? _self.excludeFromSemantics + : excludeFromSemantics // ignore: cast_nullable_to_non_nullable + as bool, + focusNode: freezed == focusNode + ? _self.focusNode + : focusNode // ignore: cast_nullable_to_non_nullable + as Map?, + canRequestFocus: null == canRequestFocus + ? _self.canRequestFocus + : canRequestFocus // ignore: cast_nullable_to_non_nullable + as bool, + onFocusChange: freezed == onFocusChange + ? _self.onFocusChange + : onFocusChange // ignore: cast_nullable_to_non_nullable + as Map?, + autofocus: null == autofocus + ? _self.autofocus + : autofocus // ignore: cast_nullable_to_non_nullable + as bool, + statesController: freezed == statesController + ? _self.statesController + : statesController // ignore: cast_nullable_to_non_nullable as Map?, + hoverDuration: freezed == hoverDuration + ? _self.hoverDuration + : hoverDuration // ignore: cast_nullable_to_non_nullable + as StacDuration?, )); } + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacBorderRadiusCopyWith<$Res>? get borderRadius { + if (_self.borderRadius == null) { + return null; + } + + return $StacBorderRadiusCopyWith<$Res>(_self.borderRadius!, (value) { + return _then(_self.copyWith(borderRadius: value)); + }); + } + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacBorderCopyWith<$Res>? get customBorder { + if (_self.customBorder == null) { + return null; + } + + return $StacBorderCopyWith<$Res>(_self.customBorder!, (value) { + return _then(_self.copyWith(customBorder: value)); + }); + } + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacDurationCopyWith<$Res>? get hoverDuration { + if (_self.hoverDuration == null) { + return null; + } + + return $StacDurationCopyWith<$Res>(_self.hoverDuration!, (value) { + return _then(_self.copyWith(hoverDuration: value)); + }); + } } /// @nodoc @JsonSerializable() class _StacInkWell implements StacInkWell { const _StacInkWell( - {required final Map? onTap, - required final Map? child}) - : _onTap = onTap, - _child = child; + {final Map? child, + final Map? onTap, + final Map? onDoubleTap, + final Map? onLongPress, + final Map? onTapDown, + final Map? onTapUp, + final Map? onTapCancel, + final Map? onSecondaryTap, + final Map? onSecondaryTapUp, + final Map? onSecondaryTapDown, + final Map? onSecondaryTapCancel, + final Map? onHighlightChanged, + final Map? onHover, + this.mouseCursor, + this.focusColor, + this.hoverColor, + this.highlightColor, + this.overlayColor, + this.splashColor, + final Map? splashFactory, + this.radius, + this.borderRadius, + this.customBorder, + this.enableFeedback = true, + this.excludeFromSemantics = false, + final Map? focusNode, + this.canRequestFocus = true, + final Map? onFocusChange, + this.autofocus = false, + final Map? statesController, + this.hoverDuration}) + : _child = child, + _onTap = onTap, + _onDoubleTap = onDoubleTap, + _onLongPress = onLongPress, + _onTapDown = onTapDown, + _onTapUp = onTapUp, + _onTapCancel = onTapCancel, + _onSecondaryTap = onSecondaryTap, + _onSecondaryTapUp = onSecondaryTapUp, + _onSecondaryTapDown = onSecondaryTapDown, + _onSecondaryTapCancel = onSecondaryTapCancel, + _onHighlightChanged = onHighlightChanged, + _onHover = onHover, + _splashFactory = splashFactory, + _focusNode = focusNode, + _onFocusChange = onFocusChange, + _statesController = statesController; factory _StacInkWell.fromJson(Map json) => _$StacInkWellFromJson(json); + final Map? _child; + @override + Map? get child { + final value = _child; + if (value == null) return null; + if (_child is EqualUnmodifiableMapView) return _child; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + final Map? _onTap; @override Map? get onTap { @@ -108,16 +496,192 @@ class _StacInkWell implements StacInkWell { return EqualUnmodifiableMapView(value); } - final Map? _child; + final Map? _onDoubleTap; @override - Map? get child { - final value = _child; + Map? get onDoubleTap { + final value = _onDoubleTap; if (value == null) return null; - if (_child is EqualUnmodifiableMapView) return _child; + if (_onDoubleTap is EqualUnmodifiableMapView) return _onDoubleTap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onLongPress; + @override + Map? get onLongPress { + final value = _onLongPress; + if (value == null) return null; + if (_onLongPress is EqualUnmodifiableMapView) return _onLongPress; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onTapDown; + @override + Map? get onTapDown { + final value = _onTapDown; + if (value == null) return null; + if (_onTapDown is EqualUnmodifiableMapView) return _onTapDown; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onTapUp; + @override + Map? get onTapUp { + final value = _onTapUp; + if (value == null) return null; + if (_onTapUp is EqualUnmodifiableMapView) return _onTapUp; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onTapCancel; + @override + Map? get onTapCancel { + final value = _onTapCancel; + if (value == null) return null; + if (_onTapCancel is EqualUnmodifiableMapView) return _onTapCancel; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onSecondaryTap; + @override + Map? get onSecondaryTap { + final value = _onSecondaryTap; + if (value == null) return null; + if (_onSecondaryTap is EqualUnmodifiableMapView) return _onSecondaryTap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onSecondaryTapUp; + @override + Map? get onSecondaryTapUp { + final value = _onSecondaryTapUp; + if (value == null) return null; + if (_onSecondaryTapUp is EqualUnmodifiableMapView) return _onSecondaryTapUp; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onSecondaryTapDown; + @override + Map? get onSecondaryTapDown { + final value = _onSecondaryTapDown; + if (value == null) return null; + if (_onSecondaryTapDown is EqualUnmodifiableMapView) + return _onSecondaryTapDown; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onSecondaryTapCancel; + @override + Map? get onSecondaryTapCancel { + final value = _onSecondaryTapCancel; + if (value == null) return null; + if (_onSecondaryTapCancel is EqualUnmodifiableMapView) + return _onSecondaryTapCancel; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onHighlightChanged; + @override + Map? get onHighlightChanged { + final value = _onHighlightChanged; + if (value == null) return null; + if (_onHighlightChanged is EqualUnmodifiableMapView) + return _onHighlightChanged; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onHover; + @override + Map? get onHover { + final value = _onHover; + if (value == null) return null; + if (_onHover is EqualUnmodifiableMapView) return _onHover; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + final StacMouseCursor? mouseCursor; + @override + final String? focusColor; + @override + final String? hoverColor; + @override + final String? highlightColor; + @override + final String? overlayColor; + @override + final String? splashColor; + final Map? _splashFactory; + @override + Map? get splashFactory { + final value = _splashFactory; + if (value == null) return null; + if (_splashFactory is EqualUnmodifiableMapView) return _splashFactory; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + final double? radius; + @override + final StacBorderRadius? borderRadius; + @override + final StacBorder? customBorder; + @override + @JsonKey() + final bool enableFeedback; + @override + @JsonKey() + final bool excludeFromSemantics; + final Map? _focusNode; + @override + Map? get focusNode { + final value = _focusNode; + if (value == null) return null; + if (_focusNode is EqualUnmodifiableMapView) return _focusNode; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + @JsonKey() + final bool canRequestFocus; + final Map? _onFocusChange; + @override + Map? get onFocusChange { + final value = _onFocusChange; + if (value == null) return null; + if (_onFocusChange is EqualUnmodifiableMapView) return _onFocusChange; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + @JsonKey() + final bool autofocus; + final Map? _statesController; + @override + Map? get statesController { + final value = _statesController; + if (value == null) return null; + if (_statesController is EqualUnmodifiableMapView) return _statesController; // ignore: implicit_dynamic_type return EqualUnmodifiableMapView(value); } + @override + final StacDuration? hoverDuration; + /// Create a copy of StacInkWell /// with the given fields replaced by the non-null parameter values. @override @@ -138,20 +702,105 @@ class _StacInkWell implements StacInkWell { return identical(this, other) || (other.runtimeType == runtimeType && other is _StacInkWell && + const DeepCollectionEquality().equals(other._child, _child) && const DeepCollectionEquality().equals(other._onTap, _onTap) && - const DeepCollectionEquality().equals(other._child, _child)); + const DeepCollectionEquality() + .equals(other._onDoubleTap, _onDoubleTap) && + const DeepCollectionEquality() + .equals(other._onLongPress, _onLongPress) && + const DeepCollectionEquality() + .equals(other._onTapDown, _onTapDown) && + const DeepCollectionEquality().equals(other._onTapUp, _onTapUp) && + const DeepCollectionEquality() + .equals(other._onTapCancel, _onTapCancel) && + const DeepCollectionEquality() + .equals(other._onSecondaryTap, _onSecondaryTap) && + const DeepCollectionEquality() + .equals(other._onSecondaryTapUp, _onSecondaryTapUp) && + const DeepCollectionEquality() + .equals(other._onSecondaryTapDown, _onSecondaryTapDown) && + const DeepCollectionEquality() + .equals(other._onSecondaryTapCancel, _onSecondaryTapCancel) && + const DeepCollectionEquality() + .equals(other._onHighlightChanged, _onHighlightChanged) && + const DeepCollectionEquality().equals(other._onHover, _onHover) && + (identical(other.mouseCursor, mouseCursor) || + other.mouseCursor == mouseCursor) && + (identical(other.focusColor, focusColor) || + other.focusColor == focusColor) && + (identical(other.hoverColor, hoverColor) || + other.hoverColor == hoverColor) && + (identical(other.highlightColor, highlightColor) || + other.highlightColor == highlightColor) && + (identical(other.overlayColor, overlayColor) || + other.overlayColor == overlayColor) && + (identical(other.splashColor, splashColor) || + other.splashColor == splashColor) && + const DeepCollectionEquality() + .equals(other._splashFactory, _splashFactory) && + (identical(other.radius, radius) || other.radius == radius) && + (identical(other.borderRadius, borderRadius) || + other.borderRadius == borderRadius) && + (identical(other.customBorder, customBorder) || + other.customBorder == customBorder) && + (identical(other.enableFeedback, enableFeedback) || + other.enableFeedback == enableFeedback) && + (identical(other.excludeFromSemantics, excludeFromSemantics) || + other.excludeFromSemantics == excludeFromSemantics) && + const DeepCollectionEquality() + .equals(other._focusNode, _focusNode) && + (identical(other.canRequestFocus, canRequestFocus) || + other.canRequestFocus == canRequestFocus) && + const DeepCollectionEquality() + .equals(other._onFocusChange, _onFocusChange) && + (identical(other.autofocus, autofocus) || + other.autofocus == autofocus) && + const DeepCollectionEquality() + .equals(other._statesController, _statesController) && + (identical(other.hoverDuration, hoverDuration) || + other.hoverDuration == hoverDuration)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_onTap), - const DeepCollectionEquality().hash(_child)); + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(_child), + const DeepCollectionEquality().hash(_onTap), + const DeepCollectionEquality().hash(_onDoubleTap), + const DeepCollectionEquality().hash(_onLongPress), + const DeepCollectionEquality().hash(_onTapDown), + const DeepCollectionEquality().hash(_onTapUp), + const DeepCollectionEquality().hash(_onTapCancel), + const DeepCollectionEquality().hash(_onSecondaryTap), + const DeepCollectionEquality().hash(_onSecondaryTapUp), + const DeepCollectionEquality().hash(_onSecondaryTapDown), + const DeepCollectionEquality().hash(_onSecondaryTapCancel), + const DeepCollectionEquality().hash(_onHighlightChanged), + const DeepCollectionEquality().hash(_onHover), + mouseCursor, + focusColor, + hoverColor, + highlightColor, + overlayColor, + splashColor, + const DeepCollectionEquality().hash(_splashFactory), + radius, + borderRadius, + customBorder, + enableFeedback, + excludeFromSemantics, + const DeepCollectionEquality().hash(_focusNode), + canRequestFocus, + const DeepCollectionEquality().hash(_onFocusChange), + autofocus, + const DeepCollectionEquality().hash(_statesController), + hoverDuration + ]); @override String toString() { - return 'StacInkWell(onTap: $onTap, child: $child)'; + return 'StacInkWell(child: $child, onTap: $onTap, onDoubleTap: $onDoubleTap, onLongPress: $onLongPress, onTapDown: $onTapDown, onTapUp: $onTapUp, onTapCancel: $onTapCancel, onSecondaryTap: $onSecondaryTap, onSecondaryTapUp: $onSecondaryTapUp, onSecondaryTapDown: $onSecondaryTapDown, onSecondaryTapCancel: $onSecondaryTapCancel, onHighlightChanged: $onHighlightChanged, onHover: $onHover, mouseCursor: $mouseCursor, focusColor: $focusColor, hoverColor: $hoverColor, highlightColor: $highlightColor, overlayColor: $overlayColor, splashColor: $splashColor, splashFactory: $splashFactory, radius: $radius, borderRadius: $borderRadius, customBorder: $customBorder, enableFeedback: $enableFeedback, excludeFromSemantics: $excludeFromSemantics, focusNode: $focusNode, canRequestFocus: $canRequestFocus, onFocusChange: $onFocusChange, autofocus: $autofocus, statesController: $statesController, hoverDuration: $hoverDuration)'; } } @@ -163,7 +812,45 @@ abstract mixin class _$StacInkWellCopyWith<$Res> __$StacInkWellCopyWithImpl; @override @useResult - $Res call({Map? onTap, Map? child}); + $Res call( + {Map? child, + Map? onTap, + Map? onDoubleTap, + Map? onLongPress, + Map? onTapDown, + Map? onTapUp, + Map? onTapCancel, + Map? onSecondaryTap, + Map? onSecondaryTapUp, + Map? onSecondaryTapDown, + Map? onSecondaryTapCancel, + Map? onHighlightChanged, + Map? onHover, + StacMouseCursor? mouseCursor, + String? focusColor, + String? hoverColor, + String? highlightColor, + String? overlayColor, + String? splashColor, + Map? splashFactory, + double? radius, + StacBorderRadius? borderRadius, + StacBorder? customBorder, + bool enableFeedback, + bool excludeFromSemantics, + Map? focusNode, + bool canRequestFocus, + Map? onFocusChange, + bool autofocus, + Map? statesController, + StacDuration? hoverDuration}); + + @override + $StacBorderRadiusCopyWith<$Res>? get borderRadius; + @override + $StacBorderCopyWith<$Res>? get customBorder; + @override + $StacDurationCopyWith<$Res>? get hoverDuration; } /// @nodoc @@ -178,20 +865,207 @@ class __$StacInkWellCopyWithImpl<$Res> implements _$StacInkWellCopyWith<$Res> { @override @pragma('vm:prefer-inline') $Res call({ - Object? onTap = freezed, Object? child = freezed, + Object? onTap = freezed, + Object? onDoubleTap = freezed, + Object? onLongPress = freezed, + Object? onTapDown = freezed, + Object? onTapUp = freezed, + Object? onTapCancel = freezed, + Object? onSecondaryTap = freezed, + Object? onSecondaryTapUp = freezed, + Object? onSecondaryTapDown = freezed, + Object? onSecondaryTapCancel = freezed, + Object? onHighlightChanged = freezed, + Object? onHover = freezed, + Object? mouseCursor = freezed, + Object? focusColor = freezed, + Object? hoverColor = freezed, + Object? highlightColor = freezed, + Object? overlayColor = freezed, + Object? splashColor = freezed, + Object? splashFactory = freezed, + Object? radius = freezed, + Object? borderRadius = freezed, + Object? customBorder = freezed, + Object? enableFeedback = null, + Object? excludeFromSemantics = null, + Object? focusNode = freezed, + Object? canRequestFocus = null, + Object? onFocusChange = freezed, + Object? autofocus = null, + Object? statesController = freezed, + Object? hoverDuration = freezed, }) { return _then(_StacInkWell( + child: freezed == child + ? _self._child + : child // ignore: cast_nullable_to_non_nullable + as Map?, onTap: freezed == onTap ? _self._onTap : onTap // ignore: cast_nullable_to_non_nullable as Map?, - child: freezed == child - ? _self._child - : child // ignore: cast_nullable_to_non_nullable + onDoubleTap: freezed == onDoubleTap + ? _self._onDoubleTap + : onDoubleTap // ignore: cast_nullable_to_non_nullable + as Map?, + onLongPress: freezed == onLongPress + ? _self._onLongPress + : onLongPress // ignore: cast_nullable_to_non_nullable + as Map?, + onTapDown: freezed == onTapDown + ? _self._onTapDown + : onTapDown // ignore: cast_nullable_to_non_nullable + as Map?, + onTapUp: freezed == onTapUp + ? _self._onTapUp + : onTapUp // ignore: cast_nullable_to_non_nullable + as Map?, + onTapCancel: freezed == onTapCancel + ? _self._onTapCancel + : onTapCancel // ignore: cast_nullable_to_non_nullable + as Map?, + onSecondaryTap: freezed == onSecondaryTap + ? _self._onSecondaryTap + : onSecondaryTap // ignore: cast_nullable_to_non_nullable + as Map?, + onSecondaryTapUp: freezed == onSecondaryTapUp + ? _self._onSecondaryTapUp + : onSecondaryTapUp // ignore: cast_nullable_to_non_nullable + as Map?, + onSecondaryTapDown: freezed == onSecondaryTapDown + ? _self._onSecondaryTapDown + : onSecondaryTapDown // ignore: cast_nullable_to_non_nullable + as Map?, + onSecondaryTapCancel: freezed == onSecondaryTapCancel + ? _self._onSecondaryTapCancel + : onSecondaryTapCancel // ignore: cast_nullable_to_non_nullable + as Map?, + onHighlightChanged: freezed == onHighlightChanged + ? _self._onHighlightChanged + : onHighlightChanged // ignore: cast_nullable_to_non_nullable as Map?, + onHover: freezed == onHover + ? _self._onHover + : onHover // ignore: cast_nullable_to_non_nullable + as Map?, + mouseCursor: freezed == mouseCursor + ? _self.mouseCursor + : mouseCursor // ignore: cast_nullable_to_non_nullable + as StacMouseCursor?, + focusColor: freezed == focusColor + ? _self.focusColor + : focusColor // ignore: cast_nullable_to_non_nullable + as String?, + hoverColor: freezed == hoverColor + ? _self.hoverColor + : hoverColor // ignore: cast_nullable_to_non_nullable + as String?, + highlightColor: freezed == highlightColor + ? _self.highlightColor + : highlightColor // ignore: cast_nullable_to_non_nullable + as String?, + overlayColor: freezed == overlayColor + ? _self.overlayColor + : overlayColor // ignore: cast_nullable_to_non_nullable + as String?, + splashColor: freezed == splashColor + ? _self.splashColor + : splashColor // ignore: cast_nullable_to_non_nullable + as String?, + splashFactory: freezed == splashFactory + ? _self._splashFactory + : splashFactory // ignore: cast_nullable_to_non_nullable + as Map?, + radius: freezed == radius + ? _self.radius + : radius // ignore: cast_nullable_to_non_nullable + as double?, + borderRadius: freezed == borderRadius + ? _self.borderRadius + : borderRadius // ignore: cast_nullable_to_non_nullable + as StacBorderRadius?, + customBorder: freezed == customBorder + ? _self.customBorder + : customBorder // ignore: cast_nullable_to_non_nullable + as StacBorder?, + enableFeedback: null == enableFeedback + ? _self.enableFeedback + : enableFeedback // ignore: cast_nullable_to_non_nullable + as bool, + excludeFromSemantics: null == excludeFromSemantics + ? _self.excludeFromSemantics + : excludeFromSemantics // ignore: cast_nullable_to_non_nullable + as bool, + focusNode: freezed == focusNode + ? _self._focusNode + : focusNode // ignore: cast_nullable_to_non_nullable + as Map?, + canRequestFocus: null == canRequestFocus + ? _self.canRequestFocus + : canRequestFocus // ignore: cast_nullable_to_non_nullable + as bool, + onFocusChange: freezed == onFocusChange + ? _self._onFocusChange + : onFocusChange // ignore: cast_nullable_to_non_nullable + as Map?, + autofocus: null == autofocus + ? _self.autofocus + : autofocus // ignore: cast_nullable_to_non_nullable + as bool, + statesController: freezed == statesController + ? _self._statesController + : statesController // ignore: cast_nullable_to_non_nullable + as Map?, + hoverDuration: freezed == hoverDuration + ? _self.hoverDuration + : hoverDuration // ignore: cast_nullable_to_non_nullable + as StacDuration?, )); } + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacBorderRadiusCopyWith<$Res>? get borderRadius { + if (_self.borderRadius == null) { + return null; + } + + return $StacBorderRadiusCopyWith<$Res>(_self.borderRadius!, (value) { + return _then(_self.copyWith(borderRadius: value)); + }); + } + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacBorderCopyWith<$Res>? get customBorder { + if (_self.customBorder == null) { + return null; + } + + return $StacBorderCopyWith<$Res>(_self.customBorder!, (value) { + return _then(_self.copyWith(customBorder: value)); + }); + } + + /// Create a copy of StacInkWell + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacDurationCopyWith<$Res>? get hoverDuration { + if (_self.hoverDuration == null) { + return null; + } + + return $StacDurationCopyWith<$Res>(_self.hoverDuration!, (value) { + return _then(_self.copyWith(hoverDuration: value)); + }); + } } // dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.g.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.g.dart index 072f9243..1c9348a1 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.g.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell.g.dart @@ -7,12 +7,118 @@ part of 'stac_inkwell.dart'; // ************************************************************************** _StacInkWell _$StacInkWellFromJson(Map json) => _StacInkWell( - onTap: json['onTap'] as Map?, child: json['child'] as Map?, + onTap: json['onTap'] as Map?, + onDoubleTap: json['onDoubleTap'] as Map?, + onLongPress: json['onLongPress'] as Map?, + onTapDown: json['onTapDown'] as Map?, + onTapUp: json['onTapUp'] as Map?, + onTapCancel: json['onTapCancel'] as Map?, + onSecondaryTap: json['onSecondaryTap'] as Map?, + onSecondaryTapUp: json['onSecondaryTapUp'] as Map?, + onSecondaryTapDown: json['onSecondaryTapDown'] as Map?, + onSecondaryTapCancel: + json['onSecondaryTapCancel'] as Map?, + onHighlightChanged: json['onHighlightChanged'] as Map?, + onHover: json['onHover'] as Map?, + mouseCursor: + $enumDecodeNullable(_$StacMouseCursorEnumMap, json['mouseCursor']), + focusColor: json['focusColor'] as String?, + hoverColor: json['hoverColor'] as String?, + highlightColor: json['highlightColor'] as String?, + overlayColor: json['overlayColor'] as String?, + splashColor: json['splashColor'] as String?, + splashFactory: json['splashFactory'] as Map?, + radius: (json['radius'] as num?)?.toDouble(), + borderRadius: json['borderRadius'] == null + ? null + : StacBorderRadius.fromJson(json['borderRadius']), + customBorder: json['customBorder'] == null + ? null + : StacBorder.fromJson(json['customBorder'] as Map), + enableFeedback: json['enableFeedback'] as bool? ?? true, + excludeFromSemantics: json['excludeFromSemantics'] as bool? ?? false, + focusNode: json['focusNode'] as Map?, + canRequestFocus: json['canRequestFocus'] as bool? ?? true, + onFocusChange: json['onFocusChange'] as Map?, + autofocus: json['autofocus'] as bool? ?? false, + statesController: json['statesController'] as Map?, + hoverDuration: json['hoverDuration'] == null + ? null + : StacDuration.fromJson( + json['hoverDuration'] as Map), ); Map _$StacInkWellToJson(_StacInkWell instance) => { - 'onTap': instance.onTap, 'child': instance.child, + 'onTap': instance.onTap, + 'onDoubleTap': instance.onDoubleTap, + 'onLongPress': instance.onLongPress, + 'onTapDown': instance.onTapDown, + 'onTapUp': instance.onTapUp, + 'onTapCancel': instance.onTapCancel, + 'onSecondaryTap': instance.onSecondaryTap, + 'onSecondaryTapUp': instance.onSecondaryTapUp, + 'onSecondaryTapDown': instance.onSecondaryTapDown, + 'onSecondaryTapCancel': instance.onSecondaryTapCancel, + 'onHighlightChanged': instance.onHighlightChanged, + 'onHover': instance.onHover, + 'mouseCursor': _$StacMouseCursorEnumMap[instance.mouseCursor], + 'focusColor': instance.focusColor, + 'hoverColor': instance.hoverColor, + 'highlightColor': instance.highlightColor, + 'overlayColor': instance.overlayColor, + 'splashColor': instance.splashColor, + 'splashFactory': instance.splashFactory, + 'radius': instance.radius, + 'borderRadius': instance.borderRadius, + 'customBorder': instance.customBorder, + 'enableFeedback': instance.enableFeedback, + 'excludeFromSemantics': instance.excludeFromSemantics, + 'focusNode': instance.focusNode, + 'canRequestFocus': instance.canRequestFocus, + 'onFocusChange': instance.onFocusChange, + 'autofocus': instance.autofocus, + 'statesController': instance.statesController, + 'hoverDuration': instance.hoverDuration, }; + +const _$StacMouseCursorEnumMap = { + StacMouseCursor.none: 'none', + StacMouseCursor.basic: 'basic', + StacMouseCursor.click: 'click', + StacMouseCursor.forbidden: 'forbidden', + StacMouseCursor.wait: 'wait', + StacMouseCursor.progress: 'progress', + StacMouseCursor.contextMenu: 'contextMenu', + StacMouseCursor.help: 'help', + StacMouseCursor.text: 'text', + StacMouseCursor.verticalText: 'verticalText', + StacMouseCursor.cell: 'cell', + StacMouseCursor.precise: 'precise', + StacMouseCursor.move: 'move', + StacMouseCursor.grab: 'grab', + StacMouseCursor.grabbing: 'grabbing', + StacMouseCursor.noDrop: 'noDrop', + StacMouseCursor.alias: 'alias', + StacMouseCursor.copy: 'copy', + StacMouseCursor.disappearing: 'disappearing', + StacMouseCursor.allScroll: 'allScroll', + StacMouseCursor.resizeLeftRight: 'resizeLeftRight', + StacMouseCursor.resizeUpDown: 'resizeUpDown', + StacMouseCursor.resizeUpLeftDownRight: 'resizeUpLeftDownRight', + StacMouseCursor.resizeUpRightDownLeft: 'resizeUpRightDownLeft', + StacMouseCursor.resizeUp: 'resizeUp', + StacMouseCursor.resizeDown: 'resizeDown', + StacMouseCursor.resizeLeft: 'resizeLeft', + StacMouseCursor.resizeRight: 'resizeRight', + StacMouseCursor.resizeUpLeft: 'resizeUpLeft', + StacMouseCursor.resizeUpRight: 'resizeUpRight', + StacMouseCursor.resizeDownLeft: 'resizeDownLeft', + StacMouseCursor.resizeDownRight: 'resizeDownRight', + StacMouseCursor.resizeColumn: 'resizeColumn', + StacMouseCursor.resizeRow: 'resizeRow', + StacMouseCursor.zoomIn: 'zoomIn', + StacMouseCursor.zoomOut: 'zoomOut', +}; diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart index 7d9fb299..f7f649f7 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart @@ -15,8 +15,64 @@ class StacInkwellParser extends StacParser { @override Widget parse(BuildContext context, StacInkWell model) { return InkWell( - onTap: () => Stac.onCallFromJson(model.onTap, context), child: Stac.fromJson(model.child, context), + onTap: model.onTap == null + ? null + : () => Stac.onCallFromJson(model.onTap, context), + onDoubleTap: model.onDoubleTap == null + ? null + : () => Stac.onCallFromJson(model.onDoubleTap, context), + onLongPress: model.onLongPress == null + ? null + : () => Stac.onCallFromJson(model.onLongPress, context), + onTapDown: model.onTapDown == null + ? null + : (_) => Stac.onCallFromJson(model.onTapDown, context), + onTapUp: model.onTapUp == null + ? null + : (_) => Stac.onCallFromJson(model.onTapUp, context), + onTapCancel: model.onTapCancel == null + ? null + : () => Stac.onCallFromJson(model.onTapCancel, context), + onSecondaryTap: model.onSecondaryTap == null + ? null + : () => Stac.onCallFromJson(model.onSecondaryTap, context), + onSecondaryTapUp: model.onSecondaryTapUp == null + ? null + : (_) => Stac.onCallFromJson(model.onSecondaryTapUp, context), + onSecondaryTapDown: model.onSecondaryTapDown == null + ? null + : (_) => Stac.onCallFromJson(model.onSecondaryTapDown, context), + onSecondaryTapCancel: model.onSecondaryTapCancel == null + ? null + : () => Stac.onCallFromJson(model.onSecondaryTapCancel, context), + onHighlightChanged: model.onHighlightChanged == null + ? null + : (_) => Stac.onCallFromJson(model.onHighlightChanged, context), + onHover: model.onHover == null + ? null + : (_) => Stac.onCallFromJson(model.onHover, context), + mouseCursor: model.mouseCursor?.value, + focusColor: model.focusColor.toColor(context), + hoverColor: model.hoverColor.toColor(context), + highlightColor: model.highlightColor.toColor(context), + overlayColor: + WidgetStateProperty.all(model.overlayColor?.toColor(context)), + splashColor: model.splashColor.toColor(context), + radius: model.radius, + borderRadius: model.borderRadius.parse, + customBorder: model.customBorder?.parse(context), + enableFeedback: model.enableFeedback, + excludeFromSemantics: model.excludeFromSemantics, + canRequestFocus: model.canRequestFocus, + onFocusChange: (_) => Stac.onCallFromJson(model.onFocusChange, context), + autofocus: model.autofocus, + hoverDuration: model.hoverDuration?.parse, + + ///TODO : need to add support for + ///focusNode + ///splashFactory + ///statesController ); } } From 20ff470b22e02ebdb5d2829a4984b6163a46be11 Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Fri, 9 May 2025 03:00:43 +0530 Subject: [PATCH 06/10] feat: Refactor inkWell example JSON structure for improved clarity and functionality --- .../assets/json/inkwell_example.json | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/examples/stac_gallery/assets/json/inkwell_example.json b/examples/stac_gallery/assets/json/inkwell_example.json index b5d89511..3c409e81 100644 --- a/examples/stac_gallery/assets/json/inkwell_example.json +++ b/examples/stac_gallery/assets/json/inkwell_example.json @@ -12,14 +12,35 @@ "shrinkWrap": true, "children": [ { - "type": "sizedBox", - "height": 25 - }, - { - "type": "inkWell", + "type": "center", "child": { - "type": "text", - "data": "Hello, World! from Inkwell" + "type": "inkWell", + "child": { + "type": "padding", + "padding": { + "top": 20, + "bottom": 20, + "right": 20, + "left": 20 + }, + "child": { + "type": "text", + "data": "Hello, World! from Inkwell", + "textAlign": "center" + } + }, + "splashColor": "#E1BEE7", + "borderRadius_": { + "topLeft": 20, + "topRight": 20, + "bottomLeft": 20, + "bottomRight": 20 + }, + "radius": 20, + "hoverDuration": { + "seconds": 10 + }, + "onTap": {} } } ] From a0207315a36407a92e1c6fce48ba6a028ccf5ea3 Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Fri, 9 May 2025 03:14:43 +0530 Subject: [PATCH 07/10] feat: Add Stac InkWell documentation with properties and example JSON --- website/docs/widgets/ink_well.md | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 website/docs/widgets/ink_well.md diff --git a/website/docs/widgets/ink_well.md b/website/docs/widgets/ink_well.md new file mode 100644 index 00000000..769c61f6 --- /dev/null +++ b/website/docs/widgets/ink_well.md @@ -0,0 +1,71 @@ +# InkWell + +**Stac InkWell** allows you to build the Flutter `InkWell` widget using JSON. +To learn more about the `InkWell` widget in Flutter, refer to the [official documentation](https://api.flutter.dev/flutter/material/InkWell-class.html). + + +## Properties +| Property | Type | Description | +|-------------------------|------------------------------|-----------------------------------------------------------------------------| +| `child` | `Map?` | The widget below this InkWell. | +| `onTap` | `Map?` | Called when the user taps the InkWell. | +| `onDoubleTap` | `Map?` | Called when the user double taps the InkWell. | +| `onLongPress` | `Map?` | Called when the user presses and holds for a long duration. | +| `onTapDown` | `Map?` | Called when a tap gesture starts. | +| `onTapUp` | `Map?` | Called when a tap gesture is lifted. | +| `onTapCancel` | `Map?` | Called when a tap gesture is aborted. | +| `onSecondaryTap` | `Map?` | Called for a secondary tap (e.g., right-click on desktop). | +| `onSecondaryTapUp` | `Map?` | Called when a secondary tap is lifted. | +| `onSecondaryTapDown` | `Map?` | Called when a secondary tap gesture starts. | +| `onSecondaryTapCancel` | `Map?` | Called when a secondary tap gesture is aborted. | +| `onHighlightChanged` | `Map?` | Called when the InkWell highlight changes (pressed state). | +| `onHover` | `Map?` | Called when a pointer enters or exits the widget area. | +| `mouseCursor` | `StacMouseCursor?` | Defines the mouse cursor when it hovers over the InkWell. | +| `focusColor` | `String?` | Color of the focus highlight. | +| `hoverColor` | `String?` | Color when a pointer hovers over the InkWell. | +| `highlightColor` | `String?` | Color when the InkWell is pressed. | +| `overlayColor` | `String?` | Ripple effect color over the child. | +| `splashColor` | `String?` | The splash color of the ripple. | +| `radius` | `double?` | Defines the splash radius. | +| `borderRadius` | `StacBorderRadius?` | Sets rounded corners for the ripple effect. | +| `customBorder` | `StacBorder?` | Custom border shape for clipping and ripple. | +| `enableFeedback` | `@Default(true) bool` | Whether to play feedback (e.g., sound, vibration) on tap. | +| `excludeFromSemantics` | `@Default(false) bool` | Whether to exclude from accessibility tools like screen readers. | +| `canRequestFocus` | `@Default(true) bool` | Whether this widget can request focus. | +| `onFocusChange` | `Map?` | Callback for when the focus changes. | +| `autofocus` | `@Default(false) bool` | Automatically focuses when the widget is built. | +| `hoverDuration` | `StacDuration?` | Duration for the hover animation effect. | + +## Example JSON + +```json +{ + "type": "inkWell", + "child": { + "type": "padding", + "padding": { + "top": 20, + "bottom": 20, + "right": 20, + "left": 20 + }, + "child": { + "type": "text", + "data": "Hello, World! from Inkwell", + "textAlign": "center" + } + }, + "splashColor": "#E1BEE7", + "borderRadius": { + "topLeft": 20, + "topRight": 20, + "bottomLeft": 20, + "bottomRight": 20 + }, + "radius": 20, + "hoverDuration": { + "seconds": 10 + }, + "onTap": {} +} +``` From c84f00b995d5b861c7231dd5891c236f4ce40c86 Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Fri, 9 May 2025 18:17:21 +0530 Subject: [PATCH 08/10] add empty line in StacInkwellParser for better readability. --- .../src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart index f7f649f7..a1de39e6 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart @@ -4,9 +4,12 @@ import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/stac.dart'; class StacInkwellParser extends StacParser { + const StacInkwellParser(); + @override String get type => WidgetType.inkWell.name; + @override StacInkWell getModel(Map json) { return StacInkWell.fromJson(json); From 6392baae2ef150f4220cafb4b7fbf108b23b64f7 Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Fri, 9 May 2025 18:18:35 +0530 Subject: [PATCH 09/10] feat: update home_screen by moving Inkwell to alphabetical order and added onTap functionality to Inkwell --- .../stac_gallery/assets/json/home_screen.json | 46 +++++++++---------- .../assets/json/inkwell_example.json | 13 +++++- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/examples/stac_gallery/assets/json/home_screen.json b/examples/stac_gallery/assets/json/home_screen.json index 9b8572cd..7170a978 100644 --- a/examples/stac_gallery/assets/json/home_screen.json +++ b/examples/stac_gallery/assets/json/home_screen.json @@ -1,27 +1,4 @@ [ - { - "type": "listTile", - "leading": { - "type": "icon", - "iconType": "cupertino", - "icon": "hand_draw" - }, - "title": { - "type": "text", - "data": "Stac InkWell" - }, - "subtitle": { - "type": "text", - "data": "Creates an Inkwell effect when tapped" - }, - "onTap": { - "actionType": "navigate", - "widgetJson": { - "type": "exampleScreen", - "assetPath": "assets/json/inkwell_example.json" - } - } - }, { "type": "listTile", "leading": { @@ -398,6 +375,29 @@ } } }, + { + "type": "listTile", + "leading": { + "type": "icon", + "iconType": "cupertino", + "icon": "hand_draw" + }, + "title": { + "type": "text", + "data": "Stac InkWell" + }, + "subtitle": { + "type": "text", + "data": "Creates an Inkwell effect when tapped" + }, + "onTap": { + "actionType": "navigate", + "widgetJson": { + "type": "exampleScreen", + "assetPath": "assets/json/inkwell_example.json" + } + } + }, { "type": "listTile", "leading": { diff --git a/examples/stac_gallery/assets/json/inkwell_example.json b/examples/stac_gallery/assets/json/inkwell_example.json index 3c409e81..5192b532 100644 --- a/examples/stac_gallery/assets/json/inkwell_example.json +++ b/examples/stac_gallery/assets/json/inkwell_example.json @@ -30,7 +30,7 @@ } }, "splashColor": "#E1BEE7", - "borderRadius_": { + "borderRadius": { "topLeft": 20, "topRight": 20, "bottomLeft": 20, @@ -40,7 +40,16 @@ "hoverDuration": { "seconds": 10 }, - "onTap": {} + "onTap": { + "actionType": "showDialog", + "widget": { + "type": "alertDialog", + "title": { + "type": "text", + "data": "On Tap Successful" + } + } + } } } ] From 2c87de5c9b759b078ba974f28b9a6acd584f9cf2 Mon Sep 17 00:00:00 2001 From: Abhijith K Date: Sat, 10 May 2025 21:39:37 +0530 Subject: [PATCH 10/10] fix: remove unnecessary empty line in StacInkwellParser for cleaner code --- .../src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart index a1de39e6..2c66a6f5 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart @@ -4,7 +4,6 @@ import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/stac.dart'; class StacInkwellParser extends StacParser { - const StacInkwellParser(); @override