From 23e7de1de5b3e62e1564cae92636d2943064ec89 Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Sun, 13 Apr 2025 22:29:37 +0100 Subject: [PATCH 1/9] parser --- examples/counter_example/.fvm/flutter_sdk | 1 + examples/counter_example/.fvm/fvm_config.json | 4 + examples/stac_gallery/.fvm/flutter_sdk | 1 + examples/stac_gallery/.fvm/fvm_config.json | 4 + examples/stac_gallery/ios/Podfile.lock | 2 +- examples/stac_gallery/pubspec.lock | 4 +- packages/stac/.fvm/flutter_sdk | 1 + packages/stac/.fvm/fvm_config.json | 4 + packages/stac/lib/src/framework/stac.dart | 2 + .../stac_dropdown_menu.dart | 56 ++ .../stac_dropdown_menu.freezed.dart | 833 ++++++++++++++++++ .../stac_dropdown_menu.g.dart | 112 +++ .../stac_dropdown_menu_parser.dart | 87 ++ .../stac_dropdown_menu_entry.dart | 37 + .../stac_dropdown_menu_entry.freezed.dart | 360 ++++++++ .../stac_dropdown_menu_entry.g.dart | 33 + packages/stac/lib/src/utils/widget_type.dart | 1 + packages/stac/pubspec.yaml | 2 +- 18 files changed, 1540 insertions(+), 4 deletions(-) create mode 120000 examples/counter_example/.fvm/flutter_sdk create mode 100644 examples/counter_example/.fvm/fvm_config.json create mode 120000 examples/stac_gallery/.fvm/flutter_sdk create mode 100644 examples/stac_gallery/.fvm/fvm_config.json create mode 120000 packages/stac/.fvm/flutter_sdk create mode 100644 packages/stac/.fvm/fvm_config.json create mode 100644 packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart create mode 100644 packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.freezed.dart create mode 100644 packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.g.dart create mode 100644 packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart create mode 100644 packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart create mode 100644 packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.freezed.dart create mode 100644 packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.g.dart diff --git a/examples/counter_example/.fvm/flutter_sdk b/examples/counter_example/.fvm/flutter_sdk new file mode 120000 index 00000000..2b58a78d --- /dev/null +++ b/examples/counter_example/.fvm/flutter_sdk @@ -0,0 +1 @@ +/Users/Apple/fvm/versions/3.29.0 \ No newline at end of file diff --git a/examples/counter_example/.fvm/fvm_config.json b/examples/counter_example/.fvm/fvm_config.json new file mode 100644 index 00000000..22008a21 --- /dev/null +++ b/examples/counter_example/.fvm/fvm_config.json @@ -0,0 +1,4 @@ +{ + "flutterSdkVersion": "3.29.0", + "flavors": {} +} \ No newline at end of file diff --git a/examples/stac_gallery/.fvm/flutter_sdk b/examples/stac_gallery/.fvm/flutter_sdk new file mode 120000 index 00000000..2b58a78d --- /dev/null +++ b/examples/stac_gallery/.fvm/flutter_sdk @@ -0,0 +1 @@ +/Users/Apple/fvm/versions/3.29.0 \ No newline at end of file diff --git a/examples/stac_gallery/.fvm/fvm_config.json b/examples/stac_gallery/.fvm/fvm_config.json new file mode 100644 index 00000000..22008a21 --- /dev/null +++ b/examples/stac_gallery/.fvm/fvm_config.json @@ -0,0 +1,4 @@ +{ + "flutterSdkVersion": "3.29.0", + "flavors": {} +} \ No newline at end of file diff --git a/examples/stac_gallery/ios/Podfile.lock b/examples/stac_gallery/ios/Podfile.lock index 5dcbd522..1298d87a 100644 --- a/examples/stac_gallery/ios/Podfile.lock +++ b/examples/stac_gallery/ios/Podfile.lock @@ -16,7 +16,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - webview_flutter_wkwebview: 1821ceac936eba6f7984d89a9f3bcb4dea99ebb2 + webview_flutter_wkwebview: a4af96a051138e28e29f60101d094683b9f82188 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 diff --git a/examples/stac_gallery/pubspec.lock b/examples/stac_gallery/pubspec.lock index a84d8da9..826e220b 100644 --- a/examples/stac_gallery/pubspec.lock +++ b/examples/stac_gallery/pubspec.lock @@ -327,10 +327,10 @@ packages: dependency: transitive description: name: js - sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.1" json_annotation: dependency: "direct main" description: diff --git a/packages/stac/.fvm/flutter_sdk b/packages/stac/.fvm/flutter_sdk new file mode 120000 index 00000000..2b58a78d --- /dev/null +++ b/packages/stac/.fvm/flutter_sdk @@ -0,0 +1 @@ +/Users/Apple/fvm/versions/3.29.0 \ No newline at end of file diff --git a/packages/stac/.fvm/fvm_config.json b/packages/stac/.fvm/fvm_config.json new file mode 100644 index 00000000..22008a21 --- /dev/null +++ b/packages/stac/.fvm/fvm_config.json @@ -0,0 +1,4 @@ +{ + "flutterSdkVersion": "3.29.0", + "flavors": {} +} \ No newline at end of file diff --git a/packages/stac/lib/src/framework/stac.dart b/packages/stac/lib/src/framework/stac.dart index 4e28a9e5..0933bd49 100644 --- a/packages/stac/lib/src/framework/stac.dart +++ b/packages/stac/lib/src/framework/stac.dart @@ -9,6 +9,7 @@ import 'package:stac/src/action_parsers/stac_network_request/stac_network_reques import 'package:stac/src/framework/stac_registry.dart'; import 'package:stac/src/parsers/parsers.dart'; import 'package:stac/src/parsers/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart'; +import 'package:stac/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart'; import 'package:stac/src/parsers/stac_sliver_app_bar/stac_sliver_app_bar_parser.dart'; import 'package:stac/src/services/stac_network_service.dart'; import 'package:stac/src/utils/log.dart'; @@ -99,6 +100,7 @@ class Stac { const StacFittedBoxParser(), const StacLimitedBoxParser(), const StacDynamicViewParser(), + const StacDropdownMenuParser() ]; static final _actionParsers = [ diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart new file mode 100644 index 00000000..cee66ec8 --- /dev/null +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart @@ -0,0 +1,56 @@ +import 'package:flutter/material.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:stac/src/parsers/parsers.dart'; +import 'package:stac/src/parsers/stac_input_decoration_theme/stac_input_decoration_theme.dart'; +import 'package:stac/src/parsers/stac_offset/stac_offset.dart'; +import 'package:stac/src/utils/text_input_utils.dart'; + +import '../stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; + +export 'package:stac/src/parsers/stac_container/stac_container_parser.dart'; + +part 'stac_dropdown_menu.freezed.dart'; +part 'stac_dropdown_menu.g.dart'; + +@freezed +abstract class StacDropdownMenu with _$StacDropdownMenu { + const factory StacDropdownMenu( + {@Default(true) bool enabled, + double? width, + double? menuHeight, + Map? leadingIcon, + Map? trailingIcon, + Map? label, + String? hintText, + String? helperText, + String? errorText, + Map? selectedTrailingIcon, + bool? enableFilter, + bool? enableSearch, + StacTextInputType? keyboardType, + StacTextStyle? textStyle, + @Default(TextAlign.start) TextAlign textAlign, + StacInputDecorationTheme? inputDecorationTheme, + @Default([]) List inputFormatters, + StacOffset? alignmentOffset, + StacEdgeInsets? expandedInsets, + bool? requestFocusOnTap, + + // TextEditingController? controller; + // T? initialSelection; + // ValueChanged? onSelected; + // FocusNode? focusNode; + + @Default([]) List dropdownMenuEntries, + + // FilterCallback? filterCallback; + // SearchCallback? searchCallback, + // + // + // + @Default(DropdownMenuCloseBehavior.all) + DropdownMenuCloseBehavior? closeBehavior}) = _StacDropdownMenu; + + factory StacDropdownMenu.fromJson(Map json) => + _$StacDropdownMenuFromJson(json); +} diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.freezed.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.freezed.dart new file mode 100644 index 00000000..050eca6b --- /dev/null +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.freezed.dart @@ -0,0 +1,833 @@ +// 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_dropdown_menu.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$StacDropdownMenu { + bool get enabled; + double? get width; + double? get menuHeight; + Map? get leadingIcon; + Map? get trailingIcon; + Map? get label; + String? get hintText; + String? get helperText; + String? get errorText; + Map? get selectedTrailingIcon; + bool? get enableFilter; + bool? get enableSearch; + StacTextInputType? get keyboardType; + StacTextStyle? get textStyle; + TextAlign get textAlign; + StacInputDecorationTheme? get inputDecorationTheme; + List get inputFormatters; + StacOffset? get alignmentOffset; + StacEdgeInsets? get expandedInsets; + bool? get requestFocusOnTap; // TextEditingController? controller; +// T? initialSelection; +// ValueChanged? onSelected; +// FocusNode? focusNode; + List + get dropdownMenuEntries; // FilterCallback? filterCallback; +// SearchCallback? searchCallback, +// +// +// + DropdownMenuCloseBehavior? get closeBehavior; + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $StacDropdownMenuCopyWith get copyWith => + _$StacDropdownMenuCopyWithImpl( + this as StacDropdownMenu, _$identity); + + /// Serializes this StacDropdownMenu to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is StacDropdownMenu && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.width, width) || other.width == width) && + (identical(other.menuHeight, menuHeight) || + other.menuHeight == menuHeight) && + const DeepCollectionEquality() + .equals(other.leadingIcon, leadingIcon) && + const DeepCollectionEquality() + .equals(other.trailingIcon, trailingIcon) && + const DeepCollectionEquality().equals(other.label, label) && + (identical(other.hintText, hintText) || + other.hintText == hintText) && + (identical(other.helperText, helperText) || + other.helperText == helperText) && + (identical(other.errorText, errorText) || + other.errorText == errorText) && + const DeepCollectionEquality() + .equals(other.selectedTrailingIcon, selectedTrailingIcon) && + (identical(other.enableFilter, enableFilter) || + other.enableFilter == enableFilter) && + (identical(other.enableSearch, enableSearch) || + other.enableSearch == enableSearch) && + (identical(other.keyboardType, keyboardType) || + other.keyboardType == keyboardType) && + (identical(other.textStyle, textStyle) || + other.textStyle == textStyle) && + (identical(other.textAlign, textAlign) || + other.textAlign == textAlign) && + (identical(other.inputDecorationTheme, inputDecorationTheme) || + other.inputDecorationTheme == inputDecorationTheme) && + const DeepCollectionEquality() + .equals(other.inputFormatters, inputFormatters) && + (identical(other.alignmentOffset, alignmentOffset) || + other.alignmentOffset == alignmentOffset) && + (identical(other.expandedInsets, expandedInsets) || + other.expandedInsets == expandedInsets) && + (identical(other.requestFocusOnTap, requestFocusOnTap) || + other.requestFocusOnTap == requestFocusOnTap) && + const DeepCollectionEquality() + .equals(other.dropdownMenuEntries, dropdownMenuEntries) && + (identical(other.closeBehavior, closeBehavior) || + other.closeBehavior == closeBehavior)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hashAll([ + runtimeType, + enabled, + width, + menuHeight, + const DeepCollectionEquality().hash(leadingIcon), + const DeepCollectionEquality().hash(trailingIcon), + const DeepCollectionEquality().hash(label), + hintText, + helperText, + errorText, + const DeepCollectionEquality().hash(selectedTrailingIcon), + enableFilter, + enableSearch, + keyboardType, + textStyle, + textAlign, + inputDecorationTheme, + const DeepCollectionEquality().hash(inputFormatters), + alignmentOffset, + expandedInsets, + requestFocusOnTap, + const DeepCollectionEquality().hash(dropdownMenuEntries), + closeBehavior + ]); + + @override + String toString() { + return 'StacDropdownMenu(enabled: $enabled, width: $width, menuHeight: $menuHeight, leadingIcon: $leadingIcon, trailingIcon: $trailingIcon, label: $label, hintText: $hintText, helperText: $helperText, errorText: $errorText, selectedTrailingIcon: $selectedTrailingIcon, enableFilter: $enableFilter, enableSearch: $enableSearch, keyboardType: $keyboardType, textStyle: $textStyle, textAlign: $textAlign, inputDecorationTheme: $inputDecorationTheme, inputFormatters: $inputFormatters, alignmentOffset: $alignmentOffset, expandedInsets: $expandedInsets, requestFocusOnTap: $requestFocusOnTap, dropdownMenuEntries: $dropdownMenuEntries, closeBehavior: $closeBehavior)'; + } +} + +/// @nodoc +abstract mixin class $StacDropdownMenuCopyWith<$Res> { + factory $StacDropdownMenuCopyWith( + StacDropdownMenu value, $Res Function(StacDropdownMenu) _then) = + _$StacDropdownMenuCopyWithImpl; + @useResult + $Res call( + {bool enabled, + double? width, + double? menuHeight, + Map? leadingIcon, + Map? trailingIcon, + Map? label, + String? hintText, + String? helperText, + String? errorText, + Map? selectedTrailingIcon, + bool? enableFilter, + bool? enableSearch, + StacTextInputType? keyboardType, + StacTextStyle? textStyle, + TextAlign textAlign, + StacInputDecorationTheme? inputDecorationTheme, + List inputFormatters, + StacOffset? alignmentOffset, + StacEdgeInsets? expandedInsets, + bool? requestFocusOnTap, + List dropdownMenuEntries, + DropdownMenuCloseBehavior? closeBehavior}); + + $StacTextStyleCopyWith<$Res>? get textStyle; + $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme; + $StacOffsetCopyWith<$Res>? get alignmentOffset; + $StacEdgeInsetsCopyWith<$Res>? get expandedInsets; +} + +/// @nodoc +class _$StacDropdownMenuCopyWithImpl<$Res> + implements $StacDropdownMenuCopyWith<$Res> { + _$StacDropdownMenuCopyWithImpl(this._self, this._then); + + final StacDropdownMenu _self; + final $Res Function(StacDropdownMenu) _then; + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? width = freezed, + Object? menuHeight = freezed, + Object? leadingIcon = freezed, + Object? trailingIcon = freezed, + Object? label = freezed, + Object? hintText = freezed, + Object? helperText = freezed, + Object? errorText = freezed, + Object? selectedTrailingIcon = freezed, + Object? enableFilter = freezed, + Object? enableSearch = freezed, + Object? keyboardType = freezed, + Object? textStyle = freezed, + Object? textAlign = null, + Object? inputDecorationTheme = freezed, + Object? inputFormatters = null, + Object? alignmentOffset = freezed, + Object? expandedInsets = freezed, + Object? requestFocusOnTap = freezed, + Object? dropdownMenuEntries = null, + Object? closeBehavior = freezed, + }) { + return _then(_self.copyWith( + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + width: freezed == width + ? _self.width + : width // ignore: cast_nullable_to_non_nullable + as double?, + menuHeight: freezed == menuHeight + ? _self.menuHeight + : menuHeight // ignore: cast_nullable_to_non_nullable + as double?, + leadingIcon: freezed == leadingIcon + ? _self.leadingIcon + : leadingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + trailingIcon: freezed == trailingIcon + ? _self.trailingIcon + : trailingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + label: freezed == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as Map?, + hintText: freezed == hintText + ? _self.hintText + : hintText // ignore: cast_nullable_to_non_nullable + as String?, + helperText: freezed == helperText + ? _self.helperText + : helperText // ignore: cast_nullable_to_non_nullable + as String?, + errorText: freezed == errorText + ? _self.errorText + : errorText // ignore: cast_nullable_to_non_nullable + as String?, + selectedTrailingIcon: freezed == selectedTrailingIcon + ? _self.selectedTrailingIcon + : selectedTrailingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + enableFilter: freezed == enableFilter + ? _self.enableFilter + : enableFilter // ignore: cast_nullable_to_non_nullable + as bool?, + enableSearch: freezed == enableSearch + ? _self.enableSearch + : enableSearch // ignore: cast_nullable_to_non_nullable + as bool?, + keyboardType: freezed == keyboardType + ? _self.keyboardType + : keyboardType // ignore: cast_nullable_to_non_nullable + as StacTextInputType?, + textStyle: freezed == textStyle + ? _self.textStyle + : textStyle // ignore: cast_nullable_to_non_nullable + as StacTextStyle?, + textAlign: null == textAlign + ? _self.textAlign + : textAlign // ignore: cast_nullable_to_non_nullable + as TextAlign, + inputDecorationTheme: freezed == inputDecorationTheme + ? _self.inputDecorationTheme + : inputDecorationTheme // ignore: cast_nullable_to_non_nullable + as StacInputDecorationTheme?, + inputFormatters: null == inputFormatters + ? _self.inputFormatters + : inputFormatters // ignore: cast_nullable_to_non_nullable + as List, + alignmentOffset: freezed == alignmentOffset + ? _self.alignmentOffset + : alignmentOffset // ignore: cast_nullable_to_non_nullable + as StacOffset?, + expandedInsets: freezed == expandedInsets + ? _self.expandedInsets + : expandedInsets // ignore: cast_nullable_to_non_nullable + as StacEdgeInsets?, + requestFocusOnTap: freezed == requestFocusOnTap + ? _self.requestFocusOnTap + : requestFocusOnTap // ignore: cast_nullable_to_non_nullable + as bool?, + dropdownMenuEntries: null == dropdownMenuEntries + ? _self.dropdownMenuEntries + : dropdownMenuEntries // ignore: cast_nullable_to_non_nullable + as List, + closeBehavior: freezed == closeBehavior + ? _self.closeBehavior + : closeBehavior // ignore: cast_nullable_to_non_nullable + as DropdownMenuCloseBehavior?, + )); + } + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacTextStyleCopyWith<$Res>? get textStyle { + if (_self.textStyle == null) { + return null; + } + + return $StacTextStyleCopyWith<$Res>(_self.textStyle!, (value) { + return _then(_self.copyWith(textStyle: value)); + }); + } + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme { + if (_self.inputDecorationTheme == null) { + return null; + } + + return $StacInputDecorationThemeCopyWith<$Res>(_self.inputDecorationTheme!, + (value) { + return _then(_self.copyWith(inputDecorationTheme: value)); + }); + } + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacOffsetCopyWith<$Res>? get alignmentOffset { + if (_self.alignmentOffset == null) { + return null; + } + + return $StacOffsetCopyWith<$Res>(_self.alignmentOffset!, (value) { + return _then(_self.copyWith(alignmentOffset: value)); + }); + } + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacEdgeInsetsCopyWith<$Res>? get expandedInsets { + if (_self.expandedInsets == null) { + return null; + } + + return $StacEdgeInsetsCopyWith<$Res>(_self.expandedInsets!, (value) { + return _then(_self.copyWith(expandedInsets: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _StacDropdownMenu implements StacDropdownMenu { + const _StacDropdownMenu( + {this.enabled = true, + this.width, + this.menuHeight, + final Map? leadingIcon, + final Map? trailingIcon, + final Map? label, + this.hintText, + this.helperText, + this.errorText, + final Map? selectedTrailingIcon, + this.enableFilter, + this.enableSearch, + this.keyboardType, + this.textStyle, + this.textAlign = TextAlign.start, + this.inputDecorationTheme, + final List inputFormatters = const [], + this.alignmentOffset, + this.expandedInsets, + this.requestFocusOnTap, + final List dropdownMenuEntries = const [], + this.closeBehavior = DropdownMenuCloseBehavior.all}) + : _leadingIcon = leadingIcon, + _trailingIcon = trailingIcon, + _label = label, + _selectedTrailingIcon = selectedTrailingIcon, + _inputFormatters = inputFormatters, + _dropdownMenuEntries = dropdownMenuEntries; + factory _StacDropdownMenu.fromJson(Map json) => + _$StacDropdownMenuFromJson(json); + + @override + @JsonKey() + final bool enabled; + @override + final double? width; + @override + final double? menuHeight; + final Map? _leadingIcon; + @override + Map? get leadingIcon { + final value = _leadingIcon; + if (value == null) return null; + if (_leadingIcon is EqualUnmodifiableMapView) return _leadingIcon; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _trailingIcon; + @override + Map? get trailingIcon { + final value = _trailingIcon; + if (value == null) return null; + if (_trailingIcon is EqualUnmodifiableMapView) return _trailingIcon; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _label; + @override + Map? get label { + final value = _label; + if (value == null) return null; + if (_label is EqualUnmodifiableMapView) return _label; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + final String? hintText; + @override + final String? helperText; + @override + final String? errorText; + final Map? _selectedTrailingIcon; + @override + Map? get selectedTrailingIcon { + final value = _selectedTrailingIcon; + if (value == null) return null; + if (_selectedTrailingIcon is EqualUnmodifiableMapView) + return _selectedTrailingIcon; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + final bool? enableFilter; + @override + final bool? enableSearch; + @override + final StacTextInputType? keyboardType; + @override + final StacTextStyle? textStyle; + @override + @JsonKey() + final TextAlign textAlign; + @override + final StacInputDecorationTheme? inputDecorationTheme; + final List _inputFormatters; + @override + @JsonKey() + List get inputFormatters { + if (_inputFormatters is EqualUnmodifiableListView) return _inputFormatters; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_inputFormatters); + } + + @override + final StacOffset? alignmentOffset; + @override + final StacEdgeInsets? expandedInsets; + @override + final bool? requestFocusOnTap; +// TextEditingController? controller; +// T? initialSelection; +// ValueChanged? onSelected; +// FocusNode? focusNode; + final List _dropdownMenuEntries; +// TextEditingController? controller; +// T? initialSelection; +// ValueChanged? onSelected; +// FocusNode? focusNode; + @override + @JsonKey() + List get dropdownMenuEntries { + if (_dropdownMenuEntries is EqualUnmodifiableListView) + return _dropdownMenuEntries; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_dropdownMenuEntries); + } + +// FilterCallback? filterCallback; +// SearchCallback? searchCallback, +// +// +// + @override + @JsonKey() + final DropdownMenuCloseBehavior? closeBehavior; + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$StacDropdownMenuCopyWith<_StacDropdownMenu> get copyWith => + __$StacDropdownMenuCopyWithImpl<_StacDropdownMenu>(this, _$identity); + + @override + Map toJson() { + return _$StacDropdownMenuToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _StacDropdownMenu && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.width, width) || other.width == width) && + (identical(other.menuHeight, menuHeight) || + other.menuHeight == menuHeight) && + const DeepCollectionEquality() + .equals(other._leadingIcon, _leadingIcon) && + const DeepCollectionEquality() + .equals(other._trailingIcon, _trailingIcon) && + const DeepCollectionEquality().equals(other._label, _label) && + (identical(other.hintText, hintText) || + other.hintText == hintText) && + (identical(other.helperText, helperText) || + other.helperText == helperText) && + (identical(other.errorText, errorText) || + other.errorText == errorText) && + const DeepCollectionEquality() + .equals(other._selectedTrailingIcon, _selectedTrailingIcon) && + (identical(other.enableFilter, enableFilter) || + other.enableFilter == enableFilter) && + (identical(other.enableSearch, enableSearch) || + other.enableSearch == enableSearch) && + (identical(other.keyboardType, keyboardType) || + other.keyboardType == keyboardType) && + (identical(other.textStyle, textStyle) || + other.textStyle == textStyle) && + (identical(other.textAlign, textAlign) || + other.textAlign == textAlign) && + (identical(other.inputDecorationTheme, inputDecorationTheme) || + other.inputDecorationTheme == inputDecorationTheme) && + const DeepCollectionEquality() + .equals(other._inputFormatters, _inputFormatters) && + (identical(other.alignmentOffset, alignmentOffset) || + other.alignmentOffset == alignmentOffset) && + (identical(other.expandedInsets, expandedInsets) || + other.expandedInsets == expandedInsets) && + (identical(other.requestFocusOnTap, requestFocusOnTap) || + other.requestFocusOnTap == requestFocusOnTap) && + const DeepCollectionEquality() + .equals(other._dropdownMenuEntries, _dropdownMenuEntries) && + (identical(other.closeBehavior, closeBehavior) || + other.closeBehavior == closeBehavior)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hashAll([ + runtimeType, + enabled, + width, + menuHeight, + const DeepCollectionEquality().hash(_leadingIcon), + const DeepCollectionEquality().hash(_trailingIcon), + const DeepCollectionEquality().hash(_label), + hintText, + helperText, + errorText, + const DeepCollectionEquality().hash(_selectedTrailingIcon), + enableFilter, + enableSearch, + keyboardType, + textStyle, + textAlign, + inputDecorationTheme, + const DeepCollectionEquality().hash(_inputFormatters), + alignmentOffset, + expandedInsets, + requestFocusOnTap, + const DeepCollectionEquality().hash(_dropdownMenuEntries), + closeBehavior + ]); + + @override + String toString() { + return 'StacDropdownMenu(enabled: $enabled, width: $width, menuHeight: $menuHeight, leadingIcon: $leadingIcon, trailingIcon: $trailingIcon, label: $label, hintText: $hintText, helperText: $helperText, errorText: $errorText, selectedTrailingIcon: $selectedTrailingIcon, enableFilter: $enableFilter, enableSearch: $enableSearch, keyboardType: $keyboardType, textStyle: $textStyle, textAlign: $textAlign, inputDecorationTheme: $inputDecorationTheme, inputFormatters: $inputFormatters, alignmentOffset: $alignmentOffset, expandedInsets: $expandedInsets, requestFocusOnTap: $requestFocusOnTap, dropdownMenuEntries: $dropdownMenuEntries, closeBehavior: $closeBehavior)'; + } +} + +/// @nodoc +abstract mixin class _$StacDropdownMenuCopyWith<$Res> + implements $StacDropdownMenuCopyWith<$Res> { + factory _$StacDropdownMenuCopyWith( + _StacDropdownMenu value, $Res Function(_StacDropdownMenu) _then) = + __$StacDropdownMenuCopyWithImpl; + @override + @useResult + $Res call( + {bool enabled, + double? width, + double? menuHeight, + Map? leadingIcon, + Map? trailingIcon, + Map? label, + String? hintText, + String? helperText, + String? errorText, + Map? selectedTrailingIcon, + bool? enableFilter, + bool? enableSearch, + StacTextInputType? keyboardType, + StacTextStyle? textStyle, + TextAlign textAlign, + StacInputDecorationTheme? inputDecorationTheme, + List inputFormatters, + StacOffset? alignmentOffset, + StacEdgeInsets? expandedInsets, + bool? requestFocusOnTap, + List dropdownMenuEntries, + DropdownMenuCloseBehavior? closeBehavior}); + + @override + $StacTextStyleCopyWith<$Res>? get textStyle; + @override + $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme; + @override + $StacOffsetCopyWith<$Res>? get alignmentOffset; + @override + $StacEdgeInsetsCopyWith<$Res>? get expandedInsets; +} + +/// @nodoc +class __$StacDropdownMenuCopyWithImpl<$Res> + implements _$StacDropdownMenuCopyWith<$Res> { + __$StacDropdownMenuCopyWithImpl(this._self, this._then); + + final _StacDropdownMenu _self; + final $Res Function(_StacDropdownMenu) _then; + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? enabled = null, + Object? width = freezed, + Object? menuHeight = freezed, + Object? leadingIcon = freezed, + Object? trailingIcon = freezed, + Object? label = freezed, + Object? hintText = freezed, + Object? helperText = freezed, + Object? errorText = freezed, + Object? selectedTrailingIcon = freezed, + Object? enableFilter = freezed, + Object? enableSearch = freezed, + Object? keyboardType = freezed, + Object? textStyle = freezed, + Object? textAlign = null, + Object? inputDecorationTheme = freezed, + Object? inputFormatters = null, + Object? alignmentOffset = freezed, + Object? expandedInsets = freezed, + Object? requestFocusOnTap = freezed, + Object? dropdownMenuEntries = null, + Object? closeBehavior = freezed, + }) { + return _then(_StacDropdownMenu( + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + width: freezed == width + ? _self.width + : width // ignore: cast_nullable_to_non_nullable + as double?, + menuHeight: freezed == menuHeight + ? _self.menuHeight + : menuHeight // ignore: cast_nullable_to_non_nullable + as double?, + leadingIcon: freezed == leadingIcon + ? _self._leadingIcon + : leadingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + trailingIcon: freezed == trailingIcon + ? _self._trailingIcon + : trailingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + label: freezed == label + ? _self._label + : label // ignore: cast_nullable_to_non_nullable + as Map?, + hintText: freezed == hintText + ? _self.hintText + : hintText // ignore: cast_nullable_to_non_nullable + as String?, + helperText: freezed == helperText + ? _self.helperText + : helperText // ignore: cast_nullable_to_non_nullable + as String?, + errorText: freezed == errorText + ? _self.errorText + : errorText // ignore: cast_nullable_to_non_nullable + as String?, + selectedTrailingIcon: freezed == selectedTrailingIcon + ? _self._selectedTrailingIcon + : selectedTrailingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + enableFilter: freezed == enableFilter + ? _self.enableFilter + : enableFilter // ignore: cast_nullable_to_non_nullable + as bool?, + enableSearch: freezed == enableSearch + ? _self.enableSearch + : enableSearch // ignore: cast_nullable_to_non_nullable + as bool?, + keyboardType: freezed == keyboardType + ? _self.keyboardType + : keyboardType // ignore: cast_nullable_to_non_nullable + as StacTextInputType?, + textStyle: freezed == textStyle + ? _self.textStyle + : textStyle // ignore: cast_nullable_to_non_nullable + as StacTextStyle?, + textAlign: null == textAlign + ? _self.textAlign + : textAlign // ignore: cast_nullable_to_non_nullable + as TextAlign, + inputDecorationTheme: freezed == inputDecorationTheme + ? _self.inputDecorationTheme + : inputDecorationTheme // ignore: cast_nullable_to_non_nullable + as StacInputDecorationTheme?, + inputFormatters: null == inputFormatters + ? _self._inputFormatters + : inputFormatters // ignore: cast_nullable_to_non_nullable + as List, + alignmentOffset: freezed == alignmentOffset + ? _self.alignmentOffset + : alignmentOffset // ignore: cast_nullable_to_non_nullable + as StacOffset?, + expandedInsets: freezed == expandedInsets + ? _self.expandedInsets + : expandedInsets // ignore: cast_nullable_to_non_nullable + as StacEdgeInsets?, + requestFocusOnTap: freezed == requestFocusOnTap + ? _self.requestFocusOnTap + : requestFocusOnTap // ignore: cast_nullable_to_non_nullable + as bool?, + dropdownMenuEntries: null == dropdownMenuEntries + ? _self._dropdownMenuEntries + : dropdownMenuEntries // ignore: cast_nullable_to_non_nullable + as List, + closeBehavior: freezed == closeBehavior + ? _self.closeBehavior + : closeBehavior // ignore: cast_nullable_to_non_nullable + as DropdownMenuCloseBehavior?, + )); + } + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacTextStyleCopyWith<$Res>? get textStyle { + if (_self.textStyle == null) { + return null; + } + + return $StacTextStyleCopyWith<$Res>(_self.textStyle!, (value) { + return _then(_self.copyWith(textStyle: value)); + }); + } + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme { + if (_self.inputDecorationTheme == null) { + return null; + } + + return $StacInputDecorationThemeCopyWith<$Res>(_self.inputDecorationTheme!, + (value) { + return _then(_self.copyWith(inputDecorationTheme: value)); + }); + } + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacOffsetCopyWith<$Res>? get alignmentOffset { + if (_self.alignmentOffset == null) { + return null; + } + + return $StacOffsetCopyWith<$Res>(_self.alignmentOffset!, (value) { + return _then(_self.copyWith(alignmentOffset: value)); + }); + } + + /// Create a copy of StacDropdownMenu + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacEdgeInsetsCopyWith<$Res>? get expandedInsets { + if (_self.expandedInsets == null) { + return null; + } + + return $StacEdgeInsetsCopyWith<$Res>(_self.expandedInsets!, (value) { + return _then(_self.copyWith(expandedInsets: value)); + }); + } +} + +// dart format on diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.g.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.g.dart new file mode 100644 index 00000000..13dea414 --- /dev/null +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.g.dart @@ -0,0 +1,112 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_dropdown_menu.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_StacDropdownMenu _$StacDropdownMenuFromJson(Map json) => + _StacDropdownMenu( + enabled: json['enabled'] as bool? ?? true, + width: (json['width'] as num?)?.toDouble(), + menuHeight: (json['menuHeight'] as num?)?.toDouble(), + leadingIcon: json['leadingIcon'] as Map?, + trailingIcon: json['trailingIcon'] as Map?, + label: json['label'] as Map?, + hintText: json['hintText'] as String?, + helperText: json['helperText'] as String?, + errorText: json['errorText'] as String?, + selectedTrailingIcon: + json['selectedTrailingIcon'] as Map?, + enableFilter: json['enableFilter'] as bool?, + enableSearch: json['enableSearch'] as bool?, + keyboardType: + $enumDecodeNullable(_$StacTextInputTypeEnumMap, json['keyboardType']), + textStyle: json['textStyle'] == null + ? null + : StacTextStyle.fromJson(json['textStyle']), + textAlign: $enumDecodeNullable(_$TextAlignEnumMap, json['textAlign']) ?? + TextAlign.start, + inputDecorationTheme: json['inputDecorationTheme'] == null + ? null + : StacInputDecorationTheme.fromJson( + json['inputDecorationTheme'] as Map), + inputFormatters: (json['inputFormatters'] as List?) + ?.map( + (e) => StacInputFormatter.fromJson(e as Map)) + .toList() ?? + const [], + alignmentOffset: json['alignmentOffset'] == null + ? null + : StacOffset.fromJson( + json['alignmentOffset'] as Map), + expandedInsets: json['expandedInsets'] == null + ? null + : StacEdgeInsets.fromJson(json['expandedInsets']), + requestFocusOnTap: json['requestFocusOnTap'] as bool?, + dropdownMenuEntries: (json['dropdownMenuEntries'] as List?) + ?.map((e) => + StacDropdownMenuEntry.fromJson(e as Map)) + .toList() ?? + const [], + closeBehavior: $enumDecodeNullable( + _$DropdownMenuCloseBehaviorEnumMap, json['closeBehavior']) ?? + DropdownMenuCloseBehavior.all, + ); + +Map _$StacDropdownMenuToJson(_StacDropdownMenu instance) => + { + 'enabled': instance.enabled, + 'width': instance.width, + 'menuHeight': instance.menuHeight, + 'leadingIcon': instance.leadingIcon, + 'trailingIcon': instance.trailingIcon, + 'label': instance.label, + 'hintText': instance.hintText, + 'helperText': instance.helperText, + 'errorText': instance.errorText, + 'selectedTrailingIcon': instance.selectedTrailingIcon, + 'enableFilter': instance.enableFilter, + 'enableSearch': instance.enableSearch, + 'keyboardType': _$StacTextInputTypeEnumMap[instance.keyboardType], + 'textStyle': instance.textStyle, + 'textAlign': _$TextAlignEnumMap[instance.textAlign]!, + 'inputDecorationTheme': instance.inputDecorationTheme, + 'inputFormatters': instance.inputFormatters, + 'alignmentOffset': instance.alignmentOffset, + 'expandedInsets': instance.expandedInsets, + 'requestFocusOnTap': instance.requestFocusOnTap, + 'dropdownMenuEntries': instance.dropdownMenuEntries, + 'closeBehavior': + _$DropdownMenuCloseBehaviorEnumMap[instance.closeBehavior], + }; + +const _$StacTextInputTypeEnumMap = { + StacTextInputType.text: 'text', + StacTextInputType.multiline: 'multiline', + StacTextInputType.number: 'number', + StacTextInputType.phone: 'phone', + StacTextInputType.datetime: 'datetime', + StacTextInputType.emailAddress: 'emailAddress', + StacTextInputType.url: 'url', + StacTextInputType.visiblePassword: 'visiblePassword', + StacTextInputType.name: 'name', + StacTextInputType.streetAddress: 'streetAddress', + StacTextInputType.none: 'none', +}; + +const _$TextAlignEnumMap = { + TextAlign.left: 'left', + TextAlign.right: 'right', + TextAlign.center: 'center', + TextAlign.justify: 'justify', + TextAlign.start: 'start', + TextAlign.end: 'end', +}; + +const _$DropdownMenuCloseBehaviorEnumMap = { + DropdownMenuCloseBehavior.all: 'all', + DropdownMenuCloseBehavior.self: 'self', + DropdownMenuCloseBehavior.none: 'none', +}; diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart new file mode 100644 index 00000000..c327289a --- /dev/null +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart'; +import 'package:stac/src/parsers/stac_input_decoration_theme/stac_input_decoration_theme.dart'; +import 'package:stac/src/parsers/stac_offset/stac_offset.dart'; + +import '../../../stac.dart'; +import '../../utils/widget_type.dart'; +import '../stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; + +class StacDropdownMenuParser extends StacParser { + const StacDropdownMenuParser(); + + @override + String get type => WidgetType.dropdownMenu.name; + + @override + StacDropdownMenu getModel(Map json) => + StacDropdownMenu.fromJson(json); + + @override + Widget parse(BuildContext context, StacDropdownMenu model) { + return _DropDownMenuWidget(model: model); + } +} + +class _DropDownMenuWidget extends StatefulWidget { + const _DropDownMenuWidget({required this.model}); + + final StacDropdownMenu model; + + @override + State<_DropDownMenuWidget> createState() => _DropDownMenuWidgetState(); +} + +class _DropDownMenuWidgetState extends State<_DropDownMenuWidget> { + late final TextEditingController _controller; + final _focusNode = FocusNode(); + late final StacDropdownMenu model; + + @override + void initState() { + model = widget.model; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return DropdownMenu( + focusNode: _focusNode, + controller: _controller, + dropdownMenuEntries: model.dropdownMenuEntries + .map((StacDropdownMenuEntry dropDownMenu) => + dropDownMenu.parse(context)!) + .toList(), + enabled: model.enabled, + width: model.width, + menuHeight: model.menuHeight, + leadingIcon: Stac.fromJson(model.leadingIcon, context), + trailingIcon: Stac.fromJson(model.trailingIcon, context), + label: Stac.fromJson(model.label, context), + hintText: model.hintText, + helperText: model.helperText, + errorText: model.errorText, + selectedTrailingIcon: Stac.fromJson(model.selectedTrailingIcon, context), + enableFilter: model.enableFilter ?? false, + enableSearch: model.enableSearch ?? false, + keyboardType: model.keyboardType?.value, + textStyle: model.textStyle?.parse(context), + textAlign: model.textAlign, + inputDecorationTheme: model.inputDecorationTheme.parse(context), + + // this.controller, + // this.initialSelection, + // this.onSelected, + // this.focusNode, + requestFocusOnTap: model.requestFocusOnTap, + expandedInsets: model.expandedInsets.parse, + // this.filterCallback, + // this.searchCallback, + alignmentOffset: model.alignmentOffset?.parse, + inputFormatters: model.inputFormatters + .map((StacInputFormatter formatter) => + formatter.type.format(formatter.rule ?? "")) + .toList(), + ); + } +} diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart new file mode 100644 index 00000000..ac24e2a6 --- /dev/null +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:stac/src/parsers/parsers.dart'; + +import '../../../stac.dart' show Stac; + +part 'stac_dropdown_menu_entry.freezed.dart'; +part 'stac_dropdown_menu_entry.g.dart'; + +@freezed +abstract class StacDropdownMenuEntry with _$StacDropdownMenuEntry { + const factory StacDropdownMenuEntry({ + dynamic value, + @Default("") String label, + Map? labelWidget, + Map? leadingIcon, + Map? trailingIcon, + @Default(true) bool enabled, + StacButtonStyle? style, + }) = _StacBDropdownMenuEntry; + + factory StacDropdownMenuEntry.fromJson(Map json) => + _$StacDropdownMenuEntryFromJson(json); +} + +extension StacDropdownMenuEntryParser on StacDropdownMenuEntry? { + DropdownMenuEntry? parse(BuildContext context) { + return DropdownMenuEntry( + value: this?.value, + label: this!.label, + labelWidget: Stac.fromJson(this?.labelWidget, context), + leadingIcon: Stac.fromJson(this?.leadingIcon, context), + enabled: this?.enabled ?? false, + style: this?.style?.parseText(context), + ); + } +} diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.freezed.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.freezed.dart new file mode 100644 index 00000000..1608a00d --- /dev/null +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.freezed.dart @@ -0,0 +1,360 @@ +// 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_dropdown_menu_entry.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +StacDropdownMenuEntry _$StacDropdownMenuEntryFromJson( + Map json) { + return _StacBDropdownMenuEntry.fromJson(json); +} + +/// @nodoc +mixin _$StacDropdownMenuEntry { + dynamic get value; + String get label; + Map? get labelWidget; + Map? get leadingIcon; + Map? get trailingIcon; + bool get enabled; + StacButtonStyle? get style; + + /// Create a copy of StacDropdownMenuEntry + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $StacDropdownMenuEntryCopyWith get copyWith => + _$StacDropdownMenuEntryCopyWithImpl( + this as StacDropdownMenuEntry, _$identity); + + /// Serializes this StacDropdownMenuEntry to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is StacDropdownMenuEntry && + const DeepCollectionEquality().equals(other.value, value) && + (identical(other.label, label) || other.label == label) && + const DeepCollectionEquality() + .equals(other.labelWidget, labelWidget) && + const DeepCollectionEquality() + .equals(other.leadingIcon, leadingIcon) && + const DeepCollectionEquality() + .equals(other.trailingIcon, trailingIcon) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.style, style) || other.style == style)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(value), + label, + const DeepCollectionEquality().hash(labelWidget), + const DeepCollectionEquality().hash(leadingIcon), + const DeepCollectionEquality().hash(trailingIcon), + enabled, + style); + + @override + String toString() { + return 'StacDropdownMenuEntry(value: $value, label: $label, labelWidget: $labelWidget, leadingIcon: $leadingIcon, trailingIcon: $trailingIcon, enabled: $enabled, style: $style)'; + } +} + +/// @nodoc +abstract mixin class $StacDropdownMenuEntryCopyWith<$Res> { + factory $StacDropdownMenuEntryCopyWith(StacDropdownMenuEntry value, + $Res Function(StacDropdownMenuEntry) _then) = + _$StacDropdownMenuEntryCopyWithImpl; + @useResult + $Res call( + {dynamic value, + String label, + Map? labelWidget, + Map? leadingIcon, + Map? trailingIcon, + bool enabled, + StacButtonStyle? style}); + + $StacButtonStyleCopyWith<$Res>? get style; +} + +/// @nodoc +class _$StacDropdownMenuEntryCopyWithImpl<$Res> + implements $StacDropdownMenuEntryCopyWith<$Res> { + _$StacDropdownMenuEntryCopyWithImpl(this._self, this._then); + + final StacDropdownMenuEntry _self; + final $Res Function(StacDropdownMenuEntry) _then; + + /// Create a copy of StacDropdownMenuEntry + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = freezed, + Object? label = null, + Object? labelWidget = freezed, + Object? leadingIcon = freezed, + Object? trailingIcon = freezed, + Object? enabled = null, + Object? style = freezed, + }) { + return _then(_self.copyWith( + value: freezed == value + ? _self.value + : value // ignore: cast_nullable_to_non_nullable + as dynamic, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + labelWidget: freezed == labelWidget + ? _self.labelWidget + : labelWidget // ignore: cast_nullable_to_non_nullable + as Map?, + leadingIcon: freezed == leadingIcon + ? _self.leadingIcon + : leadingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + trailingIcon: freezed == trailingIcon + ? _self.trailingIcon + : trailingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + style: freezed == style + ? _self.style + : style // ignore: cast_nullable_to_non_nullable + as StacButtonStyle?, + )); + } + + /// Create a copy of StacDropdownMenuEntry + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacButtonStyleCopyWith<$Res>? get style { + if (_self.style == null) { + return null; + } + + return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { + return _then(_self.copyWith(style: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _StacBDropdownMenuEntry implements StacDropdownMenuEntry { + const _StacBDropdownMenuEntry( + {this.value, + this.label = "", + final Map? labelWidget, + final Map? leadingIcon, + final Map? trailingIcon, + this.enabled = true, + this.style}) + : _labelWidget = labelWidget, + _leadingIcon = leadingIcon, + _trailingIcon = trailingIcon; + factory _StacBDropdownMenuEntry.fromJson(Map json) => + _$StacBDropdownMenuEntryFromJson(json); + + @override + final dynamic value; + @override + @JsonKey() + final String label; + final Map? _labelWidget; + @override + Map? get labelWidget { + final value = _labelWidget; + if (value == null) return null; + if (_labelWidget is EqualUnmodifiableMapView) return _labelWidget; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _leadingIcon; + @override + Map? get leadingIcon { + final value = _leadingIcon; + if (value == null) return null; + if (_leadingIcon is EqualUnmodifiableMapView) return _leadingIcon; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _trailingIcon; + @override + Map? get trailingIcon { + final value = _trailingIcon; + if (value == null) return null; + if (_trailingIcon is EqualUnmodifiableMapView) return _trailingIcon; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + @JsonKey() + final bool enabled; + @override + final StacButtonStyle? style; + + /// Create a copy of StacDropdownMenuEntry + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$StacBDropdownMenuEntryCopyWith<_StacBDropdownMenuEntry> get copyWith => + __$StacBDropdownMenuEntryCopyWithImpl<_StacBDropdownMenuEntry>( + this, _$identity); + + @override + Map toJson() { + return _$StacBDropdownMenuEntryToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _StacBDropdownMenuEntry && + const DeepCollectionEquality().equals(other.value, value) && + (identical(other.label, label) || other.label == label) && + const DeepCollectionEquality() + .equals(other._labelWidget, _labelWidget) && + const DeepCollectionEquality() + .equals(other._leadingIcon, _leadingIcon) && + const DeepCollectionEquality() + .equals(other._trailingIcon, _trailingIcon) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.style, style) || other.style == style)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(value), + label, + const DeepCollectionEquality().hash(_labelWidget), + const DeepCollectionEquality().hash(_leadingIcon), + const DeepCollectionEquality().hash(_trailingIcon), + enabled, + style); + + @override + String toString() { + return 'StacDropdownMenuEntry(value: $value, label: $label, labelWidget: $labelWidget, leadingIcon: $leadingIcon, trailingIcon: $trailingIcon, enabled: $enabled, style: $style)'; + } +} + +/// @nodoc +abstract mixin class _$StacBDropdownMenuEntryCopyWith<$Res> + implements $StacDropdownMenuEntryCopyWith<$Res> { + factory _$StacBDropdownMenuEntryCopyWith(_StacBDropdownMenuEntry value, + $Res Function(_StacBDropdownMenuEntry) _then) = + __$StacBDropdownMenuEntryCopyWithImpl; + @override + @useResult + $Res call( + {dynamic value, + String label, + Map? labelWidget, + Map? leadingIcon, + Map? trailingIcon, + bool enabled, + StacButtonStyle? style}); + + @override + $StacButtonStyleCopyWith<$Res>? get style; +} + +/// @nodoc +class __$StacBDropdownMenuEntryCopyWithImpl<$Res> + implements _$StacBDropdownMenuEntryCopyWith<$Res> { + __$StacBDropdownMenuEntryCopyWithImpl(this._self, this._then); + + final _StacBDropdownMenuEntry _self; + final $Res Function(_StacBDropdownMenuEntry) _then; + + /// Create a copy of StacDropdownMenuEntry + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? value = freezed, + Object? label = null, + Object? labelWidget = freezed, + Object? leadingIcon = freezed, + Object? trailingIcon = freezed, + Object? enabled = null, + Object? style = freezed, + }) { + return _then(_StacBDropdownMenuEntry( + value: freezed == value + ? _self.value + : value // ignore: cast_nullable_to_non_nullable + as dynamic, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + labelWidget: freezed == labelWidget + ? _self._labelWidget + : labelWidget // ignore: cast_nullable_to_non_nullable + as Map?, + leadingIcon: freezed == leadingIcon + ? _self._leadingIcon + : leadingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + trailingIcon: freezed == trailingIcon + ? _self._trailingIcon + : trailingIcon // ignore: cast_nullable_to_non_nullable + as Map?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + style: freezed == style + ? _self.style + : style // ignore: cast_nullable_to_non_nullable + as StacButtonStyle?, + )); + } + + /// Create a copy of StacDropdownMenuEntry + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacButtonStyleCopyWith<$Res>? get style { + if (_self.style == null) { + return null; + } + + return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { + return _then(_self.copyWith(style: value)); + }); + } +} + +// dart format on diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.g.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.g.dart new file mode 100644 index 00000000..fd725c87 --- /dev/null +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_dropdown_menu_entry.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_StacBDropdownMenuEntry _$StacBDropdownMenuEntryFromJson( + Map json) => + _StacBDropdownMenuEntry( + value: json['value'], + label: json['label'] as String? ?? "", + labelWidget: json['labelWidget'] as Map?, + leadingIcon: json['leadingIcon'] as Map?, + trailingIcon: json['trailingIcon'] as Map?, + enabled: json['enabled'] as bool? ?? true, + style: json['style'] == null + ? null + : StacButtonStyle.fromJson(json['style'] as Map), + ); + +Map _$StacBDropdownMenuEntryToJson( + _StacBDropdownMenuEntry instance) => + { + 'value': instance.value, + 'label': instance.label, + 'labelWidget': instance.labelWidget, + 'leadingIcon': instance.leadingIcon, + 'trailingIcon': instance.trailingIcon, + 'enabled': instance.enabled, + 'style': instance.style, + }; diff --git a/packages/stac/lib/src/utils/widget_type.dart b/packages/stac/lib/src/utils/widget_type.dart index e38c0bc3..1f2fef18 100644 --- a/packages/stac/lib/src/utils/widget_type.dart +++ b/packages/stac/lib/src/utils/widget_type.dart @@ -16,6 +16,7 @@ enum WidgetType { coloredBox, column, container, + dropdownMenu, customScrollView, defaultBottomNavigationController, defaultTabController, diff --git a/packages/stac/pubspec.yaml b/packages/stac/pubspec.yaml index d0ce6487..c9477c26 100644 --- a/packages/stac/pubspec.yaml +++ b/packages/stac/pubspec.yaml @@ -28,4 +28,4 @@ dev_dependencies: flutter_lints: ^5.0.0 build_runner: ^2.4.15 freezed: ^3.0.6 - json_serializable: ^6.9.4 + json_serializable: From ce77f4600b9cbabf49b8b3ab79fc05d5ab2cb499 Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Mon, 14 Apr 2025 09:28:16 +0100 Subject: [PATCH 2/9] completed dropdownmenu --- .../json/dropdown_menu_view_example.json | 65 +++++++++++++++++++ .../stac_gallery/assets/json/home_screen.json | 22 +++++++ .../stac_dropdown_menu.dart | 13 +--- .../stac_dropdown_menu.freezed.dart | 31 +++++++-- .../stac_dropdown_menu.g.dart | 2 + .../stac_dropdown_menu_parser.dart | 3 +- 6 files changed, 116 insertions(+), 20 deletions(-) create mode 100644 examples/stac_gallery/assets/json/dropdown_menu_view_example.json diff --git a/examples/stac_gallery/assets/json/dropdown_menu_view_example.json b/examples/stac_gallery/assets/json/dropdown_menu_view_example.json new file mode 100644 index 00000000..1859ba16 --- /dev/null +++ b/examples/stac_gallery/assets/json/dropdown_menu_view_example.json @@ -0,0 +1,65 @@ +{ + "type": "scaffold", + "appBar": { + "type": "appBar", + "title": { + "type": "text", + "data": "Stac DropDown" + } + }, + "body": { + "type": "column", + "children": [ + { + "type": "dropdownMenu", + "leadingIcon": { + "type": "icon", + "iconType": "material", + "icon": "arrow_downward", + "size": 32 + }, + "trailingIcon": { + "type": "icon", + "iconType": "material", + "icon": "double_arrow", + "size": 32 + }, + "initialSelection": "b", + "dropdownMenuEntries": [ + { + "label": "A", + "value": "a", + "leadingIcon": { + "type": "icon", + "iconType": "material", + "icon": "arrow_downward_sharp", + "size": 32 + }, + "trailingIcon": { + "type": "icon", + "iconType": "material", + "icon": "arrow_forward_ios", + "size": 32 + } + }, + { + "label": "B", + "value": "b", + "leadingIcon": { + "type": "icon", + "iconType": "material", + "icon": "arrow_downward_sharp", + "size": 32 + }, + "trailingIcon": { + "type": "icon", + "iconType": "material", + "icon": "arrow_forward_ios", + "size": 32 + } + } + ] + } + ] + } +} \ No newline at end of file diff --git a/examples/stac_gallery/assets/json/home_screen.json b/examples/stac_gallery/assets/json/home_screen.json index e8fe6286..54668640 100644 --- a/examples/stac_gallery/assets/json/home_screen.json +++ b/examples/stac_gallery/assets/json/home_screen.json @@ -1282,5 +1282,27 @@ "assetPath": "assets/json/dynamic_list_view_example.json" } } + }, + { + "type": "listTile", + "leading": { + "type": "icon", + "icon": "api" + }, + "title": { + "type": "text", + "data": "Stac DropDown Menu" + }, + "subtitle": { + "type": "text", + "data": "Drop down menu to select items" + }, + "onTap": { + "actionType": "navigate", + "widgetJson": { + "type": "exampleScreen", + "assetPath": "assets/json/dropdown_menu_view_example.json" + } + } } ] \ No newline at end of file diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart index cee66ec8..33e201c5 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart @@ -35,19 +35,8 @@ abstract class StacDropdownMenu with _$StacDropdownMenu { StacOffset? alignmentOffset, StacEdgeInsets? expandedInsets, bool? requestFocusOnTap, - - // TextEditingController? controller; - // T? initialSelection; - // ValueChanged? onSelected; - // FocusNode? focusNode; - + dynamic initialSelection, @Default([]) List dropdownMenuEntries, - - // FilterCallback? filterCallback; - // SearchCallback? searchCallback, - // - // - // @Default(DropdownMenuCloseBehavior.all) DropdownMenuCloseBehavior? closeBehavior}) = _StacDropdownMenu; diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.freezed.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.freezed.dart index 050eca6b..b0527a94 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.freezed.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.freezed.dart @@ -35,8 +35,7 @@ mixin _$StacDropdownMenu { StacOffset? get alignmentOffset; StacEdgeInsets? get expandedInsets; bool? get requestFocusOnTap; // TextEditingController? controller; -// T? initialSelection; -// ValueChanged? onSelected; + dynamic get initialSelection; // ValueChanged? onSelected; // FocusNode? focusNode; List get dropdownMenuEntries; // FilterCallback? filterCallback; @@ -99,6 +98,8 @@ mixin _$StacDropdownMenu { other.expandedInsets == expandedInsets) && (identical(other.requestFocusOnTap, requestFocusOnTap) || other.requestFocusOnTap == requestFocusOnTap) && + const DeepCollectionEquality() + .equals(other.initialSelection, initialSelection) && const DeepCollectionEquality() .equals(other.dropdownMenuEntries, dropdownMenuEntries) && (identical(other.closeBehavior, closeBehavior) || @@ -129,13 +130,14 @@ mixin _$StacDropdownMenu { alignmentOffset, expandedInsets, requestFocusOnTap, + const DeepCollectionEquality().hash(initialSelection), const DeepCollectionEquality().hash(dropdownMenuEntries), closeBehavior ]); @override String toString() { - return 'StacDropdownMenu(enabled: $enabled, width: $width, menuHeight: $menuHeight, leadingIcon: $leadingIcon, trailingIcon: $trailingIcon, label: $label, hintText: $hintText, helperText: $helperText, errorText: $errorText, selectedTrailingIcon: $selectedTrailingIcon, enableFilter: $enableFilter, enableSearch: $enableSearch, keyboardType: $keyboardType, textStyle: $textStyle, textAlign: $textAlign, inputDecorationTheme: $inputDecorationTheme, inputFormatters: $inputFormatters, alignmentOffset: $alignmentOffset, expandedInsets: $expandedInsets, requestFocusOnTap: $requestFocusOnTap, dropdownMenuEntries: $dropdownMenuEntries, closeBehavior: $closeBehavior)'; + return 'StacDropdownMenu(enabled: $enabled, width: $width, menuHeight: $menuHeight, leadingIcon: $leadingIcon, trailingIcon: $trailingIcon, label: $label, hintText: $hintText, helperText: $helperText, errorText: $errorText, selectedTrailingIcon: $selectedTrailingIcon, enableFilter: $enableFilter, enableSearch: $enableSearch, keyboardType: $keyboardType, textStyle: $textStyle, textAlign: $textAlign, inputDecorationTheme: $inputDecorationTheme, inputFormatters: $inputFormatters, alignmentOffset: $alignmentOffset, expandedInsets: $expandedInsets, requestFocusOnTap: $requestFocusOnTap, initialSelection: $initialSelection, dropdownMenuEntries: $dropdownMenuEntries, closeBehavior: $closeBehavior)'; } } @@ -166,6 +168,7 @@ abstract mixin class $StacDropdownMenuCopyWith<$Res> { StacOffset? alignmentOffset, StacEdgeInsets? expandedInsets, bool? requestFocusOnTap, + dynamic initialSelection, List dropdownMenuEntries, DropdownMenuCloseBehavior? closeBehavior}); @@ -208,6 +211,7 @@ class _$StacDropdownMenuCopyWithImpl<$Res> Object? alignmentOffset = freezed, Object? expandedInsets = freezed, Object? requestFocusOnTap = freezed, + Object? initialSelection = freezed, Object? dropdownMenuEntries = null, Object? closeBehavior = freezed, }) { @@ -292,6 +296,10 @@ class _$StacDropdownMenuCopyWithImpl<$Res> ? _self.requestFocusOnTap : requestFocusOnTap // ignore: cast_nullable_to_non_nullable as bool?, + initialSelection: freezed == initialSelection + ? _self.initialSelection + : initialSelection // ignore: cast_nullable_to_non_nullable + as dynamic, dropdownMenuEntries: null == dropdownMenuEntries ? _self.dropdownMenuEntries : dropdownMenuEntries // ignore: cast_nullable_to_non_nullable @@ -385,6 +393,7 @@ class _StacDropdownMenu implements StacDropdownMenu { this.alignmentOffset, this.expandedInsets, this.requestFocusOnTap, + this.initialSelection, final List dropdownMenuEntries = const [], this.closeBehavior = DropdownMenuCloseBehavior.all}) : _leadingIcon = leadingIcon, @@ -479,12 +488,11 @@ class _StacDropdownMenu implements StacDropdownMenu { @override final bool? requestFocusOnTap; // TextEditingController? controller; -// T? initialSelection; + @override + final dynamic initialSelection; // ValueChanged? onSelected; // FocusNode? focusNode; final List _dropdownMenuEntries; -// TextEditingController? controller; -// T? initialSelection; // ValueChanged? onSelected; // FocusNode? focusNode; @override @@ -562,6 +570,8 @@ class _StacDropdownMenu implements StacDropdownMenu { other.expandedInsets == expandedInsets) && (identical(other.requestFocusOnTap, requestFocusOnTap) || other.requestFocusOnTap == requestFocusOnTap) && + const DeepCollectionEquality() + .equals(other.initialSelection, initialSelection) && const DeepCollectionEquality() .equals(other._dropdownMenuEntries, _dropdownMenuEntries) && (identical(other.closeBehavior, closeBehavior) || @@ -592,13 +602,14 @@ class _StacDropdownMenu implements StacDropdownMenu { alignmentOffset, expandedInsets, requestFocusOnTap, + const DeepCollectionEquality().hash(initialSelection), const DeepCollectionEquality().hash(_dropdownMenuEntries), closeBehavior ]); @override String toString() { - return 'StacDropdownMenu(enabled: $enabled, width: $width, menuHeight: $menuHeight, leadingIcon: $leadingIcon, trailingIcon: $trailingIcon, label: $label, hintText: $hintText, helperText: $helperText, errorText: $errorText, selectedTrailingIcon: $selectedTrailingIcon, enableFilter: $enableFilter, enableSearch: $enableSearch, keyboardType: $keyboardType, textStyle: $textStyle, textAlign: $textAlign, inputDecorationTheme: $inputDecorationTheme, inputFormatters: $inputFormatters, alignmentOffset: $alignmentOffset, expandedInsets: $expandedInsets, requestFocusOnTap: $requestFocusOnTap, dropdownMenuEntries: $dropdownMenuEntries, closeBehavior: $closeBehavior)'; + return 'StacDropdownMenu(enabled: $enabled, width: $width, menuHeight: $menuHeight, leadingIcon: $leadingIcon, trailingIcon: $trailingIcon, label: $label, hintText: $hintText, helperText: $helperText, errorText: $errorText, selectedTrailingIcon: $selectedTrailingIcon, enableFilter: $enableFilter, enableSearch: $enableSearch, keyboardType: $keyboardType, textStyle: $textStyle, textAlign: $textAlign, inputDecorationTheme: $inputDecorationTheme, inputFormatters: $inputFormatters, alignmentOffset: $alignmentOffset, expandedInsets: $expandedInsets, requestFocusOnTap: $requestFocusOnTap, initialSelection: $initialSelection, dropdownMenuEntries: $dropdownMenuEntries, closeBehavior: $closeBehavior)'; } } @@ -631,6 +642,7 @@ abstract mixin class _$StacDropdownMenuCopyWith<$Res> StacOffset? alignmentOffset, StacEdgeInsets? expandedInsets, bool? requestFocusOnTap, + dynamic initialSelection, List dropdownMenuEntries, DropdownMenuCloseBehavior? closeBehavior}); @@ -677,6 +689,7 @@ class __$StacDropdownMenuCopyWithImpl<$Res> Object? alignmentOffset = freezed, Object? expandedInsets = freezed, Object? requestFocusOnTap = freezed, + Object? initialSelection = freezed, Object? dropdownMenuEntries = null, Object? closeBehavior = freezed, }) { @@ -761,6 +774,10 @@ class __$StacDropdownMenuCopyWithImpl<$Res> ? _self.requestFocusOnTap : requestFocusOnTap // ignore: cast_nullable_to_non_nullable as bool?, + initialSelection: freezed == initialSelection + ? _self.initialSelection + : initialSelection // ignore: cast_nullable_to_non_nullable + as dynamic, dropdownMenuEntries: null == dropdownMenuEntries ? _self._dropdownMenuEntries : dropdownMenuEntries // ignore: cast_nullable_to_non_nullable diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.g.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.g.dart index 13dea414..3c41bb7e 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.g.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.g.dart @@ -45,6 +45,7 @@ _StacDropdownMenu _$StacDropdownMenuFromJson(Map json) => ? null : StacEdgeInsets.fromJson(json['expandedInsets']), requestFocusOnTap: json['requestFocusOnTap'] as bool?, + initialSelection: json['initialSelection'], dropdownMenuEntries: (json['dropdownMenuEntries'] as List?) ?.map((e) => StacDropdownMenuEntry.fromJson(e as Map)) @@ -77,6 +78,7 @@ Map _$StacDropdownMenuToJson(_StacDropdownMenu instance) => 'alignmentOffset': instance.alignmentOffset, 'expandedInsets': instance.expandedInsets, 'requestFocusOnTap': instance.requestFocusOnTap, + 'initialSelection': instance.initialSelection, 'dropdownMenuEntries': instance.dropdownMenuEntries, 'closeBehavior': _$DropdownMenuCloseBehaviorEnumMap[instance.closeBehavior], diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart index c327289a..812598ae 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart @@ -33,7 +33,7 @@ class _DropDownMenuWidget extends StatefulWidget { } class _DropDownMenuWidgetState extends State<_DropDownMenuWidget> { - late final TextEditingController _controller; + final TextEditingController _controller = TextEditingController(); final _focusNode = FocusNode(); late final StacDropdownMenu model; @@ -46,6 +46,7 @@ class _DropDownMenuWidgetState extends State<_DropDownMenuWidget> { @override Widget build(BuildContext context) { return DropdownMenu( + initialSelection: model.initialSelection, focusNode: _focusNode, controller: _controller, dropdownMenuEntries: model.dropdownMenuEntries From fc993a40f62aa32fc5117ac99284145826dcdd46 Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Mon, 14 Apr 2025 09:38:33 +0100 Subject: [PATCH 3/9] clean up --- examples/counter_example/.fvm/flutter_sdk | 1 - examples/counter_example/.fvm/fvm_config.json | 4 ---- examples/stac_gallery/.fvm/flutter_sdk | 1 - examples/stac_gallery/.fvm/fvm_config.json | 4 ---- examples/stac_gallery/ios/Podfile.lock | 2 +- examples/stac_gallery/pubspec.lock | 4 ++-- packages/stac/.fvm/flutter_sdk | 1 - packages/stac/.fvm/fvm_config.json | 4 ---- .../stac_dropdown_menu/stac_dropdown_menu_parser.dart | 7 ------- packages/stac/pubspec.yaml | 2 +- 10 files changed, 4 insertions(+), 26 deletions(-) delete mode 120000 examples/counter_example/.fvm/flutter_sdk delete mode 100644 examples/counter_example/.fvm/fvm_config.json delete mode 120000 examples/stac_gallery/.fvm/flutter_sdk delete mode 100644 examples/stac_gallery/.fvm/fvm_config.json delete mode 120000 packages/stac/.fvm/flutter_sdk delete mode 100644 packages/stac/.fvm/fvm_config.json diff --git a/examples/counter_example/.fvm/flutter_sdk b/examples/counter_example/.fvm/flutter_sdk deleted file mode 120000 index 2b58a78d..00000000 --- a/examples/counter_example/.fvm/flutter_sdk +++ /dev/null @@ -1 +0,0 @@ -/Users/Apple/fvm/versions/3.29.0 \ No newline at end of file diff --git a/examples/counter_example/.fvm/fvm_config.json b/examples/counter_example/.fvm/fvm_config.json deleted file mode 100644 index 22008a21..00000000 --- a/examples/counter_example/.fvm/fvm_config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "flutterSdkVersion": "3.29.0", - "flavors": {} -} \ No newline at end of file diff --git a/examples/stac_gallery/.fvm/flutter_sdk b/examples/stac_gallery/.fvm/flutter_sdk deleted file mode 120000 index 2b58a78d..00000000 --- a/examples/stac_gallery/.fvm/flutter_sdk +++ /dev/null @@ -1 +0,0 @@ -/Users/Apple/fvm/versions/3.29.0 \ No newline at end of file diff --git a/examples/stac_gallery/.fvm/fvm_config.json b/examples/stac_gallery/.fvm/fvm_config.json deleted file mode 100644 index 22008a21..00000000 --- a/examples/stac_gallery/.fvm/fvm_config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "flutterSdkVersion": "3.29.0", - "flavors": {} -} \ No newline at end of file diff --git a/examples/stac_gallery/ios/Podfile.lock b/examples/stac_gallery/ios/Podfile.lock index 1298d87a..5dcbd522 100644 --- a/examples/stac_gallery/ios/Podfile.lock +++ b/examples/stac_gallery/ios/Podfile.lock @@ -16,7 +16,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - webview_flutter_wkwebview: a4af96a051138e28e29f60101d094683b9f82188 + webview_flutter_wkwebview: 1821ceac936eba6f7984d89a9f3bcb4dea99ebb2 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 diff --git a/examples/stac_gallery/pubspec.lock b/examples/stac_gallery/pubspec.lock index 826e220b..a84d8da9 100644 --- a/examples/stac_gallery/pubspec.lock +++ b/examples/stac_gallery/pubspec.lock @@ -327,10 +327,10 @@ packages: dependency: transitive description: name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" url: "https://pub.dev" source: hosted - version: "0.7.1" + version: "0.7.2" json_annotation: dependency: "direct main" description: diff --git a/packages/stac/.fvm/flutter_sdk b/packages/stac/.fvm/flutter_sdk deleted file mode 120000 index 2b58a78d..00000000 --- a/packages/stac/.fvm/flutter_sdk +++ /dev/null @@ -1 +0,0 @@ -/Users/Apple/fvm/versions/3.29.0 \ No newline at end of file diff --git a/packages/stac/.fvm/fvm_config.json b/packages/stac/.fvm/fvm_config.json deleted file mode 100644 index 22008a21..00000000 --- a/packages/stac/.fvm/fvm_config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "flutterSdkVersion": "3.29.0", - "flavors": {} -} \ No newline at end of file diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart index 812598ae..d3e13154 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart @@ -69,15 +69,8 @@ class _DropDownMenuWidgetState extends State<_DropDownMenuWidget> { textStyle: model.textStyle?.parse(context), textAlign: model.textAlign, inputDecorationTheme: model.inputDecorationTheme.parse(context), - - // this.controller, - // this.initialSelection, - // this.onSelected, - // this.focusNode, requestFocusOnTap: model.requestFocusOnTap, expandedInsets: model.expandedInsets.parse, - // this.filterCallback, - // this.searchCallback, alignmentOffset: model.alignmentOffset?.parse, inputFormatters: model.inputFormatters .map((StacInputFormatter formatter) => diff --git a/packages/stac/pubspec.yaml b/packages/stac/pubspec.yaml index c9477c26..d0ce6487 100644 --- a/packages/stac/pubspec.yaml +++ b/packages/stac/pubspec.yaml @@ -28,4 +28,4 @@ dev_dependencies: flutter_lints: ^5.0.0 build_runner: ^2.4.15 freezed: ^3.0.6 - json_serializable: + json_serializable: ^6.9.4 From e536aed62553c6655f84e2e92e8331a798b1a3e2 Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Mon, 14 Apr 2025 09:49:16 +0100 Subject: [PATCH 4/9] added documentation to website --- website/docs/widgets/dropdown_menu.md | 79 +++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 website/docs/widgets/dropdown_menu.md diff --git a/website/docs/widgets/dropdown_menu.md b/website/docs/widgets/dropdown_menu.md new file mode 100644 index 00000000..c5137e60 --- /dev/null +++ b/website/docs/widgets/dropdown_menu.md @@ -0,0 +1,79 @@ +# DropdownMenu + +The Stac DropdownMenu allows you to build a Flutter DropdownMenu widget using JSON. +To know more about the DropdownMenu widget in Flutter, refer to +the [official documentation](https://api.flutter.dev/flutter/material/DropdownMenu-class.html). + +## Properties + +| Property | Type | Description | +|----------------------|---------------------------------|-----------------------------------------------------------| +| dropdownMenuEntries | `List` | The entries to display in the dropdown menu. | +| initialSelection | `dynamic` | The initial selection value. | +| enabled | `bool` | Whether the dropdown menu is enabled. Defaults to `true`. | +| label | `Map?` | The label to display for the dropdown menu. | +| leadingIcon | `Map?` | The icon to display at the start of the dropdown menu. | +| trailingIcon | `Map?` | The icon to display at the end of the dropdown menu. | +| hintText | `String?` | The hint text to display when no selection is made. | +| errorText | `String?` | The error text to display when there is an error. | +| width | `double?` | The width of the dropdown menu. | +| menuHeight | `double?` | The height of the dropdown menu. | +| inputDecorationTheme | `StacInputDecorationTheme?` | The theme to use for the input decoration. | +| textStyle | `StacTextStyle?` | The text style to use for the dropdown menu. | + +# DropdownMenuEntry + +The Stac DropdownMenuEntry allows you to build a Flutter DropdownMenuEntry widget using JSON. +To know more about the DropdownMenuEntry widget in Flutter, refer to +the [official documentation](https://api.flutter.dev/flutter/material/DropdownMenuEntry-class.html). + +## Properties + +| Property | Type | Description | +|--------------|-------------------------|----------------------------------------------------| +| value | `dynamic` | The value associated with this entry. | +| label | `String` | The label to display for this entry. | +| enabled | `bool` | Whether this entry is enabled. Defaults to `true`. | +| leadingIcon | `Map?` | The icon to display at the start of this entry. | +| trailingIcon | `Map?` | The icon to display at the end of this entry. | +| style | `StacButtonStyle?` | The style to use for this entry. | + +## Example JSON + +```json +{ + "type": "dropdownMenu", + "label": { + "type": "text", + "data": "Select an option" + }, + "hintText": "Please select", + "width": 200, + "dropdownMenuEntries": [ + { + "value": "option1", + "label": "Option 1", + "leadingIcon": { + "type": "icon", + "iconData": "home" + } + }, + { + "value": "option2", + "label": "Option 2", + "leadingIcon": { + "type": "icon", + "iconData": "settings" + } + }, + { + "value": "option3", + "label": "Option 3", + "leadingIcon": { + "type": "icon", + "iconData": "favorite" + } + } + ] +} +``` \ No newline at end of file From 0440ccaa4fc9e02a495d130444f24a3e7ebf7ea1 Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Mon, 14 Apr 2025 16:24:11 +0100 Subject: [PATCH 5/9] update --- .../src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart | 7 +++---- .../stac_dropdown_menu/stac_dropdown_menu_parser.dart | 4 ++-- .../stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart | 5 ++--- website/docs/widgets/dropdown_menu.md | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart index 33e201c5..d4fe3158 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart @@ -1,16 +1,15 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/parsers.dart'; +import 'package:stac/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart' + show StacDropdownMenuEntry; import 'package:stac/src/parsers/stac_input_decoration_theme/stac_input_decoration_theme.dart'; import 'package:stac/src/parsers/stac_offset/stac_offset.dart'; import 'package:stac/src/utils/text_input_utils.dart'; -import '../stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; - export 'package:stac/src/parsers/stac_container/stac_container_parser.dart'; -part 'stac_dropdown_menu.freezed.dart'; -part 'stac_dropdown_menu.g.dart'; +part 'stac_dropdown_menu.freezed.dart';part 'stac_dropdown_menu.g.dart'; @freezed abstract class StacDropdownMenu with _$StacDropdownMenu { diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart index d3e13154..ee6a5a8f 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart @@ -63,8 +63,8 @@ class _DropDownMenuWidgetState extends State<_DropDownMenuWidget> { helperText: model.helperText, errorText: model.errorText, selectedTrailingIcon: Stac.fromJson(model.selectedTrailingIcon, context), - enableFilter: model.enableFilter ?? false, - enableSearch: model.enableSearch ?? false, + enableFilter: model.enableFilter ?? true, + enableSearch: model.enableSearch ?? true, keyboardType: model.keyboardType?.value, textStyle: model.textStyle?.parse(context), textAlign: model.textAlign, diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart index ac24e2a6..1aa97cbe 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:stac/src/framework/framework.dart' show Stac; import 'package:stac/src/parsers/parsers.dart'; -import '../../../stac.dart' show Stac; - part 'stac_dropdown_menu_entry.freezed.dart'; part 'stac_dropdown_menu_entry.g.dart'; @@ -30,7 +29,7 @@ extension StacDropdownMenuEntryParser on StacDropdownMenuEntry? { label: this!.label, labelWidget: Stac.fromJson(this?.labelWidget, context), leadingIcon: Stac.fromJson(this?.leadingIcon, context), - enabled: this?.enabled ?? false, + enabled: this?.enabled ?? true, style: this?.style?.parseText(context), ); } diff --git a/website/docs/widgets/dropdown_menu.md b/website/docs/widgets/dropdown_menu.md index c5137e60..238c5649 100644 --- a/website/docs/widgets/dropdown_menu.md +++ b/website/docs/widgets/dropdown_menu.md @@ -76,4 +76,4 @@ the [official documentation](https://api.flutter.dev/flutter/material/DropdownMe } ] } -``` \ No newline at end of file +```6 \ No newline at end of file From cef6f5798a1180efb2e06a7a563eaa1bc395c12e Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Mon, 14 Apr 2025 16:25:20 +0100 Subject: [PATCH 6/9] update --- .../stac_dropdown_menu.dart | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart index d4fe3158..668cfc56 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart @@ -9,35 +9,38 @@ import 'package:stac/src/utils/text_input_utils.dart'; export 'package:stac/src/parsers/stac_container/stac_container_parser.dart'; -part 'stac_dropdown_menu.freezed.dart';part 'stac_dropdown_menu.g.dart'; +part 'stac_dropdown_menu.freezed.dart'; + +part 'stac_dropdown_menu.g.dart'; @freezed abstract class StacDropdownMenu with _$StacDropdownMenu { - const factory StacDropdownMenu( - {@Default(true) bool enabled, - double? width, - double? menuHeight, - Map? leadingIcon, - Map? trailingIcon, - Map? label, - String? hintText, - String? helperText, - String? errorText, - Map? selectedTrailingIcon, - bool? enableFilter, - bool? enableSearch, - StacTextInputType? keyboardType, - StacTextStyle? textStyle, - @Default(TextAlign.start) TextAlign textAlign, - StacInputDecorationTheme? inputDecorationTheme, - @Default([]) List inputFormatters, - StacOffset? alignmentOffset, - StacEdgeInsets? expandedInsets, - bool? requestFocusOnTap, - dynamic initialSelection, - @Default([]) List dropdownMenuEntries, - @Default(DropdownMenuCloseBehavior.all) - DropdownMenuCloseBehavior? closeBehavior}) = _StacDropdownMenu; + const factory StacDropdownMenu({ + @Default(true) bool enabled, + double? width, + double? menuHeight, + Map? leadingIcon, + Map? trailingIcon, + Map? label, + String? hintText, + String? helperText, + String? errorText, + Map? selectedTrailingIcon, + bool? enableFilter, + bool? enableSearch, + StacTextInputType? keyboardType, + StacTextStyle? textStyle, + @Default(TextAlign.start) TextAlign textAlign, + StacInputDecorationTheme? inputDecorationTheme, + @Default([]) List inputFormatters, + StacOffset? alignmentOffset, + StacEdgeInsets? expandedInsets, + bool? requestFocusOnTap, + dynamic initialSelection, + @Default([]) List dropdownMenuEntries, + @Default(DropdownMenuCloseBehavior.all) + DropdownMenuCloseBehavior? closeBehavior, + }) = _StacDropdownMenu; factory StacDropdownMenu.fromJson(Map json) => _$StacDropdownMenuFromJson(json); From 82705090c5197a1d40d5b6fda55924b05e408553 Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Mon, 14 Apr 2025 16:30:56 +0100 Subject: [PATCH 7/9] update documentation --- website/docs/widgets/dropdown_menu.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/website/docs/widgets/dropdown_menu.md b/website/docs/widgets/dropdown_menu.md index 238c5649..cefe711c 100644 --- a/website/docs/widgets/dropdown_menu.md +++ b/website/docs/widgets/dropdown_menu.md @@ -20,6 +20,9 @@ the [official documentation](https://api.flutter.dev/flutter/material/DropdownMe | menuHeight | `double?` | The height of the dropdown menu. | | inputDecorationTheme | `StacInputDecorationTheme?` | The theme to use for the input decoration. | | textStyle | `StacTextStyle?` | The text style to use for the dropdown menu. | +| enableFilter | `bool` | Whether to enable filtering. Defaults to `false`. | +| enableSearch | `bool` | Whether to enable search. Defaults to `false`. | +| requestFocusOnTap | `bool` | Whether to request focus on tap. Defaults to `true`. | # DropdownMenuEntry @@ -76,4 +79,4 @@ the [official documentation](https://api.flutter.dev/flutter/material/DropdownMe } ] } -```6 \ No newline at end of file +``` \ No newline at end of file From 6ffd4aa27d22ac74f75e88f8928ee41f808e7e25 Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Mon, 14 Apr 2025 19:33:52 +0100 Subject: [PATCH 8/9] documentation fix --- website/docs/widgets/dropdown_menu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/widgets/dropdown_menu.md b/website/docs/widgets/dropdown_menu.md index cefe711c..b00088cd 100644 --- a/website/docs/widgets/dropdown_menu.md +++ b/website/docs/widgets/dropdown_menu.md @@ -20,8 +20,8 @@ the [official documentation](https://api.flutter.dev/flutter/material/DropdownMe | menuHeight | `double?` | The height of the dropdown menu. | | inputDecorationTheme | `StacInputDecorationTheme?` | The theme to use for the input decoration. | | textStyle | `StacTextStyle?` | The text style to use for the dropdown menu. | -| enableFilter | `bool` | Whether to enable filtering. Defaults to `false`. | -| enableSearch | `bool` | Whether to enable search. Defaults to `false`. | +| enableFilter | `bool` | Whether to enable filtering. Defaults to `true`. | +| enableSearch | `bool` | Whether to enable search. Defaults to `true`. | | requestFocusOnTap | `bool` | Whether to request focus on tap. Defaults to `true`. | # DropdownMenuEntry From 12d94251e87b21b78cfb51cfc04a21ba80ced637 Mon Sep 17 00:00:00 2001 From: Odinachi David Date: Mon, 14 Apr 2025 19:37:45 +0100 Subject: [PATCH 9/9] Clean up imports --- .../stac_dropdown_menu/stac_dropdown_menu_parser.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart index ee6a5a8f..ea9e4660 100644 --- a/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart +++ b/packages/stac/lib/src/parsers/stac_dropdown_menu/stac_dropdown_menu_parser.dart @@ -1,11 +1,10 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/stac_dropdown_menu/stac_dropdown_menu.dart'; +import 'package:stac/src/parsers/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; import 'package:stac/src/parsers/stac_input_decoration_theme/stac_input_decoration_theme.dart'; import 'package:stac/src/parsers/stac_offset/stac_offset.dart'; - -import '../../../stac.dart'; -import '../../utils/widget_type.dart'; -import '../stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; +import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac/stac.dart'; class StacDropdownMenuParser extends StacParser { const StacDropdownMenuParser();