diff --git a/examples/counter_example/pubspec.lock b/examples/counter_example/pubspec.lock index 8c0221cf7..848df3a08 100644 --- a/examples/counter_example/pubspec.lock +++ b/examples/counter_example/pubspec.lock @@ -141,10 +141,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" checked_yaml: dependency: transitive description: @@ -452,18 +452,18 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.18" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: @@ -861,10 +861,10 @@ packages: dependency: transitive description: name: test_api - sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636" url: "https://pub.dev" source: hosted - version: "0.7.7" + version: "0.7.9" timing: dependency: transitive description: diff --git a/examples/movie_app/pubspec.lock b/examples/movie_app/pubspec.lock index 3cdc58152..9bc6e6c01 100644 --- a/examples/movie_app/pubspec.lock +++ b/examples/movie_app/pubspec.lock @@ -117,10 +117,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" checked_yaml: dependency: transitive description: @@ -388,18 +388,18 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.18" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: @@ -789,10 +789,10 @@ packages: dependency: transitive description: name: test_api - sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636" url: "https://pub.dev" source: hosted - version: "0.7.7" + version: "0.7.9" typed_data: dependency: transitive description: diff --git a/examples/stac_gallery/lib/app/example/example_screen.freezed.dart b/examples/stac_gallery/lib/app/example/example_screen.freezed.dart index 66af1665f..e3c3330f1 100644 --- a/examples/stac_gallery/lib/app/example/example_screen.freezed.dart +++ b/examples/stac_gallery/lib/app/example/example_screen.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // 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 @@ -80,6 +79,163 @@ class _$ExampleScreenCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [ExampleScreen]. +extension ExampleScreenPatterns on ExampleScreen { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ExampleScreen value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ExampleScreen() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ExampleScreen value) $default, + ) { + final _that = this; + switch (_that) { + case _ExampleScreen(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ExampleScreen value)? $default, + ) { + final _that = this; + switch (_that) { + case _ExampleScreen() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(String assetPath)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ExampleScreen() when $default != null: + return $default(_that.assetPath); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(String assetPath) $default, + ) { + final _that = this; + switch (_that) { + case _ExampleScreen(): + return $default(_that.assetPath); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(String assetPath)? $default, + ) { + final _that = this; + switch (_that) { + case _ExampleScreen() when $default != null: + return $default(_that.assetPath); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _ExampleScreen implements ExampleScreen { diff --git a/examples/stac_gallery/pubspec.lock b/examples/stac_gallery/pubspec.lock index 322a90f22..678855978 100644 --- a/examples/stac_gallery/pubspec.lock +++ b/examples/stac_gallery/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: e55636ed79578b9abca5fecf9437947798f5ef7456308b5cb85720b793eac92f + sha256: "8d7ff3948166b8ec5da0fbb5962000926b8e02f2ed9b3e51d1738905fbd4c98d" url: "https://pub.dev" source: hosted - version: "82.0.0" + version: "93.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "904ae5bb474d32c38fb9482e2d925d5454cda04ddd0e55d2e6826bc72f6ba8c0" + sha256: de7148ed2fcec579b19f122c1800933dfa028f6d9fd38a152b04b1516cec120b url: "https://pub.dev" source: hosted - version: "7.4.5" + version: "10.0.1" args: dependency: transitive description: @@ -53,18 +53,18 @@ packages: dependency: transitive description: name: build - sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0 + sha256: "275bf6bb2a00a9852c28d4e0b410da1d833a734d57d39d44f94bfc895a484ec3" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "4.0.4" build_config: dependency: transitive description: name: build_config - sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" + sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0" build_daemon: dependency: transitive description: @@ -73,30 +73,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.4" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: b9e4fda21d846e192628e7a4f6deda6888c36b5b69ba02ff291a01fd529140f0 - url: "https://pub.dev" - source: hosted - version: "2.4.4" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "058fe9dce1de7d69c4b84fada934df3e0153dd000758c4d65964d0166779aa99" - url: "https://pub.dev" - source: hosted - version: "2.4.15" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" + sha256: "39ad4ca8a2876779737c60e4228b4bcd35d4352ef7e14e47514093edc012c734" url: "https://pub.dev" source: hosted - version: "8.0.0" + version: "2.11.1" built_collection: dependency: transitive description: @@ -109,10 +93,10 @@ packages: dependency: transitive description: name: built_value - sha256: ea90e81dc4a25a043d9bee692d20ed6d1c4a1662a28c03a96417446c093ed6b4 + sha256: "7931c90b84bc573fef103548e354258ae4c9d28d140e41961df6843c5d60d4d8" url: "https://pub.dev" source: hosted - version: "8.9.5" + version: "8.12.3" cached_network_image: dependency: transitive description: @@ -141,10 +125,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" checked_yaml: dependency: transitive description: @@ -205,10 +189,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "27eb0ae77836989a3bc541ce55595e8ceee0992807f14511552a898ddd0d88ac" + sha256: "15a7db352c8fc6a4d2bc475ba901c25b39fe7157541da4c16eacce6f8be83e49" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.1.5" dio: dependency: transitive description: @@ -308,10 +292,10 @@ packages: dependency: "direct dev" description: name: freezed - sha256: "6022db4c7bfa626841b2a10f34dd1e1b68e8f8f9650db6112dcdeeca45ca793c" + sha256: f23ea33b3863f119b58ed1b586e881a46bd28715ddcc4dbc33104524e3434131 url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.2.5" freezed_annotation: dependency: "direct main" description: @@ -320,14 +304,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" - source: hosted - version: "4.0.0" glob: dependency: transitive description: @@ -376,30 +352,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" - js: - dependency: transitive - description: - name: js - sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" - url: "https://pub.dev" - source: hosted - version: "0.7.2" json_annotation: dependency: "direct main" description: name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + sha256: "805fa86df56383000f640384b282ce0cb8431f1a7a2396de92fb66186d8c57df" url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.10.0" + json_schema: + dependency: transitive + description: + name: json_schema + sha256: f37d9c3fdfe8c9aae55fdfd5af815d24ce63c3a0f6a2c1f0982c30f43643fa1a + url: "https://pub.dev" + source: hosted + version: "5.2.2" json_serializable: dependency: "direct dev" description: name: json_serializable - sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c + sha256: "93fba3ad139dab2b1ce59ecc6fdce6da46a42cdb6c4399ecda30f1e7e725760d" url: "https://pub.dev" source: hosted - version: "6.9.5" + version: "6.12.0" leak_tracker: dependency: transitive description: @@ -452,18 +428,18 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.18" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: @@ -624,6 +600,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.0" + quiver: + dependency: transitive + description: + name: quiver + sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + rfc_6901: + dependency: transitive + description: + name: rfc_6901 + sha256: "6a43b1858dca2febaf93e15639aa6b0c49ccdfd7647775f15a499f872b018154" + url: "https://pub.dev" + source: hosted + version: "0.2.1" rxdart: dependency: transitive description: @@ -713,18 +705,18 @@ packages: dependency: transitive description: name: source_gen - sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" + sha256: "1d562a3c1f713904ebbed50d2760217fd8a51ca170ac4b05b0db490699dbac17" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "4.2.0" source_helper: dependency: transitive description: name: source_helper - sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c" + sha256: "4a85e90b50694e652075cbe4575665539d253e6ec10e46e76b45368ab5e3caae" url: "https://pub.dev" source: hosted - version: "1.3.5" + version: "1.3.10" source_span: dependency: transitive description: @@ -868,18 +860,10 @@ packages: dependency: transitive description: name: test_api - sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 - url: "https://pub.dev" - source: hosted - version: "0.7.7" - timing: - dependency: transitive - description: - name: timing - sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "0.7.9" typed_data: dependency: transitive description: @@ -888,6 +872,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + uri: + dependency: transitive + description: + name: uri + sha256: "889eea21e953187c6099802b7b4cf5219ba8f3518f604a1033064d45b1b8268a" + url: "https://pub.dev" + source: hosted + version: "1.0.0" uuid: dependency: transitive description: @@ -972,10 +964,10 @@ packages: dependency: transitive description: name: webview_flutter - sha256: c3e4fe614b1c814950ad07186007eff2f2e5dd2935eba7b9a9a1af8e5885f1ba + sha256: a3da219916aba44947d3a5478b1927876a09781174b5a2b67fa5be0555154bf9 url: "https://pub.dev" source: hosted - version: "4.13.0" + version: "4.13.1" webview_flutter_android: dependency: transitive description: diff --git a/melos.yaml b/melos.yaml index 4077b36fb..ec84384f2 100644 --- a/melos.yaml +++ b/melos.yaml @@ -11,10 +11,13 @@ scripts: exec: dart format . get: exec: flutter pub get + # Run build_runner in dependency order so generated .g.dart files exist + # before packages that depend on them try to read them. build: - exec: dart run build_runner build --delete-conflicting-outputs - packageFilters: - ignore: [stac_framework, movie_app, stac_logger] + steps: + - melos exec --scope="stac_core" -- "dart run build_runner build --delete-conflicting-outputs" + - melos exec --scope="stac" -- "dart run build_runner build --delete-conflicting-outputs" + - melos exec --scope="counter_example" --scope="stac_gallery" --scope="stac_webview" -- "dart run build_runner build --delete-conflicting-outputs" watch: exec: dart run build_runner watch --delete-conflicting-outputs packageFilters: diff --git a/packages/stac/lib/src/parsers/foundation/borders/stac_input_border_parser.dart b/packages/stac/lib/src/parsers/foundation/borders/stac_input_border_parser.dart new file mode 100644 index 000000000..c362ce7a0 --- /dev/null +++ b/packages/stac/lib/src/parsers/foundation/borders/stac_input_border_parser.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +import 'stac_border_radius_parser.dart'; + +extension StacInputBorderParser on StacInputBorder? { + InputBorder? parse(BuildContext context) { + final border = this; + if (border == null) return null; + final side = BorderSide( + color: border.color?.toColor(context) ?? const Color(0xFF000000), + width: border.width ?? 1.0, + ); + switch (border.type) { + case StacInputBorderType.none: + return InputBorder.none; + case StacInputBorderType.underlineInputBorder: + return UnderlineInputBorder( + borderSide: side, + borderRadius: + border.borderRadius?.parse ?? + BorderRadius.only( + topLeft: Radius.circular(4.0), + topRight: Radius.circular(4.0), + ), + ); + case StacInputBorderType.outlineInputBorder: + return OutlineInputBorder( + borderSide: side, + borderRadius: + border.borderRadius?.parse ?? + BorderRadius.all(Radius.circular(4.0)), + gapPadding: border.gapPadding ?? 4.0, + ); + } + } +} diff --git a/packages/stac/lib/src/parsers/foundation/decoration/stac_input_decoration_parser.dart b/packages/stac/lib/src/parsers/foundation/decoration/stac_input_decoration_parser.dart index 5b86d22f3..934bb4e80 100644 --- a/packages/stac/lib/src/parsers/foundation/decoration/stac_input_decoration_parser.dart +++ b/packages/stac/lib/src/parsers/foundation/decoration/stac_input_decoration_parser.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_input_border_parser.dart'; import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; @@ -20,7 +21,7 @@ extension StacInputDecorationParser on StacInputDecoration { prefixIcon: prefixIcon?.parse(context), prefixText: prefixText, prefixStyle: prefixStyle?.parse(context), - suffixIcon: suffixIcon.parse(context), + suffixIcon: suffixIcon?.parse(context), suffixText: suffixText, suffixStyle: suffixStyle?.parse(context), isDense: isDense, @@ -28,6 +29,12 @@ extension StacInputDecorationParser on StacInputDecoration { filled: filled, fillColor: fillColor?.toColor(context), alignLabelWithHint: alignLabelWithHint, + errorBorder: errorBorder.parse(context), + focusedBorder: focusedBorder.parse(context), + focusedErrorBorder: focusedErrorBorder.parse(context), + disabledBorder: disabledBorder.parse(context), + enabledBorder: enabledBorder.parse(context), + border: border.parse(context), ); } } diff --git a/packages/stac/lib/src/parsers/foundation/foundation.dart b/packages/stac/lib/src/parsers/foundation/foundation.dart index dcafe8ed0..db690b1eb 100644 --- a/packages/stac/lib/src/parsers/foundation/foundation.dart +++ b/packages/stac/lib/src/parsers/foundation/foundation.dart @@ -19,6 +19,7 @@ export 'borders/stac_border_side_parser.dart'; export 'borders/stac_border_style_parser.dart'; export 'borders/stac_circle_border_parser.dart'; export 'borders/stac_continuous_rectangle_border_parser.dart'; +export 'borders/stac_input_border_parser.dart'; export 'borders/stac_rounded_rectangle_border_parser.dart'; export 'borders/stac_shape_border_parser.dart'; // Color parsers diff --git a/packages/stac/lib/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart b/packages/stac/lib/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart index 175eb1666..579cc13cb 100644 --- a/packages/stac/lib/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart +++ b/packages/stac/lib/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart @@ -54,6 +54,12 @@ extension StacInputDecorationThemeParser on StacInputDecorationTheme? { fillColor: this?.fillColor.toColor(context), alignLabelWithHint: this?.alignLabelWithHint ?? false, constraints: this?.constraints?.parse, + errorBorder: this?.errorBorder.parse(context), + focusedBorder: this?.focusedBorder.parse(context), + focusedErrorBorder: this?.focusedErrorBorder.parse(context), + disabledBorder: this?.disabledBorder.parse(context), + enabledBorder: this?.enabledBorder.parse(context), + border: this?.border.parse(context), ); } } diff --git a/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.dart b/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.dart index 6006a7d39..c9780fcd2 100644 --- a/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.dart +++ b/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/borders/stac_input_border/stac_input_border.dart'; import 'package:stac_core/foundation/colors/stac_color/stac_colors.dart'; import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; @@ -59,6 +60,12 @@ class StacInputDecoration extends StacElement { this.filled, this.fillColor, this.alignLabelWithHint, + this.errorBorder, + this.focusedBorder, + this.focusedErrorBorder, + this.disabledBorder, + this.enabledBorder, + this.border, }); /// A widget to display before the decoration's container. @@ -123,6 +130,24 @@ class StacInputDecoration extends StacElement { /// Useful for multi-line inputs so the label isn't vertically centered. final bool? alignLabelWithHint; + /// Border to show when the input has an error. + final StacInputBorder? errorBorder; + + /// Border to show when the input is focused. + final StacInputBorder? focusedBorder; + + /// Border to show when the input is focused and has an error. + final StacInputBorder? focusedErrorBorder; + + /// Border to show when the input is disabled. + final StacInputBorder? disabledBorder; + + /// Border to show when the input is enabled and not focused. + final StacInputBorder? enabledBorder; + + /// Default border (used when no other border is specified). + final StacInputBorder? border; + /// Creates a [StacInputDecoration] from a JSON map. /// /// The [json] argument must be a valid JSON representation of a diff --git a/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.g.dart b/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.g.dart index 7297e28e3..2e732b1cd 100644 --- a/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.g.dart +++ b/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.g.dart @@ -6,49 +6,72 @@ part of 'stac_input_decoration.dart'; // JsonSerializableGenerator // ************************************************************************** -StacInputDecoration _$StacInputDecorationFromJson(Map json) => - StacInputDecoration( - icon: json['icon'] == null - ? null - : StacWidget.fromJson(json['icon'] as Map), - labelText: json['labelText'] as String?, - labelStyle: json['labelStyle'] == null - ? null - : StacTextStyle.fromJson(json['labelStyle']), - hintText: json['hintText'] as String?, - hintStyle: json['hintStyle'] == null - ? null - : StacTextStyle.fromJson(json['hintStyle']), - helperText: json['helperText'] as String?, - helperStyle: json['helperStyle'] == null - ? null - : StacTextStyle.fromJson(json['helperStyle']), - errorText: json['errorText'] as String?, - errorStyle: json['errorStyle'] == null - ? null - : StacTextStyle.fromJson(json['errorStyle']), - prefixIcon: json['prefixIcon'] == null - ? null - : StacWidget.fromJson(json['prefixIcon'] as Map), - prefixText: json['prefixText'] as String?, - prefixStyle: json['prefixStyle'] == null - ? null - : StacTextStyle.fromJson(json['prefixStyle']), - suffixIcon: json['suffixIcon'] == null - ? null - : StacWidget.fromJson(json['suffixIcon'] as Map), - suffixText: json['suffixText'] as String?, - suffixStyle: json['suffixStyle'] == null - ? null - : StacTextStyle.fromJson(json['suffixStyle']), - isDense: json['isDense'] as bool?, - contentPadding: json['contentPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['contentPadding']), - filled: json['filled'] as bool?, - fillColor: json['fillColor'] as String?, - alignLabelWithHint: json['alignLabelWithHint'] as bool?, - ); +StacInputDecoration _$StacInputDecorationFromJson( + Map json, +) => StacInputDecoration( + icon: json['icon'] == null + ? null + : StacWidget.fromJson(json['icon'] as Map), + labelText: json['labelText'] as String?, + labelStyle: json['labelStyle'] == null + ? null + : StacTextStyle.fromJson(json['labelStyle']), + hintText: json['hintText'] as String?, + hintStyle: json['hintStyle'] == null + ? null + : StacTextStyle.fromJson(json['hintStyle']), + helperText: json['helperText'] as String?, + helperStyle: json['helperStyle'] == null + ? null + : StacTextStyle.fromJson(json['helperStyle']), + errorText: json['errorText'] as String?, + errorStyle: json['errorStyle'] == null + ? null + : StacTextStyle.fromJson(json['errorStyle']), + prefixIcon: json['prefixIcon'] == null + ? null + : StacWidget.fromJson(json['prefixIcon'] as Map), + prefixText: json['prefixText'] as String?, + prefixStyle: json['prefixStyle'] == null + ? null + : StacTextStyle.fromJson(json['prefixStyle']), + suffixIcon: json['suffixIcon'] == null + ? null + : StacWidget.fromJson(json['suffixIcon'] as Map), + suffixText: json['suffixText'] as String?, + suffixStyle: json['suffixStyle'] == null + ? null + : StacTextStyle.fromJson(json['suffixStyle']), + isDense: json['isDense'] as bool?, + contentPadding: json['contentPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['contentPadding']), + filled: json['filled'] as bool?, + fillColor: json['fillColor'] as String?, + alignLabelWithHint: json['alignLabelWithHint'] as bool?, + errorBorder: json['errorBorder'] == null + ? null + : StacInputBorder.fromJson(json['errorBorder'] as Map), + focusedBorder: json['focusedBorder'] == null + ? null + : StacInputBorder.fromJson(json['focusedBorder'] as Map), + focusedErrorBorder: json['focusedErrorBorder'] == null + ? null + : StacInputBorder.fromJson( + json['focusedErrorBorder'] as Map, + ), + disabledBorder: json['disabledBorder'] == null + ? null + : StacInputBorder.fromJson( + json['disabledBorder'] as Map, + ), + enabledBorder: json['enabledBorder'] == null + ? null + : StacInputBorder.fromJson(json['enabledBorder'] as Map), + border: json['border'] == null + ? null + : StacInputBorder.fromJson(json['border'] as Map), +); Map _$StacInputDecorationToJson( StacInputDecoration instance, @@ -73,4 +96,10 @@ Map _$StacInputDecorationToJson( 'filled': instance.filled, 'fillColor': instance.fillColor, 'alignLabelWithHint': instance.alignLabelWithHint, + 'errorBorder': instance.errorBorder?.toJson(), + 'focusedBorder': instance.focusedBorder?.toJson(), + 'focusedErrorBorder': instance.focusedErrorBorder?.toJson(), + 'disabledBorder': instance.disabledBorder?.toJson(), + 'enabledBorder': instance.enabledBorder?.toJson(), + 'border': instance.border?.toJson(), }; diff --git a/packages/stac_webview/pubspec.yaml b/packages/stac_webview/pubspec.yaml index c7be696ec..5d3867fd6 100644 --- a/packages/stac_webview/pubspec.yaml +++ b/packages/stac_webview/pubspec.yaml @@ -17,9 +17,9 @@ topics: dependencies: flutter: sdk: flutter - webview_flutter: ^4.13.0 - json_annotation: ^4.9.0 - stac_core: ^1.0.0 + webview_flutter: ^4.13.1 + json_annotation: ^4.10.0 + stac_core: ^1.3.0 stac_framework: ^1.0.0 dev_dependencies: