diff --git a/.gitignore b/.gitignore index c5ecc746f..6b1cefc3c 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ mason-lock.json # Cursor Files .cursor/ + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/examples/movie_app/pubspec.lock b/examples/movie_app/pubspec.lock index f8ebea79a..3b765f6f6 100644 --- a/examples/movie_app/pubspec.lock +++ b/examples/movie_app/pubspec.lock @@ -171,14 +171,6 @@ packages: description: flutter source: sdk version: "0.0.0" - freezed_annotation: - dependency: transitive - description: - name: freezed_annotation - sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" - url: "https://pub.dev" - source: hosted - version: "3.1.0" http: dependency: transitive description: diff --git a/packages/stac/lib/src/framework/stac.dart b/packages/stac/lib/src/framework/stac.dart index bf06f0c73..7c606bc71 100644 --- a/packages/stac/lib/src/framework/stac.dart +++ b/packages/stac/lib/src/framework/stac.dart @@ -10,10 +10,8 @@ import 'package:stac_core/actions/network_request/stac_network_request.dart'; import 'package:stac_core/core/stac_options.dart'; import 'package:stac_framework/stac_framework.dart'; -typedef ErrorWidgetBuilder = Widget Function( - BuildContext context, - dynamic error, -); +typedef ErrorWidgetBuilder = + Widget Function(BuildContext context, dynamic error); typedef LoadingWidgetBuilder = Widget Function(BuildContext context); @@ -31,10 +29,8 @@ typedef LoadingWidgetBuilder = Widget Function(BuildContext context); /// }, /// ); /// ``` -typedef StacErrorWidgetBuilder = Widget Function( - BuildContext context, - StacError errorDetails, -); +typedef StacErrorWidgetBuilder = + Widget Function(BuildContext context, StacError errorDetails); class Stac extends StatelessWidget { const Stac({ @@ -79,10 +75,7 @@ class Stac extends StatelessWidget { ); } - static Widget? fromJson( - Map? json, - BuildContext context, - ) { + static Widget? fromJson(Map? json, BuildContext context) { return StacService.fromJson(json, context); } @@ -139,10 +132,7 @@ class _StacView extends StatelessWidget { } return FutureBuilder( - future: StacCloud.fetchScreen( - context: context, - routeName: routeName, - ), + future: StacCloud.fetchScreen(context: context, routeName: routeName), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return loadingWidget ?? const _LoadingWidget(); @@ -166,10 +156,6 @@ class _LoadingWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - body: const Center( - child: CircularProgressIndicator(), - ), - ); + return Scaffold(body: const Center(child: CircularProgressIndicator())); } } diff --git a/packages/stac/lib/src/framework/stac_app.dart b/packages/stac/lib/src/framework/stac_app.dart index e31d545c5..01e337a50 100644 --- a/packages/stac/lib/src/framework/stac_app.dart +++ b/packages/stac/lib/src/framework/stac_app.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/theme/stac_theme/stac_theme.dart'; +import 'package:stac/src/parsers/theme/themes.dart'; class StacApp extends StatelessWidget { const StacApp({ @@ -41,11 +41,11 @@ class StacApp extends StatelessWidget { this.restorationScopeId, this.scrollBehavior, this.useInheritedMediaQuery = false, - }) : routeInformationProvider = null, - routeInformationParser = null, - routerDelegate = null, - backButtonDispatcher = null, - routerConfig = null; + }) : routeInformationProvider = null, + routeInformationParser = null, + routerDelegate = null, + backButtonDispatcher = null, + routerConfig = null; const StacApp.router({ super.key, @@ -82,14 +82,14 @@ class StacApp extends StatelessWidget { this.restorationScopeId, this.scrollBehavior, this.useInheritedMediaQuery = false, - }) : navigatorObservers = null, - navigatorKey = null, - onGenerateRoute = null, - homeBuilder = null, - onGenerateInitialRoutes = null, - onUnknownRoute = null, - routes = null, - initialRoute = null; + }) : navigatorObservers = null, + navigatorKey = null, + onGenerateRoute = null, + homeBuilder = null, + onGenerateInitialRoutes = null, + onUnknownRoute = null, + routes = null, + initialRoute = null; final GlobalKey? navigatorKey; final GlobalKey? scaffoldMessengerKey; diff --git a/packages/stac/lib/src/framework/stac_error.dart b/packages/stac/lib/src/framework/stac_error.dart index f6e2a3314..5fa6c3ec6 100644 --- a/packages/stac/lib/src/framework/stac_error.dart +++ b/packages/stac/lib/src/framework/stac_error.dart @@ -35,12 +35,7 @@ class StacError { /// The [error] parameter is required and should contain the actual /// error or exception that was thrown. All other parameters are optional /// but recommended for better error diagnostics. - const StacError({ - this.type, - required this.error, - this.json, - this.stackTrace, - }); + const StacError({this.type, required this.error, this.json, this.stackTrace}); /// The type identifier of the failing Stac entity. /// @@ -117,10 +112,7 @@ class StacError { /// ) /// ``` class StacErrorWidget extends StatefulWidget { - const StacErrorWidget({ - super.key, - required this.errorDetails, - }); + const StacErrorWidget({super.key, required this.errorDetails}); final StacError errorDetails; @@ -212,16 +204,16 @@ class _StacErrorWidgetState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Icon(Icons.warning_amber, - color: _warningOrange, size: 16), + const Icon( + Icons.warning_amber, + color: _warningOrange, + size: 16, + ), const SizedBox(width: 8), Expanded( child: Text( widget.errorDetails.error.toString(), - style: const TextStyle( - color: _errorRed, - fontSize: 13, - ), + style: const TextStyle(color: _errorRed, fontSize: 13), ), ), ], @@ -239,9 +231,7 @@ class _StacErrorWidgetState extends State { _buildExpandableSection( title: 'JSON Data', section: _ExpandableSection.json, - child: _buildCodeBlock( - _formatJson(widget.errorDetails.json!), - ), + child: _buildCodeBlock(_formatJson(widget.errorDetails.json!)), ), const SizedBox(height: 8), ], @@ -391,18 +381,16 @@ class _StacErrorWidgetState extends State { ), ), ), - if (isExpanded) ...[ - const SizedBox(height: 4), - child, - ], + if (isExpanded) ...[const SizedBox(height: 4), child], ], ); } String _getTroubleshootingTips() { final errorStr = widget.errorDetails.error.toString().toLowerCase(); - final errorType = - widget.errorDetails.error.runtimeType.toString().toLowerCase(); + final errorType = widget.errorDetails.error.runtimeType + .toString() + .toLowerCase(); // Check for unregistered widget/action types if (errorStr.contains('type') && errorStr.contains('not found')) { diff --git a/packages/stac/lib/src/framework/stac_registry.dart b/packages/stac/lib/src/framework/stac_registry.dart index 5f951ec0a..0ca935166 100644 --- a/packages/stac/lib/src/framework/stac_registry.dart +++ b/packages/stac/lib/src/framework/stac_registry.dart @@ -50,24 +50,22 @@ class StacRegistry { } } - Future registerAll(List parsers, - [bool override = false]) { - return Future.forEach( - parsers, - (StacParser parser) { - return register(parser, override); - }, - ); + Future registerAll( + List parsers, [ + bool override = false, + ]) { + return Future.forEach(parsers, (StacParser parser) { + return register(parser, override); + }); } - Future registerAllActions(List parsers, - [bool override = false]) { - return Future.forEach( - parsers, - (StacActionParser parser) { - return registerAction(parser, override); - }, - ); + Future registerAllActions( + List parsers, [ + bool override = false, + ]) { + return Future.forEach(parsers, (StacActionParser parser) { + return registerAction(parser, override); + }); } StacParser? getParser(String type) { diff --git a/packages/stac/lib/src/framework/stac_service.dart b/packages/stac/lib/src/framework/stac_service.dart index 7eba03263..655f29e12 100644 --- a/packages/stac/lib/src/framework/stac_service.dart +++ b/packages/stac/lib/src/framework/stac_service.dart @@ -173,10 +173,7 @@ class StacService { _errorWidgetBuilder = errorWidgetBuilder; } - static Widget? fromJson( - Map? json, - BuildContext context, - ) { + static Widget? fromJson(Map? json, BuildContext context) { try { if (json == null) { return null; @@ -318,8 +315,9 @@ class StacService { throw TypeError(); } - final stacActionParser = - StacRegistry.instance.getActionParser(actionType); + final stacActionParser = StacRegistry.instance.getActionParser( + actionType, + ); if (stacActionParser == null) { Log.w('Action type [$actionType] not supported'); diff --git a/packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart index e49f3a47e..d57bf785a 100644 --- a/packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart @@ -26,11 +26,7 @@ class StacDialogActionParser extends StacActionParser { Stac.fromJson(model.widget, context) ?? const SizedBox(), ); } else if (model.assetPath?.isNotEmpty ?? false) { - return _showDialog( - context, - model, - Stac.fromAssets(model.assetPath!), - ); + return _showDialog(context, model, Stac.fromAssets(model.assetPath!)); } else if (model.request != null) { return _showDialog( context, diff --git a/packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart index 447da382b..86a097795 100644 --- a/packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart @@ -81,11 +81,7 @@ class StacNavigateActionParser extends StacActionParser { break; case NavigationStyle.pushNamed: - return Navigator.pushNamed( - context, - routeName!, - arguments: arguments, - ); + return Navigator.pushNamed(context, routeName!, arguments: arguments); case NavigationStyle.pushNamedAndRemoveAll: return Navigator.pushNamedAndRemoveUntil( diff --git a/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart b/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart index eb81418f3..7fba7c646 100644 --- a/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart @@ -53,7 +53,9 @@ class StacSnackBarParser extends StacActionParser { } SnackBarAction? _parseAction( - BuildContext context, StacSnackBarAction? action) { + BuildContext context, + StacSnackBarAction? action, + ) { if (action == null) return null; return SnackBarAction( textColor: action.textColor?.toColor(context), diff --git a/packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart b/packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart index 723b4de39..43a846896 100644 --- a/packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart +++ b/packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart @@ -10,31 +10,31 @@ import 'stac_tile_mode_parser.dart'; extension StacGradientParser on StacGradient { Gradient? parse(BuildContext context) { Gradient linearGradient() => LinearGradient( - colors: colors?.map((e) => e.toColor(context)!).toList() ?? [], - begin: begin?.parse ?? Alignment.centerLeft, - end: end?.parse ?? Alignment.centerRight, - stops: stops, - tileMode: tileMode?.parse ?? TileMode.clamp, - ); + colors: colors?.map((e) => e.toColor(context)!).toList() ?? [], + begin: begin?.parse ?? Alignment.centerLeft, + end: end?.parse ?? Alignment.centerRight, + stops: stops, + tileMode: tileMode?.parse ?? TileMode.clamp, + ); Gradient radialGradient() => RadialGradient( - colors: colors?.map((e) => e.toColor(context)!).toList() ?? [], - stops: stops, - tileMode: tileMode?.parse ?? TileMode.clamp, - focal: focal?.parse, - focalRadius: focalRadius ?? 0.0, - radius: radius ?? 0.5, - center: center?.parse ?? Alignment.center, - ); + colors: colors?.map((e) => e.toColor(context)!).toList() ?? [], + stops: stops, + tileMode: tileMode?.parse ?? TileMode.clamp, + focal: focal?.parse, + focalRadius: focalRadius ?? 0.0, + radius: radius ?? 0.5, + center: center?.parse ?? Alignment.center, + ); Gradient sweepGradient() => SweepGradient( - colors: colors?.map((e) => e.toColor(context)!).toList() ?? [], - stops: stops, - center: center?.parse ?? Alignment.center, - startAngle: startAngle ?? 0.0, - endAngle: endAngle ?? math.pi * 2, - tileMode: tileMode?.parse ?? TileMode.clamp, - ); + colors: colors?.map((e) => e.toColor(context)!).toList() ?? [], + stops: stops, + center: center?.parse ?? Alignment.center, + startAngle: startAngle ?? 0.0, + endAngle: endAngle ?? math.pi * 2, + tileMode: tileMode?.parse ?? TileMode.clamp, + ); switch (gradientType) { case StacGradientType.linear: diff --git a/packages/stac/lib/src/parsers/foundation/foundation.dart b/packages/stac/lib/src/parsers/foundation/foundation.dart index 6742483d3..031ddf1a1 100644 --- a/packages/stac/lib/src/parsers/foundation/foundation.dart +++ b/packages/stac/lib/src/parsers/foundation/foundation.dart @@ -72,6 +72,7 @@ export 'layout/stac_wrap_cross_alignment_parser.dart'; export 'navigation/stac_bottom_navigation_bar_landscape_layout_parser.dart'; export 'navigation/stac_bottom_navigation_bar_type_parser.dart'; export 'navigation/stac_floating_action_button_location_parser.dart'; +export 'navigation/stac_navigation_destination_label_behavior_parser.dart'; export 'navigation/stac_tab_alignment_parser.dart'; export 'navigation/stac_tab_bar_indicator_size_parser.dart'; // Text parsers @@ -91,6 +92,8 @@ export 'text/stac_text_overflow_parser.dart'; export 'text/stac_text_style_parser.dart'; export 'text/stac_text_width_basis_parser.dart'; // Theme parsers +export 'theme/stac_button_bar_layout_behavior_parser.dart'; +export 'theme/stac_button_text_theme_parser.dart'; export 'theme/stac_input_decoration_theme_parser.dart'; // UI component parsers export 'ui_components/stac_dismiss_direction_parser.dart'; diff --git a/packages/stac/lib/src/parsers/foundation/geometry/stac_rect_parser.dart b/packages/stac/lib/src/parsers/foundation/geometry/stac_rect_parser.dart index 6e70f866d..32d0aefdf 100644 --- a/packages/stac/lib/src/parsers/foundation/geometry/stac_rect_parser.dart +++ b/packages/stac/lib/src/parsers/foundation/geometry/stac_rect_parser.dart @@ -6,30 +6,20 @@ import 'stac_offset_parser.dart'; extension StacRectParser on StacRect { Rect? get parse { Rect fromCenter() => Rect.fromCenter( - center: center?.parse ?? Offset.zero, - width: width ?? 0.0, - height: height ?? 0.0, - ); + center: center?.parse ?? Offset.zero, + width: width ?? 0.0, + height: height ?? 0.0, + ); Rect fromCircle() => Rect.fromCircle( - center: center?.parse ?? Offset.zero, - radius: radius ?? 0.0, - ); - Rect fromLTRB() => Rect.fromLTRB( - left ?? 0.0, - top ?? 0.0, - right ?? 0.0, - bottom ?? 0.0, - ); - Rect fromLTWH() => Rect.fromLTWH( - left ?? 0.0, - top ?? 0.0, - width ?? 0.0, - height ?? 0.0, - ); - Rect fromPoints() => Rect.fromPoints( - a?.parse ?? Offset.zero, - b?.parse ?? Offset.zero, - ); + center: center?.parse ?? Offset.zero, + radius: radius ?? 0.0, + ); + Rect fromLTRB() => + Rect.fromLTRB(left ?? 0.0, top ?? 0.0, right ?? 0.0, bottom ?? 0.0); + Rect fromLTWH() => + Rect.fromLTWH(left ?? 0.0, top ?? 0.0, width ?? 0.0, height ?? 0.0); + Rect fromPoints() => + Rect.fromPoints(a?.parse ?? Offset.zero, b?.parse ?? Offset.zero); switch (rectType) { case StacRectType.fromCenter: diff --git a/packages/stac/lib/src/parsers/foundation/navigation/stac_navigation_destination_label_behavior_parser.dart b/packages/stac/lib/src/parsers/foundation/navigation/stac_navigation_destination_label_behavior_parser.dart new file mode 100644 index 000000000..8f30803e3 --- /dev/null +++ b/packages/stac/lib/src/parsers/foundation/navigation/stac_navigation_destination_label_behavior_parser.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacNavigationDestinationLabelBehavior]. +/// +/// Converts [StacNavigationDestinationLabelBehavior] to Flutter's [NavigationDestinationLabelBehavior]. +extension StacNavigationDestinationLabelBehaviorParser + on StacNavigationDestinationLabelBehavior { + NavigationDestinationLabelBehavior get parse { + switch (this) { + case StacNavigationDestinationLabelBehavior.alwaysShow: + return NavigationDestinationLabelBehavior.alwaysShow; + case StacNavigationDestinationLabelBehavior.alwaysHide: + return NavigationDestinationLabelBehavior.alwaysHide; + case StacNavigationDestinationLabelBehavior.onlyShowSelected: + return NavigationDestinationLabelBehavior.onlyShowSelected; + } + } +} diff --git a/packages/stac/lib/src/parsers/foundation/theme/stac_button_bar_layout_behavior_parser.dart b/packages/stac/lib/src/parsers/foundation/theme/stac_button_bar_layout_behavior_parser.dart new file mode 100644 index 000000000..6eaa557da --- /dev/null +++ b/packages/stac/lib/src/parsers/foundation/theme/stac_button_bar_layout_behavior_parser.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacButtonBarLayoutBehavior]. +/// +/// Converts [StacButtonBarLayoutBehavior] to Flutter's [ButtonBarLayoutBehavior]. +extension StacButtonBarLayoutBehaviorParser on StacButtonBarLayoutBehavior { + ButtonBarLayoutBehavior get parse { + switch (this) { + case StacButtonBarLayoutBehavior.constrained: + return ButtonBarLayoutBehavior.constrained; + case StacButtonBarLayoutBehavior.padded: + return ButtonBarLayoutBehavior.padded; + } + } +} diff --git a/packages/stac/lib/src/parsers/foundation/theme/stac_button_text_theme_parser.dart b/packages/stac/lib/src/parsers/foundation/theme/stac_button_text_theme_parser.dart new file mode 100644 index 000000000..f951094ed --- /dev/null +++ b/packages/stac/lib/src/parsers/foundation/theme/stac_button_text_theme_parser.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacButtonTextTheme]. +/// +/// Converts [StacButtonTextTheme] to Flutter's [ButtonTextTheme]. +extension StacButtonTextThemeParser on StacButtonTextTheme { + ButtonTextTheme parse(BuildContext context) { + switch (this) { + case StacButtonTextTheme.normal: + return ButtonTextTheme.normal; + case StacButtonTextTheme.accent: + return ButtonTextTheme.accent; + case StacButtonTextTheme.primary: + return ButtonTextTheme.primary; + } + } +} 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 279d1d3a7..175eb1666 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 @@ -35,10 +35,12 @@ extension StacInputDecorationThemeParser on StacInputDecorationTheme? { hintStyle: this?.hintStyle?.parse(context), errorStyle: this?.errorStyle?.parse(context), errorMaxLines: this?.errorMaxLines, - floatingLabelBehavior: - parseFloatingLabelBehavior(this?.floatingLabelBehavior), - floatingLabelAlignment: - parseFloatingLabelAlignment(this?.floatingLabelAlignment), + floatingLabelBehavior: parseFloatingLabelBehavior( + this?.floatingLabelBehavior, + ), + floatingLabelAlignment: parseFloatingLabelAlignment( + this?.floatingLabelAlignment, + ), isDense: this?.isDense ?? false, contentPadding: this?.contentPadding?.parse, isCollapsed: this?.isCollapsed ?? false, diff --git a/packages/stac/lib/src/parsers/foundation/ui_components/stac_dropdown_menu_entry_parser.dart b/packages/stac/lib/src/parsers/foundation/ui_components/stac_dropdown_menu_entry_parser.dart index 3a2723933..675c1f795 100644 --- a/packages/stac/lib/src/parsers/foundation/ui_components/stac_dropdown_menu_entry_parser.dart +++ b/packages/stac/lib/src/parsers/foundation/ui_components/stac_dropdown_menu_entry_parser.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; +import 'package:stac/src/parsers/theme/themes.dart'; import 'package:stac_core/stac_core.dart'; extension StacDropdownMenuEntryParser on StacDropdownMenuEntry? { diff --git a/packages/stac/lib/src/parsers/foundation/ui_components/stac_system_ui_overlay_style_parser.dart b/packages/stac/lib/src/parsers/foundation/ui_components/stac_system_ui_overlay_style_parser.dart index 6e3634067..a9b2ea1ab 100644 --- a/packages/stac/lib/src/parsers/foundation/ui_components/stac_system_ui_overlay_style_parser.dart +++ b/packages/stac/lib/src/parsers/foundation/ui_components/stac_system_ui_overlay_style_parser.dart @@ -8,8 +8,9 @@ extension StacSystemUIOverlayStyleParser on StacSystemUIOverlayStyle { SystemUiOverlayStyle parse(BuildContext context) { return SystemUiOverlayStyle( systemNavigationBarColor: systemNavigationBarColor?.toColor(context), - systemNavigationBarDividerColor: - systemNavigationBarDividerColor.toColor(context), + systemNavigationBarDividerColor: systemNavigationBarDividerColor.toColor( + context, + ), systemNavigationBarIconBrightness: systemNavigationBarIconBrightness?.parse, systemNavigationBarContrastEnforced: systemNavigationBarContrastEnforced, diff --git a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart deleted file mode 100644 index 3c612975a..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_shape_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/parsers/foundation/ui_components/stac_system_ui_overlay_style_parser.dart'; -import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_app_bar_theme.freezed.dart'; -part 'stac_app_bar_theme.g.dart'; - -@freezed -abstract class StacAppBarTheme with _$StacAppBarTheme { - const factory StacAppBarTheme({ - String? backgroundColor, - String? foregroundColor, - double? elevation, - double? scrolledUnderElevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacIconThemeData? iconTheme, - StacIconThemeData? actionsIconTheme, - bool? centerTitle, - double? titleSpacing, - double? toolbarHeight, - StacTextStyle? toolbarTextStyle, - StacTextStyle? titleTextStyle, - StacSystemUIOverlayStyle? systemOverlayStyle, - StacEdgeInsets? actionsPadding, - }) = _StacAppBarTheme; - - factory StacAppBarTheme.fromJson(Map json) => - _$StacAppBarThemeFromJson(json); -} - -extension StacAppBarThemeParser on StacAppBarTheme { - AppBarTheme? parse(BuildContext context) { - return AppBarTheme( - backgroundColor: backgroundColor.toColor(context), - foregroundColor: foregroundColor.toColor(context), - elevation: elevation, - scrolledUnderElevation: scrolledUnderElevation, - shadowColor: shadowColor.toColor(context), - surfaceTintColor: surfaceTintColor.toColor(context), - shape: shape?.parse(context), - iconTheme: iconTheme?.parse(context), - actionsIconTheme: actionsIconTheme?.parse(context), - centerTitle: centerTitle, - titleSpacing: titleSpacing, - toolbarHeight: toolbarHeight, - toolbarTextStyle: toolbarTextStyle?.parse(context), - titleTextStyle: titleTextStyle?.parse(context), - systemOverlayStyle: systemOverlayStyle?.parse(context), - actionsPadding: actionsPadding?.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.freezed.dart deleted file mode 100644 index 0bfc9cd60..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.freezed.dart +++ /dev/null @@ -1,816 +0,0 @@ -// 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 - -part of 'stac_app_bar_theme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacAppBarTheme { - String? get backgroundColor; - String? get foregroundColor; - double? get elevation; - double? get scrolledUnderElevation; - String? get shadowColor; - String? get surfaceTintColor; - StacShapeBorder? get shape; - StacIconThemeData? get iconTheme; - StacIconThemeData? get actionsIconTheme; - bool? get centerTitle; - double? get titleSpacing; - double? get toolbarHeight; - StacTextStyle? get toolbarTextStyle; - StacTextStyle? get titleTextStyle; - StacSystemUIOverlayStyle? get systemOverlayStyle; - StacEdgeInsets? get actionsPadding; - - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacAppBarThemeCopyWith get copyWith => - _$StacAppBarThemeCopyWithImpl( - this as StacAppBarTheme, _$identity); - - /// Serializes this StacAppBarTheme to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacAppBarTheme && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.foregroundColor, foregroundColor) || - other.foregroundColor == foregroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.scrolledUnderElevation, scrolledUnderElevation) || - other.scrolledUnderElevation == scrolledUnderElevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme) && - (identical(other.actionsIconTheme, actionsIconTheme) || - other.actionsIconTheme == actionsIconTheme) && - (identical(other.centerTitle, centerTitle) || - other.centerTitle == centerTitle) && - (identical(other.titleSpacing, titleSpacing) || - other.titleSpacing == titleSpacing) && - (identical(other.toolbarHeight, toolbarHeight) || - other.toolbarHeight == toolbarHeight) && - (identical(other.toolbarTextStyle, toolbarTextStyle) || - other.toolbarTextStyle == toolbarTextStyle) && - (identical(other.titleTextStyle, titleTextStyle) || - other.titleTextStyle == titleTextStyle) && - (identical(other.systemOverlayStyle, systemOverlayStyle) || - other.systemOverlayStyle == systemOverlayStyle) && - (identical(other.actionsPadding, actionsPadding) || - other.actionsPadding == actionsPadding)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - foregroundColor, - elevation, - scrolledUnderElevation, - shadowColor, - surfaceTintColor, - shape, - iconTheme, - actionsIconTheme, - centerTitle, - titleSpacing, - toolbarHeight, - toolbarTextStyle, - titleTextStyle, - systemOverlayStyle, - actionsPadding); - - @override - String toString() { - return 'StacAppBarTheme(backgroundColor: $backgroundColor, foregroundColor: $foregroundColor, elevation: $elevation, scrolledUnderElevation: $scrolledUnderElevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, shape: $shape, iconTheme: $iconTheme, actionsIconTheme: $actionsIconTheme, centerTitle: $centerTitle, titleSpacing: $titleSpacing, toolbarHeight: $toolbarHeight, toolbarTextStyle: $toolbarTextStyle, titleTextStyle: $titleTextStyle, systemOverlayStyle: $systemOverlayStyle, actionsPadding: $actionsPadding)'; - } -} - -/// @nodoc -abstract mixin class $StacAppBarThemeCopyWith<$Res> { - factory $StacAppBarThemeCopyWith( - StacAppBarTheme value, $Res Function(StacAppBarTheme) _then) = - _$StacAppBarThemeCopyWithImpl; - @useResult - $Res call( - {String? backgroundColor, - String? foregroundColor, - double? elevation, - double? scrolledUnderElevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacIconThemeData? iconTheme, - StacIconThemeData? actionsIconTheme, - bool? centerTitle, - double? titleSpacing, - double? toolbarHeight, - StacTextStyle? toolbarTextStyle, - StacTextStyle? titleTextStyle, - StacSystemUIOverlayStyle? systemOverlayStyle, - StacEdgeInsets? actionsPadding}); - - $StacIconThemeDataCopyWith<$Res>? get iconTheme; - $StacIconThemeDataCopyWith<$Res>? get actionsIconTheme; -} - -/// @nodoc -class _$StacAppBarThemeCopyWithImpl<$Res> - implements $StacAppBarThemeCopyWith<$Res> { - _$StacAppBarThemeCopyWithImpl(this._self, this._then); - - final StacAppBarTheme _self; - final $Res Function(StacAppBarTheme) _then; - - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? backgroundColor = freezed, - Object? foregroundColor = freezed, - Object? elevation = freezed, - Object? scrolledUnderElevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? shape = freezed, - Object? iconTheme = freezed, - Object? actionsIconTheme = freezed, - Object? centerTitle = freezed, - Object? titleSpacing = freezed, - Object? toolbarHeight = freezed, - Object? toolbarTextStyle = freezed, - Object? titleTextStyle = freezed, - Object? systemOverlayStyle = freezed, - Object? actionsPadding = freezed, - }) { - return _then(_self.copyWith( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - foregroundColor: freezed == foregroundColor - ? _self.foregroundColor - : foregroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - scrolledUnderElevation: freezed == scrolledUnderElevation - ? _self.scrolledUnderElevation - : scrolledUnderElevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - actionsIconTheme: freezed == actionsIconTheme - ? _self.actionsIconTheme - : actionsIconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - centerTitle: freezed == centerTitle - ? _self.centerTitle - : centerTitle // ignore: cast_nullable_to_non_nullable - as bool?, - titleSpacing: freezed == titleSpacing - ? _self.titleSpacing - : titleSpacing // ignore: cast_nullable_to_non_nullable - as double?, - toolbarHeight: freezed == toolbarHeight - ? _self.toolbarHeight - : toolbarHeight // ignore: cast_nullable_to_non_nullable - as double?, - toolbarTextStyle: freezed == toolbarTextStyle - ? _self.toolbarTextStyle - : toolbarTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - titleTextStyle: freezed == titleTextStyle - ? _self.titleTextStyle - : titleTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - systemOverlayStyle: freezed == systemOverlayStyle - ? _self.systemOverlayStyle - : systemOverlayStyle // ignore: cast_nullable_to_non_nullable - as StacSystemUIOverlayStyle?, - actionsPadding: freezed == actionsPadding - ? _self.actionsPadding - : actionsPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - )); - } - - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } - - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get actionsIconTheme { - if (_self.actionsIconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.actionsIconTheme!, (value) { - return _then(_self.copyWith(actionsIconTheme: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacAppBarTheme]. -extension StacAppBarThemePatterns on StacAppBarTheme { - /// 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(_StacAppBarTheme value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacAppBarTheme() 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(_StacAppBarTheme value) $default, - ) { - final _that = this; - switch (_that) { - case _StacAppBarTheme(): - 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(_StacAppBarTheme value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacAppBarTheme() 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? backgroundColor, - String? foregroundColor, - double? elevation, - double? scrolledUnderElevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacIconThemeData? iconTheme, - StacIconThemeData? actionsIconTheme, - bool? centerTitle, - double? titleSpacing, - double? toolbarHeight, - StacTextStyle? toolbarTextStyle, - StacTextStyle? titleTextStyle, - StacSystemUIOverlayStyle? systemOverlayStyle, - StacEdgeInsets? actionsPadding)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacAppBarTheme() when $default != null: - return $default( - _that.backgroundColor, - _that.foregroundColor, - _that.elevation, - _that.scrolledUnderElevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.iconTheme, - _that.actionsIconTheme, - _that.centerTitle, - _that.titleSpacing, - _that.toolbarHeight, - _that.toolbarTextStyle, - _that.titleTextStyle, - _that.systemOverlayStyle, - _that.actionsPadding); - 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? backgroundColor, - String? foregroundColor, - double? elevation, - double? scrolledUnderElevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacIconThemeData? iconTheme, - StacIconThemeData? actionsIconTheme, - bool? centerTitle, - double? titleSpacing, - double? toolbarHeight, - StacTextStyle? toolbarTextStyle, - StacTextStyle? titleTextStyle, - StacSystemUIOverlayStyle? systemOverlayStyle, - StacEdgeInsets? actionsPadding) - $default, - ) { - final _that = this; - switch (_that) { - case _StacAppBarTheme(): - return $default( - _that.backgroundColor, - _that.foregroundColor, - _that.elevation, - _that.scrolledUnderElevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.iconTheme, - _that.actionsIconTheme, - _that.centerTitle, - _that.titleSpacing, - _that.toolbarHeight, - _that.toolbarTextStyle, - _that.titleTextStyle, - _that.systemOverlayStyle, - _that.actionsPadding); - 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? backgroundColor, - String? foregroundColor, - double? elevation, - double? scrolledUnderElevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacIconThemeData? iconTheme, - StacIconThemeData? actionsIconTheme, - bool? centerTitle, - double? titleSpacing, - double? toolbarHeight, - StacTextStyle? toolbarTextStyle, - StacTextStyle? titleTextStyle, - StacSystemUIOverlayStyle? systemOverlayStyle, - StacEdgeInsets? actionsPadding)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacAppBarTheme() when $default != null: - return $default( - _that.backgroundColor, - _that.foregroundColor, - _that.elevation, - _that.scrolledUnderElevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.iconTheme, - _that.actionsIconTheme, - _that.centerTitle, - _that.titleSpacing, - _that.toolbarHeight, - _that.toolbarTextStyle, - _that.titleTextStyle, - _that.systemOverlayStyle, - _that.actionsPadding); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacAppBarTheme implements StacAppBarTheme { - const _StacAppBarTheme( - {this.backgroundColor, - this.foregroundColor, - this.elevation, - this.scrolledUnderElevation, - this.shadowColor, - this.surfaceTintColor, - this.shape, - this.iconTheme, - this.actionsIconTheme, - this.centerTitle, - this.titleSpacing, - this.toolbarHeight, - this.toolbarTextStyle, - this.titleTextStyle, - this.systemOverlayStyle, - this.actionsPadding}); - factory _StacAppBarTheme.fromJson(Map json) => - _$StacAppBarThemeFromJson(json); - - @override - final String? backgroundColor; - @override - final String? foregroundColor; - @override - final double? elevation; - @override - final double? scrolledUnderElevation; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final StacShapeBorder? shape; - @override - final StacIconThemeData? iconTheme; - @override - final StacIconThemeData? actionsIconTheme; - @override - final bool? centerTitle; - @override - final double? titleSpacing; - @override - final double? toolbarHeight; - @override - final StacTextStyle? toolbarTextStyle; - @override - final StacTextStyle? titleTextStyle; - @override - final StacSystemUIOverlayStyle? systemOverlayStyle; - @override - final StacEdgeInsets? actionsPadding; - - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacAppBarThemeCopyWith<_StacAppBarTheme> get copyWith => - __$StacAppBarThemeCopyWithImpl<_StacAppBarTheme>(this, _$identity); - - @override - Map toJson() { - return _$StacAppBarThemeToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacAppBarTheme && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.foregroundColor, foregroundColor) || - other.foregroundColor == foregroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.scrolledUnderElevation, scrolledUnderElevation) || - other.scrolledUnderElevation == scrolledUnderElevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme) && - (identical(other.actionsIconTheme, actionsIconTheme) || - other.actionsIconTheme == actionsIconTheme) && - (identical(other.centerTitle, centerTitle) || - other.centerTitle == centerTitle) && - (identical(other.titleSpacing, titleSpacing) || - other.titleSpacing == titleSpacing) && - (identical(other.toolbarHeight, toolbarHeight) || - other.toolbarHeight == toolbarHeight) && - (identical(other.toolbarTextStyle, toolbarTextStyle) || - other.toolbarTextStyle == toolbarTextStyle) && - (identical(other.titleTextStyle, titleTextStyle) || - other.titleTextStyle == titleTextStyle) && - (identical(other.systemOverlayStyle, systemOverlayStyle) || - other.systemOverlayStyle == systemOverlayStyle) && - (identical(other.actionsPadding, actionsPadding) || - other.actionsPadding == actionsPadding)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - foregroundColor, - elevation, - scrolledUnderElevation, - shadowColor, - surfaceTintColor, - shape, - iconTheme, - actionsIconTheme, - centerTitle, - titleSpacing, - toolbarHeight, - toolbarTextStyle, - titleTextStyle, - systemOverlayStyle, - actionsPadding); - - @override - String toString() { - return 'StacAppBarTheme(backgroundColor: $backgroundColor, foregroundColor: $foregroundColor, elevation: $elevation, scrolledUnderElevation: $scrolledUnderElevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, shape: $shape, iconTheme: $iconTheme, actionsIconTheme: $actionsIconTheme, centerTitle: $centerTitle, titleSpacing: $titleSpacing, toolbarHeight: $toolbarHeight, toolbarTextStyle: $toolbarTextStyle, titleTextStyle: $titleTextStyle, systemOverlayStyle: $systemOverlayStyle, actionsPadding: $actionsPadding)'; - } -} - -/// @nodoc -abstract mixin class _$StacAppBarThemeCopyWith<$Res> - implements $StacAppBarThemeCopyWith<$Res> { - factory _$StacAppBarThemeCopyWith( - _StacAppBarTheme value, $Res Function(_StacAppBarTheme) _then) = - __$StacAppBarThemeCopyWithImpl; - @override - @useResult - $Res call( - {String? backgroundColor, - String? foregroundColor, - double? elevation, - double? scrolledUnderElevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacIconThemeData? iconTheme, - StacIconThemeData? actionsIconTheme, - bool? centerTitle, - double? titleSpacing, - double? toolbarHeight, - StacTextStyle? toolbarTextStyle, - StacTextStyle? titleTextStyle, - StacSystemUIOverlayStyle? systemOverlayStyle, - StacEdgeInsets? actionsPadding}); - - @override - $StacIconThemeDataCopyWith<$Res>? get iconTheme; - @override - $StacIconThemeDataCopyWith<$Res>? get actionsIconTheme; -} - -/// @nodoc -class __$StacAppBarThemeCopyWithImpl<$Res> - implements _$StacAppBarThemeCopyWith<$Res> { - __$StacAppBarThemeCopyWithImpl(this._self, this._then); - - final _StacAppBarTheme _self; - final $Res Function(_StacAppBarTheme) _then; - - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? backgroundColor = freezed, - Object? foregroundColor = freezed, - Object? elevation = freezed, - Object? scrolledUnderElevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? shape = freezed, - Object? iconTheme = freezed, - Object? actionsIconTheme = freezed, - Object? centerTitle = freezed, - Object? titleSpacing = freezed, - Object? toolbarHeight = freezed, - Object? toolbarTextStyle = freezed, - Object? titleTextStyle = freezed, - Object? systemOverlayStyle = freezed, - Object? actionsPadding = freezed, - }) { - return _then(_StacAppBarTheme( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - foregroundColor: freezed == foregroundColor - ? _self.foregroundColor - : foregroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - scrolledUnderElevation: freezed == scrolledUnderElevation - ? _self.scrolledUnderElevation - : scrolledUnderElevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - actionsIconTheme: freezed == actionsIconTheme - ? _self.actionsIconTheme - : actionsIconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - centerTitle: freezed == centerTitle - ? _self.centerTitle - : centerTitle // ignore: cast_nullable_to_non_nullable - as bool?, - titleSpacing: freezed == titleSpacing - ? _self.titleSpacing - : titleSpacing // ignore: cast_nullable_to_non_nullable - as double?, - toolbarHeight: freezed == toolbarHeight - ? _self.toolbarHeight - : toolbarHeight // ignore: cast_nullable_to_non_nullable - as double?, - toolbarTextStyle: freezed == toolbarTextStyle - ? _self.toolbarTextStyle - : toolbarTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - titleTextStyle: freezed == titleTextStyle - ? _self.titleTextStyle - : titleTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - systemOverlayStyle: freezed == systemOverlayStyle - ? _self.systemOverlayStyle - : systemOverlayStyle // ignore: cast_nullable_to_non_nullable - as StacSystemUIOverlayStyle?, - actionsPadding: freezed == actionsPadding - ? _self.actionsPadding - : actionsPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - )); - } - - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } - - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get actionsIconTheme { - if (_self.actionsIconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.actionsIconTheme!, (value) { - return _then(_self.copyWith(actionsIconTheme: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.g.dart b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.g.dart deleted file mode 100644 index ad0447f78..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.g.dart +++ /dev/null @@ -1,65 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_app_bar_theme.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacAppBarTheme _$StacAppBarThemeFromJson(Map json) => - _StacAppBarTheme( - backgroundColor: json['backgroundColor'] as String?, - foregroundColor: json['foregroundColor'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - scrolledUnderElevation: - (json['scrolledUnderElevation'] as num?)?.toDouble(), - shadowColor: json['shadowColor'] as String?, - surfaceTintColor: json['surfaceTintColor'] as String?, - shape: json['shape'] == null - ? null - : StacShapeBorder.fromJson(json['shape'] as Map), - iconTheme: json['iconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['iconTheme'] as Map), - actionsIconTheme: json['actionsIconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['actionsIconTheme'] as Map), - centerTitle: json['centerTitle'] as bool?, - titleSpacing: (json['titleSpacing'] as num?)?.toDouble(), - toolbarHeight: (json['toolbarHeight'] as num?)?.toDouble(), - toolbarTextStyle: json['toolbarTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['toolbarTextStyle']), - titleTextStyle: json['titleTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['titleTextStyle']), - systemOverlayStyle: json['systemOverlayStyle'] == null - ? null - : StacSystemUIOverlayStyle.fromJson( - json['systemOverlayStyle'] as Map), - actionsPadding: json['actionsPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['actionsPadding']), - ); - -Map _$StacAppBarThemeToJson(_StacAppBarTheme instance) => - { - 'backgroundColor': instance.backgroundColor, - 'foregroundColor': instance.foregroundColor, - 'elevation': instance.elevation, - 'scrolledUnderElevation': instance.scrolledUnderElevation, - 'shadowColor': instance.shadowColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'shape': instance.shape, - 'iconTheme': instance.iconTheme, - 'actionsIconTheme': instance.actionsIconTheme, - 'centerTitle': instance.centerTitle, - 'titleSpacing': instance.titleSpacing, - 'toolbarHeight': instance.toolbarHeight, - 'toolbarTextStyle': instance.toolbarTextStyle, - 'titleTextStyle': instance.titleTextStyle, - 'systemOverlayStyle': instance.systemOverlayStyle, - 'actionsPadding': instance.actionsPadding, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme_parser.dart b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme_parser.dart new file mode 100644 index 000000000..af17b3858 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme_parser.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_shape_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/parsers/foundation/ui_components/stac_system_ui_overlay_style_parser.dart'; +import 'package:stac/src/parsers/theme/stac_icon_theme_data_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacAppBarTheme]. +/// +/// Converts [StacAppBarTheme] to Flutter's [AppBarTheme]. +extension StacAppBarThemeParser on StacAppBarTheme { + AppBarTheme parse(BuildContext context) { + return AppBarTheme( + backgroundColor: backgroundColor?.toColor(context), + foregroundColor: foregroundColor?.toColor(context), + elevation: elevation, + scrolledUnderElevation: scrolledUnderElevation, + shadowColor: shadowColor?.toColor(context), + surfaceTintColor: surfaceTintColor?.toColor(context), + shape: shape?.parse(context), + iconTheme: iconTheme?.parse(context), + actionsIconTheme: actionsIconTheme?.parse(context), + centerTitle: centerTitle, + titleSpacing: titleSpacing, + leadingWidth: leadingWidth, + toolbarHeight: toolbarHeight, + toolbarTextStyle: toolbarTextStyle?.parse(context), + titleTextStyle: titleTextStyle?.parse(context), + systemOverlayStyle: systemOverlayStyle?.parse(context), + actionsPadding: actionsPadding?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart deleted file mode 100644 index fd562c77e..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart +++ /dev/null @@ -1,43 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/alignment/stac_alignment_geometry_parser.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_offset_parser.dart'; -import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_badge_theme_data.freezed.dart'; -part 'stac_badge_theme_data.g.dart'; - -@freezed -abstract class StacBadgeThemeData with _$StacBadgeThemeData { - const factory StacBadgeThemeData({ - String? backgroundColor, - String? textColor, - double? smallSize, - double? largeSize, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacAlignmentGeometry? alignment, - StacOffset? offset, - }) = _StacBadgeThemeData; - - factory StacBadgeThemeData.fromJson(Map json) => - _$StacBadgeThemeDataFromJson(json); -} - -extension StacBadgeThemeDataParser on StacBadgeThemeData { - BadgeThemeData parse(BuildContext context) { - return BadgeThemeData( - backgroundColor: backgroundColor?.toColor(context), - textColor: textColor?.toColor(context), - smallSize: smallSize, - largeSize: largeSize, - textStyle: textStyle?.parse(context), - padding: padding?.parse, - alignment: alignment?.parse, - offset: offset?.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.freezed.dart deleted file mode 100644 index d6c089fc2..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.freezed.dart +++ /dev/null @@ -1,510 +0,0 @@ -// 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 - -part of 'stac_badge_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacBadgeThemeData { - String? get backgroundColor; - String? get textColor; - double? get smallSize; - double? get largeSize; - StacTextStyle? get textStyle; - StacEdgeInsets? get padding; - StacAlignmentGeometry? get alignment; - StacOffset? get offset; - - /// Create a copy of StacBadgeThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacBadgeThemeDataCopyWith get copyWith => - _$StacBadgeThemeDataCopyWithImpl( - this as StacBadgeThemeData, _$identity); - - /// Serializes this StacBadgeThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacBadgeThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.textColor, textColor) || - other.textColor == textColor) && - (identical(other.smallSize, smallSize) || - other.smallSize == smallSize) && - (identical(other.largeSize, largeSize) || - other.largeSize == largeSize) && - (identical(other.textStyle, textStyle) || - other.textStyle == textStyle) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.alignment, alignment) || - other.alignment == alignment) && - (identical(other.offset, offset) || other.offset == offset)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, backgroundColor, textColor, - smallSize, largeSize, textStyle, padding, alignment, offset); - - @override - String toString() { - return 'StacBadgeThemeData(backgroundColor: $backgroundColor, textColor: $textColor, smallSize: $smallSize, largeSize: $largeSize, textStyle: $textStyle, padding: $padding, alignment: $alignment, offset: $offset)'; - } -} - -/// @nodoc -abstract mixin class $StacBadgeThemeDataCopyWith<$Res> { - factory $StacBadgeThemeDataCopyWith( - StacBadgeThemeData value, $Res Function(StacBadgeThemeData) _then) = - _$StacBadgeThemeDataCopyWithImpl; - @useResult - $Res call( - {String? backgroundColor, - String? textColor, - double? smallSize, - double? largeSize, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacAlignmentGeometry? alignment, - StacOffset? offset}); -} - -/// @nodoc -class _$StacBadgeThemeDataCopyWithImpl<$Res> - implements $StacBadgeThemeDataCopyWith<$Res> { - _$StacBadgeThemeDataCopyWithImpl(this._self, this._then); - - final StacBadgeThemeData _self; - final $Res Function(StacBadgeThemeData) _then; - - /// Create a copy of StacBadgeThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? backgroundColor = freezed, - Object? textColor = freezed, - Object? smallSize = freezed, - Object? largeSize = freezed, - Object? textStyle = freezed, - Object? padding = freezed, - Object? alignment = freezed, - Object? offset = freezed, - }) { - return _then(_self.copyWith( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - textColor: freezed == textColor - ? _self.textColor - : textColor // ignore: cast_nullable_to_non_nullable - as String?, - smallSize: freezed == smallSize - ? _self.smallSize - : smallSize // ignore: cast_nullable_to_non_nullable - as double?, - largeSize: freezed == largeSize - ? _self.largeSize - : largeSize // ignore: cast_nullable_to_non_nullable - as double?, - textStyle: freezed == textStyle - ? _self.textStyle - : textStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - alignment: freezed == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignmentGeometry?, - offset: freezed == offset - ? _self.offset - : offset // ignore: cast_nullable_to_non_nullable - as StacOffset?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacBadgeThemeData]. -extension StacBadgeThemeDataPatterns on StacBadgeThemeData { - /// 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(_StacBadgeThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacBadgeThemeData() 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(_StacBadgeThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacBadgeThemeData(): - 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(_StacBadgeThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacBadgeThemeData() 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? backgroundColor, - String? textColor, - double? smallSize, - double? largeSize, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacAlignmentGeometry? alignment, - StacOffset? offset)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacBadgeThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.textColor, - _that.smallSize, - _that.largeSize, - _that.textStyle, - _that.padding, - _that.alignment, - _that.offset); - 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? backgroundColor, - String? textColor, - double? smallSize, - double? largeSize, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacAlignmentGeometry? alignment, - StacOffset? offset) - $default, - ) { - final _that = this; - switch (_that) { - case _StacBadgeThemeData(): - return $default( - _that.backgroundColor, - _that.textColor, - _that.smallSize, - _that.largeSize, - _that.textStyle, - _that.padding, - _that.alignment, - _that.offset); - 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? backgroundColor, - String? textColor, - double? smallSize, - double? largeSize, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacAlignmentGeometry? alignment, - StacOffset? offset)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacBadgeThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.textColor, - _that.smallSize, - _that.largeSize, - _that.textStyle, - _that.padding, - _that.alignment, - _that.offset); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacBadgeThemeData implements StacBadgeThemeData { - const _StacBadgeThemeData( - {this.backgroundColor, - this.textColor, - this.smallSize, - this.largeSize, - this.textStyle, - this.padding, - this.alignment, - this.offset}); - factory _StacBadgeThemeData.fromJson(Map json) => - _$StacBadgeThemeDataFromJson(json); - - @override - final String? backgroundColor; - @override - final String? textColor; - @override - final double? smallSize; - @override - final double? largeSize; - @override - final StacTextStyle? textStyle; - @override - final StacEdgeInsets? padding; - @override - final StacAlignmentGeometry? alignment; - @override - final StacOffset? offset; - - /// Create a copy of StacBadgeThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacBadgeThemeDataCopyWith<_StacBadgeThemeData> get copyWith => - __$StacBadgeThemeDataCopyWithImpl<_StacBadgeThemeData>(this, _$identity); - - @override - Map toJson() { - return _$StacBadgeThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacBadgeThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.textColor, textColor) || - other.textColor == textColor) && - (identical(other.smallSize, smallSize) || - other.smallSize == smallSize) && - (identical(other.largeSize, largeSize) || - other.largeSize == largeSize) && - (identical(other.textStyle, textStyle) || - other.textStyle == textStyle) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.alignment, alignment) || - other.alignment == alignment) && - (identical(other.offset, offset) || other.offset == offset)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, backgroundColor, textColor, - smallSize, largeSize, textStyle, padding, alignment, offset); - - @override - String toString() { - return 'StacBadgeThemeData(backgroundColor: $backgroundColor, textColor: $textColor, smallSize: $smallSize, largeSize: $largeSize, textStyle: $textStyle, padding: $padding, alignment: $alignment, offset: $offset)'; - } -} - -/// @nodoc -abstract mixin class _$StacBadgeThemeDataCopyWith<$Res> - implements $StacBadgeThemeDataCopyWith<$Res> { - factory _$StacBadgeThemeDataCopyWith( - _StacBadgeThemeData value, $Res Function(_StacBadgeThemeData) _then) = - __$StacBadgeThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? backgroundColor, - String? textColor, - double? smallSize, - double? largeSize, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacAlignmentGeometry? alignment, - StacOffset? offset}); -} - -/// @nodoc -class __$StacBadgeThemeDataCopyWithImpl<$Res> - implements _$StacBadgeThemeDataCopyWith<$Res> { - __$StacBadgeThemeDataCopyWithImpl(this._self, this._then); - - final _StacBadgeThemeData _self; - final $Res Function(_StacBadgeThemeData) _then; - - /// Create a copy of StacBadgeThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? backgroundColor = freezed, - Object? textColor = freezed, - Object? smallSize = freezed, - Object? largeSize = freezed, - Object? textStyle = freezed, - Object? padding = freezed, - Object? alignment = freezed, - Object? offset = freezed, - }) { - return _then(_StacBadgeThemeData( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - textColor: freezed == textColor - ? _self.textColor - : textColor // ignore: cast_nullable_to_non_nullable - as String?, - smallSize: freezed == smallSize - ? _self.smallSize - : smallSize // ignore: cast_nullable_to_non_nullable - as double?, - largeSize: freezed == largeSize - ? _self.largeSize - : largeSize // ignore: cast_nullable_to_non_nullable - as double?, - textStyle: freezed == textStyle - ? _self.textStyle - : textStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - alignment: freezed == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignmentGeometry?, - offset: freezed == offset - ? _self.offset - : offset // ignore: cast_nullable_to_non_nullable - as StacOffset?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.g.dart deleted file mode 100644 index f6ad8c212..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.g.dart +++ /dev/null @@ -1,40 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_badge_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacBadgeThemeData _$StacBadgeThemeDataFromJson(Map json) => - _StacBadgeThemeData( - backgroundColor: json['backgroundColor'] as String?, - textColor: json['textColor'] as String?, - smallSize: (json['smallSize'] as num?)?.toDouble(), - largeSize: (json['largeSize'] as num?)?.toDouble(), - textStyle: json['textStyle'] == null - ? null - : StacTextStyle.fromJson(json['textStyle']), - padding: json['padding'] == null - ? null - : StacEdgeInsets.fromJson(json['padding']), - alignment: json['alignment'] == null - ? null - : StacAlignmentGeometry.fromJson( - json['alignment'] as Map), - offset: json['offset'] == null - ? null - : StacOffset.fromJson(json['offset'] as Map), - ); - -Map _$StacBadgeThemeDataToJson(_StacBadgeThemeData instance) => - { - 'backgroundColor': instance.backgroundColor, - 'textColor': instance.textColor, - 'smallSize': instance.smallSize, - 'largeSize': instance.largeSize, - 'textStyle': instance.textStyle, - 'padding': instance.padding, - 'alignment': instance.alignment, - 'offset': instance.offset, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart deleted file mode 100644 index a1914ad9e..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_bottom_app_bar_theme.freezed.dart'; -part 'stac_bottom_app_bar_theme.g.dart'; - -@freezed -abstract class StacBottomAppBarTheme with _$StacBottomAppBarTheme { - const factory StacBottomAppBarTheme({ - String? color, - double? elevation, - double? height, - String? surfaceTintColor, - String? shadowColor, - StacEdgeInsets? padding, - }) = _StacBottomAppBarTheme; - - factory StacBottomAppBarTheme.fromJson(Map json) => - _$StacBottomAppBarThemeFromJson(json); -} - -extension StacBottomAppBarThemeParser on StacBottomAppBarTheme { - BottomAppBarThemeData? parse(BuildContext context) { - return BottomAppBarThemeData( - color: color?.toColor(context), - elevation: elevation, - height: height, - surfaceTintColor: surfaceTintColor.toColor(context), - shadowColor: shadowColor.toColor(context), - padding: padding?.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart deleted file mode 100644 index db83e505a..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart +++ /dev/null @@ -1,442 +0,0 @@ -// 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 - -part of 'stac_bottom_app_bar_theme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacBottomAppBarTheme { - String? get color; - double? get elevation; - double? get height; - String? get surfaceTintColor; - String? get shadowColor; - StacEdgeInsets? get padding; - - /// Create a copy of StacBottomAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacBottomAppBarThemeCopyWith get copyWith => - _$StacBottomAppBarThemeCopyWithImpl( - this as StacBottomAppBarTheme, _$identity); - - /// Serializes this StacBottomAppBarTheme to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacBottomAppBarTheme && - (identical(other.color, color) || other.color == color) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.height, height) || other.height == height) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.padding, padding) || other.padding == padding)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, color, elevation, height, - surfaceTintColor, shadowColor, padding); - - @override - String toString() { - return 'StacBottomAppBarTheme(color: $color, elevation: $elevation, height: $height, surfaceTintColor: $surfaceTintColor, shadowColor: $shadowColor, padding: $padding)'; - } -} - -/// @nodoc -abstract mixin class $StacBottomAppBarThemeCopyWith<$Res> { - factory $StacBottomAppBarThemeCopyWith(StacBottomAppBarTheme value, - $Res Function(StacBottomAppBarTheme) _then) = - _$StacBottomAppBarThemeCopyWithImpl; - @useResult - $Res call( - {String? color, - double? elevation, - double? height, - String? surfaceTintColor, - String? shadowColor, - StacEdgeInsets? padding}); -} - -/// @nodoc -class _$StacBottomAppBarThemeCopyWithImpl<$Res> - implements $StacBottomAppBarThemeCopyWith<$Res> { - _$StacBottomAppBarThemeCopyWithImpl(this._self, this._then); - - final StacBottomAppBarTheme _self; - final $Res Function(StacBottomAppBarTheme) _then; - - /// Create a copy of StacBottomAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? color = freezed, - Object? elevation = freezed, - Object? height = freezed, - Object? surfaceTintColor = freezed, - Object? shadowColor = freezed, - Object? padding = freezed, - }) { - return _then(_self.copyWith( - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - height: freezed == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as double?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacBottomAppBarTheme]. -extension StacBottomAppBarThemePatterns on StacBottomAppBarTheme { - /// 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(_StacBottomAppBarTheme value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacBottomAppBarTheme() 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(_StacBottomAppBarTheme value) $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomAppBarTheme(): - 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(_StacBottomAppBarTheme value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomAppBarTheme() 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? color, - double? elevation, - double? height, - String? surfaceTintColor, - String? shadowColor, - StacEdgeInsets? padding)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacBottomAppBarTheme() when $default != null: - return $default(_that.color, _that.elevation, _that.height, - _that.surfaceTintColor, _that.shadowColor, _that.padding); - 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? color, - double? elevation, - double? height, - String? surfaceTintColor, - String? shadowColor, - StacEdgeInsets? padding) - $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomAppBarTheme(): - return $default(_that.color, _that.elevation, _that.height, - _that.surfaceTintColor, _that.shadowColor, _that.padding); - 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? color, - double? elevation, - double? height, - String? surfaceTintColor, - String? shadowColor, - StacEdgeInsets? padding)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomAppBarTheme() when $default != null: - return $default(_that.color, _that.elevation, _that.height, - _that.surfaceTintColor, _that.shadowColor, _that.padding); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacBottomAppBarTheme implements StacBottomAppBarTheme { - const _StacBottomAppBarTheme( - {this.color, - this.elevation, - this.height, - this.surfaceTintColor, - this.shadowColor, - this.padding}); - factory _StacBottomAppBarTheme.fromJson(Map json) => - _$StacBottomAppBarThemeFromJson(json); - - @override - final String? color; - @override - final double? elevation; - @override - final double? height; - @override - final String? surfaceTintColor; - @override - final String? shadowColor; - @override - final StacEdgeInsets? padding; - - /// Create a copy of StacBottomAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacBottomAppBarThemeCopyWith<_StacBottomAppBarTheme> get copyWith => - __$StacBottomAppBarThemeCopyWithImpl<_StacBottomAppBarTheme>( - this, _$identity); - - @override - Map toJson() { - return _$StacBottomAppBarThemeToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacBottomAppBarTheme && - (identical(other.color, color) || other.color == color) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.height, height) || other.height == height) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.padding, padding) || other.padding == padding)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, color, elevation, height, - surfaceTintColor, shadowColor, padding); - - @override - String toString() { - return 'StacBottomAppBarTheme(color: $color, elevation: $elevation, height: $height, surfaceTintColor: $surfaceTintColor, shadowColor: $shadowColor, padding: $padding)'; - } -} - -/// @nodoc -abstract mixin class _$StacBottomAppBarThemeCopyWith<$Res> - implements $StacBottomAppBarThemeCopyWith<$Res> { - factory _$StacBottomAppBarThemeCopyWith(_StacBottomAppBarTheme value, - $Res Function(_StacBottomAppBarTheme) _then) = - __$StacBottomAppBarThemeCopyWithImpl; - @override - @useResult - $Res call( - {String? color, - double? elevation, - double? height, - String? surfaceTintColor, - String? shadowColor, - StacEdgeInsets? padding}); -} - -/// @nodoc -class __$StacBottomAppBarThemeCopyWithImpl<$Res> - implements _$StacBottomAppBarThemeCopyWith<$Res> { - __$StacBottomAppBarThemeCopyWithImpl(this._self, this._then); - - final _StacBottomAppBarTheme _self; - final $Res Function(_StacBottomAppBarTheme) _then; - - /// Create a copy of StacBottomAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? color = freezed, - Object? elevation = freezed, - Object? height = freezed, - Object? surfaceTintColor = freezed, - Object? shadowColor = freezed, - Object? padding = freezed, - }) { - return _then(_StacBottomAppBarTheme( - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - height: freezed == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as double?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.g.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.g.dart deleted file mode 100644 index 2330a8c1e..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.g.dart +++ /dev/null @@ -1,31 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_bottom_app_bar_theme.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacBottomAppBarTheme _$StacBottomAppBarThemeFromJson( - Map json) => - _StacBottomAppBarTheme( - color: json['color'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - height: (json['height'] as num?)?.toDouble(), - surfaceTintColor: json['surfaceTintColor'] as String?, - shadowColor: json['shadowColor'] as String?, - padding: json['padding'] == null - ? null - : StacEdgeInsets.fromJson(json['padding']), - ); - -Map _$StacBottomAppBarThemeToJson( - _StacBottomAppBarTheme instance) => - { - 'color': instance.color, - 'elevation': instance.elevation, - 'height': instance.height, - 'surfaceTintColor': instance.surfaceTintColor, - 'shadowColor': instance.shadowColor, - 'padding': instance.padding, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme_parser.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme_parser.dart new file mode 100644 index 000000000..9795ff6f9 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme_parser.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacBottomAppBarThemeData]. +/// +/// Converts [StacBottomAppBarThemeData] to Flutter's [BottomAppBarThemeData]. +extension StacBottomAppBarThemeParser on StacBottomAppBarThemeData { + BottomAppBarThemeData parse(BuildContext context) { + return BottomAppBarThemeData( + color: color?.toColor(context), + elevation: elevation, + height: height, + surfaceTintColor: surfaceTintColor?.toColor(context), + shadowColor: shadowColor?.toColor(context), + padding: padding?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart deleted file mode 100644 index 8668c3d83..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; -import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_bottom_nav_bar_theme.freezed.dart'; -part 'stac_bottom_nav_bar_theme.g.dart'; - -@freezed -abstract class StacBottomNavBarThemeData with _$StacBottomNavBarThemeData { - const factory StacBottomNavBarThemeData({ - String? backgroundColor, - double? elevation, - StacIconThemeData? selectedIconTheme, - StacIconThemeData? unselectedIconTheme, - String? selectedItemColor, - String? unselectedItemColor, - StacTextStyle? selectedLabelStyle, - StacTextStyle? unselectedLabelStyle, - bool? showSelectedLabels, - bool? showUnselectedLabels, - BottomNavigationBarType? type, - bool? enableFeedback, - BottomNavigationBarLandscapeLayout? landscapeLayout, - }) = _StacBottomNavBarThemeData; - - factory StacBottomNavBarThemeData.fromJson(Map json) => - _$StacBottomNavBarThemeDataFromJson(json); -} - -extension StacBottomNavBarThemeDataParser on StacBottomNavBarThemeData { - BottomNavigationBarThemeData? parse(BuildContext context) { - return BottomNavigationBarThemeData( - backgroundColor: backgroundColor.toColor(context), - elevation: elevation, - selectedIconTheme: selectedIconTheme?.parse(context), - unselectedIconTheme: unselectedIconTheme?.parse(context), - selectedItemColor: selectedItemColor.toColor(context), - unselectedItemColor: unselectedItemColor.toColor(context), - selectedLabelStyle: selectedLabelStyle?.parse(context), - unselectedLabelStyle: unselectedLabelStyle?.parse(context), - showSelectedLabels: showSelectedLabels, - showUnselectedLabels: showUnselectedLabels, - type: type, - enableFeedback: enableFeedback, - landscapeLayout: landscapeLayout, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.freezed.dart deleted file mode 100644 index c1aa73b89..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.freezed.dart +++ /dev/null @@ -1,736 +0,0 @@ -// 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 - -part of 'stac_bottom_nav_bar_theme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacBottomNavBarThemeData { - String? get backgroundColor; - double? get elevation; - StacIconThemeData? get selectedIconTheme; - StacIconThemeData? get unselectedIconTheme; - String? get selectedItemColor; - String? get unselectedItemColor; - StacTextStyle? get selectedLabelStyle; - StacTextStyle? get unselectedLabelStyle; - bool? get showSelectedLabels; - bool? get showUnselectedLabels; - BottomNavigationBarType? get type; - bool? get enableFeedback; - BottomNavigationBarLandscapeLayout? get landscapeLayout; - - /// Create a copy of StacBottomNavBarThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacBottomNavBarThemeDataCopyWith get copyWith => - _$StacBottomNavBarThemeDataCopyWithImpl( - this as StacBottomNavBarThemeData, _$identity); - - /// Serializes this StacBottomNavBarThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacBottomNavBarThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.selectedIconTheme, selectedIconTheme) || - other.selectedIconTheme == selectedIconTheme) && - (identical(other.unselectedIconTheme, unselectedIconTheme) || - other.unselectedIconTheme == unselectedIconTheme) && - (identical(other.selectedItemColor, selectedItemColor) || - other.selectedItemColor == selectedItemColor) && - (identical(other.unselectedItemColor, unselectedItemColor) || - other.unselectedItemColor == unselectedItemColor) && - (identical(other.selectedLabelStyle, selectedLabelStyle) || - other.selectedLabelStyle == selectedLabelStyle) && - (identical(other.unselectedLabelStyle, unselectedLabelStyle) || - other.unselectedLabelStyle == unselectedLabelStyle) && - (identical(other.showSelectedLabels, showSelectedLabels) || - other.showSelectedLabels == showSelectedLabels) && - (identical(other.showUnselectedLabels, showUnselectedLabels) || - other.showUnselectedLabels == showUnselectedLabels) && - (identical(other.type, type) || other.type == type) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.landscapeLayout, landscapeLayout) || - other.landscapeLayout == landscapeLayout)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - elevation, - selectedIconTheme, - unselectedIconTheme, - selectedItemColor, - unselectedItemColor, - selectedLabelStyle, - unselectedLabelStyle, - showSelectedLabels, - showUnselectedLabels, - type, - enableFeedback, - landscapeLayout); - - @override - String toString() { - return 'StacBottomNavBarThemeData(backgroundColor: $backgroundColor, elevation: $elevation, selectedIconTheme: $selectedIconTheme, unselectedIconTheme: $unselectedIconTheme, selectedItemColor: $selectedItemColor, unselectedItemColor: $unselectedItemColor, selectedLabelStyle: $selectedLabelStyle, unselectedLabelStyle: $unselectedLabelStyle, showSelectedLabels: $showSelectedLabels, showUnselectedLabels: $showUnselectedLabels, type: $type, enableFeedback: $enableFeedback, landscapeLayout: $landscapeLayout)'; - } -} - -/// @nodoc -abstract mixin class $StacBottomNavBarThemeDataCopyWith<$Res> { - factory $StacBottomNavBarThemeDataCopyWith(StacBottomNavBarThemeData value, - $Res Function(StacBottomNavBarThemeData) _then) = - _$StacBottomNavBarThemeDataCopyWithImpl; - @useResult - $Res call( - {String? backgroundColor, - double? elevation, - StacIconThemeData? selectedIconTheme, - StacIconThemeData? unselectedIconTheme, - String? selectedItemColor, - String? unselectedItemColor, - StacTextStyle? selectedLabelStyle, - StacTextStyle? unselectedLabelStyle, - bool? showSelectedLabels, - bool? showUnselectedLabels, - BottomNavigationBarType? type, - bool? enableFeedback, - BottomNavigationBarLandscapeLayout? landscapeLayout}); - - $StacIconThemeDataCopyWith<$Res>? get selectedIconTheme; - $StacIconThemeDataCopyWith<$Res>? get unselectedIconTheme; -} - -/// @nodoc -class _$StacBottomNavBarThemeDataCopyWithImpl<$Res> - implements $StacBottomNavBarThemeDataCopyWith<$Res> { - _$StacBottomNavBarThemeDataCopyWithImpl(this._self, this._then); - - final StacBottomNavBarThemeData _self; - final $Res Function(StacBottomNavBarThemeData) _then; - - /// Create a copy of StacBottomNavBarThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? selectedIconTheme = freezed, - Object? unselectedIconTheme = freezed, - Object? selectedItemColor = freezed, - Object? unselectedItemColor = freezed, - Object? selectedLabelStyle = freezed, - Object? unselectedLabelStyle = freezed, - Object? showSelectedLabels = freezed, - Object? showUnselectedLabels = freezed, - Object? type = freezed, - Object? enableFeedback = freezed, - Object? landscapeLayout = freezed, - }) { - return _then(_self.copyWith( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - selectedIconTheme: freezed == selectedIconTheme - ? _self.selectedIconTheme - : selectedIconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - unselectedIconTheme: freezed == unselectedIconTheme - ? _self.unselectedIconTheme - : unselectedIconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - selectedItemColor: freezed == selectedItemColor - ? _self.selectedItemColor - : selectedItemColor // ignore: cast_nullable_to_non_nullable - as String?, - unselectedItemColor: freezed == unselectedItemColor - ? _self.unselectedItemColor - : unselectedItemColor // ignore: cast_nullable_to_non_nullable - as String?, - selectedLabelStyle: freezed == selectedLabelStyle - ? _self.selectedLabelStyle - : selectedLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - unselectedLabelStyle: freezed == unselectedLabelStyle - ? _self.unselectedLabelStyle - : unselectedLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - showSelectedLabels: freezed == showSelectedLabels - ? _self.showSelectedLabels - : showSelectedLabels // ignore: cast_nullable_to_non_nullable - as bool?, - showUnselectedLabels: freezed == showUnselectedLabels - ? _self.showUnselectedLabels - : showUnselectedLabels // ignore: cast_nullable_to_non_nullable - as bool?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as BottomNavigationBarType?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - landscapeLayout: freezed == landscapeLayout - ? _self.landscapeLayout - : landscapeLayout // ignore: cast_nullable_to_non_nullable - as BottomNavigationBarLandscapeLayout?, - )); - } - - /// Create a copy of StacBottomNavBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get selectedIconTheme { - if (_self.selectedIconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.selectedIconTheme!, (value) { - return _then(_self.copyWith(selectedIconTheme: value)); - }); - } - - /// Create a copy of StacBottomNavBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get unselectedIconTheme { - if (_self.unselectedIconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.unselectedIconTheme!, - (value) { - return _then(_self.copyWith(unselectedIconTheme: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacBottomNavBarThemeData]. -extension StacBottomNavBarThemeDataPatterns on StacBottomNavBarThemeData { - /// 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(_StacBottomNavBarThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacBottomNavBarThemeData() 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(_StacBottomNavBarThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomNavBarThemeData(): - 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(_StacBottomNavBarThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomNavBarThemeData() 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? backgroundColor, - double? elevation, - StacIconThemeData? selectedIconTheme, - StacIconThemeData? unselectedIconTheme, - String? selectedItemColor, - String? unselectedItemColor, - StacTextStyle? selectedLabelStyle, - StacTextStyle? unselectedLabelStyle, - bool? showSelectedLabels, - bool? showUnselectedLabels, - BottomNavigationBarType? type, - bool? enableFeedback, - BottomNavigationBarLandscapeLayout? landscapeLayout)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacBottomNavBarThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.elevation, - _that.selectedIconTheme, - _that.unselectedIconTheme, - _that.selectedItemColor, - _that.unselectedItemColor, - _that.selectedLabelStyle, - _that.unselectedLabelStyle, - _that.showSelectedLabels, - _that.showUnselectedLabels, - _that.type, - _that.enableFeedback, - _that.landscapeLayout); - 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? backgroundColor, - double? elevation, - StacIconThemeData? selectedIconTheme, - StacIconThemeData? unselectedIconTheme, - String? selectedItemColor, - String? unselectedItemColor, - StacTextStyle? selectedLabelStyle, - StacTextStyle? unselectedLabelStyle, - bool? showSelectedLabels, - bool? showUnselectedLabels, - BottomNavigationBarType? type, - bool? enableFeedback, - BottomNavigationBarLandscapeLayout? landscapeLayout) - $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomNavBarThemeData(): - return $default( - _that.backgroundColor, - _that.elevation, - _that.selectedIconTheme, - _that.unselectedIconTheme, - _that.selectedItemColor, - _that.unselectedItemColor, - _that.selectedLabelStyle, - _that.unselectedLabelStyle, - _that.showSelectedLabels, - _that.showUnselectedLabels, - _that.type, - _that.enableFeedback, - _that.landscapeLayout); - 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? backgroundColor, - double? elevation, - StacIconThemeData? selectedIconTheme, - StacIconThemeData? unselectedIconTheme, - String? selectedItemColor, - String? unselectedItemColor, - StacTextStyle? selectedLabelStyle, - StacTextStyle? unselectedLabelStyle, - bool? showSelectedLabels, - bool? showUnselectedLabels, - BottomNavigationBarType? type, - bool? enableFeedback, - BottomNavigationBarLandscapeLayout? landscapeLayout)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomNavBarThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.elevation, - _that.selectedIconTheme, - _that.unselectedIconTheme, - _that.selectedItemColor, - _that.unselectedItemColor, - _that.selectedLabelStyle, - _that.unselectedLabelStyle, - _that.showSelectedLabels, - _that.showUnselectedLabels, - _that.type, - _that.enableFeedback, - _that.landscapeLayout); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacBottomNavBarThemeData implements StacBottomNavBarThemeData { - const _StacBottomNavBarThemeData( - {this.backgroundColor, - this.elevation, - this.selectedIconTheme, - this.unselectedIconTheme, - this.selectedItemColor, - this.unselectedItemColor, - this.selectedLabelStyle, - this.unselectedLabelStyle, - this.showSelectedLabels, - this.showUnselectedLabels, - this.type, - this.enableFeedback, - this.landscapeLayout}); - factory _StacBottomNavBarThemeData.fromJson(Map json) => - _$StacBottomNavBarThemeDataFromJson(json); - - @override - final String? backgroundColor; - @override - final double? elevation; - @override - final StacIconThemeData? selectedIconTheme; - @override - final StacIconThemeData? unselectedIconTheme; - @override - final String? selectedItemColor; - @override - final String? unselectedItemColor; - @override - final StacTextStyle? selectedLabelStyle; - @override - final StacTextStyle? unselectedLabelStyle; - @override - final bool? showSelectedLabels; - @override - final bool? showUnselectedLabels; - @override - final BottomNavigationBarType? type; - @override - final bool? enableFeedback; - @override - final BottomNavigationBarLandscapeLayout? landscapeLayout; - - /// Create a copy of StacBottomNavBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacBottomNavBarThemeDataCopyWith<_StacBottomNavBarThemeData> - get copyWith => - __$StacBottomNavBarThemeDataCopyWithImpl<_StacBottomNavBarThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacBottomNavBarThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacBottomNavBarThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.selectedIconTheme, selectedIconTheme) || - other.selectedIconTheme == selectedIconTheme) && - (identical(other.unselectedIconTheme, unselectedIconTheme) || - other.unselectedIconTheme == unselectedIconTheme) && - (identical(other.selectedItemColor, selectedItemColor) || - other.selectedItemColor == selectedItemColor) && - (identical(other.unselectedItemColor, unselectedItemColor) || - other.unselectedItemColor == unselectedItemColor) && - (identical(other.selectedLabelStyle, selectedLabelStyle) || - other.selectedLabelStyle == selectedLabelStyle) && - (identical(other.unselectedLabelStyle, unselectedLabelStyle) || - other.unselectedLabelStyle == unselectedLabelStyle) && - (identical(other.showSelectedLabels, showSelectedLabels) || - other.showSelectedLabels == showSelectedLabels) && - (identical(other.showUnselectedLabels, showUnselectedLabels) || - other.showUnselectedLabels == showUnselectedLabels) && - (identical(other.type, type) || other.type == type) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.landscapeLayout, landscapeLayout) || - other.landscapeLayout == landscapeLayout)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - elevation, - selectedIconTheme, - unselectedIconTheme, - selectedItemColor, - unselectedItemColor, - selectedLabelStyle, - unselectedLabelStyle, - showSelectedLabels, - showUnselectedLabels, - type, - enableFeedback, - landscapeLayout); - - @override - String toString() { - return 'StacBottomNavBarThemeData(backgroundColor: $backgroundColor, elevation: $elevation, selectedIconTheme: $selectedIconTheme, unselectedIconTheme: $unselectedIconTheme, selectedItemColor: $selectedItemColor, unselectedItemColor: $unselectedItemColor, selectedLabelStyle: $selectedLabelStyle, unselectedLabelStyle: $unselectedLabelStyle, showSelectedLabels: $showSelectedLabels, showUnselectedLabels: $showUnselectedLabels, type: $type, enableFeedback: $enableFeedback, landscapeLayout: $landscapeLayout)'; - } -} - -/// @nodoc -abstract mixin class _$StacBottomNavBarThemeDataCopyWith<$Res> - implements $StacBottomNavBarThemeDataCopyWith<$Res> { - factory _$StacBottomNavBarThemeDataCopyWith(_StacBottomNavBarThemeData value, - $Res Function(_StacBottomNavBarThemeData) _then) = - __$StacBottomNavBarThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? backgroundColor, - double? elevation, - StacIconThemeData? selectedIconTheme, - StacIconThemeData? unselectedIconTheme, - String? selectedItemColor, - String? unselectedItemColor, - StacTextStyle? selectedLabelStyle, - StacTextStyle? unselectedLabelStyle, - bool? showSelectedLabels, - bool? showUnselectedLabels, - BottomNavigationBarType? type, - bool? enableFeedback, - BottomNavigationBarLandscapeLayout? landscapeLayout}); - - @override - $StacIconThemeDataCopyWith<$Res>? get selectedIconTheme; - @override - $StacIconThemeDataCopyWith<$Res>? get unselectedIconTheme; -} - -/// @nodoc -class __$StacBottomNavBarThemeDataCopyWithImpl<$Res> - implements _$StacBottomNavBarThemeDataCopyWith<$Res> { - __$StacBottomNavBarThemeDataCopyWithImpl(this._self, this._then); - - final _StacBottomNavBarThemeData _self; - final $Res Function(_StacBottomNavBarThemeData) _then; - - /// Create a copy of StacBottomNavBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? selectedIconTheme = freezed, - Object? unselectedIconTheme = freezed, - Object? selectedItemColor = freezed, - Object? unselectedItemColor = freezed, - Object? selectedLabelStyle = freezed, - Object? unselectedLabelStyle = freezed, - Object? showSelectedLabels = freezed, - Object? showUnselectedLabels = freezed, - Object? type = freezed, - Object? enableFeedback = freezed, - Object? landscapeLayout = freezed, - }) { - return _then(_StacBottomNavBarThemeData( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - selectedIconTheme: freezed == selectedIconTheme - ? _self.selectedIconTheme - : selectedIconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - unselectedIconTheme: freezed == unselectedIconTheme - ? _self.unselectedIconTheme - : unselectedIconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - selectedItemColor: freezed == selectedItemColor - ? _self.selectedItemColor - : selectedItemColor // ignore: cast_nullable_to_non_nullable - as String?, - unselectedItemColor: freezed == unselectedItemColor - ? _self.unselectedItemColor - : unselectedItemColor // ignore: cast_nullable_to_non_nullable - as String?, - selectedLabelStyle: freezed == selectedLabelStyle - ? _self.selectedLabelStyle - : selectedLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - unselectedLabelStyle: freezed == unselectedLabelStyle - ? _self.unselectedLabelStyle - : unselectedLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - showSelectedLabels: freezed == showSelectedLabels - ? _self.showSelectedLabels - : showSelectedLabels // ignore: cast_nullable_to_non_nullable - as bool?, - showUnselectedLabels: freezed == showUnselectedLabels - ? _self.showUnselectedLabels - : showUnselectedLabels // ignore: cast_nullable_to_non_nullable - as bool?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as BottomNavigationBarType?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - landscapeLayout: freezed == landscapeLayout - ? _self.landscapeLayout - : landscapeLayout // ignore: cast_nullable_to_non_nullable - as BottomNavigationBarLandscapeLayout?, - )); - } - - /// Create a copy of StacBottomNavBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get selectedIconTheme { - if (_self.selectedIconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.selectedIconTheme!, (value) { - return _then(_self.copyWith(selectedIconTheme: value)); - }); - } - - /// Create a copy of StacBottomNavBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get unselectedIconTheme { - if (_self.unselectedIconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.unselectedIconTheme!, - (value) { - return _then(_self.copyWith(unselectedIconTheme: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.g.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.g.dart deleted file mode 100644 index 6b0ef88db..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.g.dart +++ /dev/null @@ -1,66 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_bottom_nav_bar_theme.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacBottomNavBarThemeData _$StacBottomNavBarThemeDataFromJson( - Map json) => - _StacBottomNavBarThemeData( - backgroundColor: json['backgroundColor'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - selectedIconTheme: json['selectedIconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['selectedIconTheme'] as Map), - unselectedIconTheme: json['unselectedIconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['unselectedIconTheme'] as Map), - selectedItemColor: json['selectedItemColor'] as String?, - unselectedItemColor: json['unselectedItemColor'] as String?, - selectedLabelStyle: json['selectedLabelStyle'] == null - ? null - : StacTextStyle.fromJson(json['selectedLabelStyle']), - unselectedLabelStyle: json['unselectedLabelStyle'] == null - ? null - : StacTextStyle.fromJson(json['unselectedLabelStyle']), - showSelectedLabels: json['showSelectedLabels'] as bool?, - showUnselectedLabels: json['showUnselectedLabels'] as bool?, - type: $enumDecodeNullable(_$BottomNavigationBarTypeEnumMap, json['type']), - enableFeedback: json['enableFeedback'] as bool?, - landscapeLayout: $enumDecodeNullable( - _$BottomNavigationBarLandscapeLayoutEnumMap, json['landscapeLayout']), - ); - -Map _$StacBottomNavBarThemeDataToJson( - _StacBottomNavBarThemeData instance) => - { - 'backgroundColor': instance.backgroundColor, - 'elevation': instance.elevation, - 'selectedIconTheme': instance.selectedIconTheme, - 'unselectedIconTheme': instance.unselectedIconTheme, - 'selectedItemColor': instance.selectedItemColor, - 'unselectedItemColor': instance.unselectedItemColor, - 'selectedLabelStyle': instance.selectedLabelStyle, - 'unselectedLabelStyle': instance.unselectedLabelStyle, - 'showSelectedLabels': instance.showSelectedLabels, - 'showUnselectedLabels': instance.showUnselectedLabels, - 'type': _$BottomNavigationBarTypeEnumMap[instance.type], - 'enableFeedback': instance.enableFeedback, - 'landscapeLayout': - _$BottomNavigationBarLandscapeLayoutEnumMap[instance.landscapeLayout], - }; - -const _$BottomNavigationBarTypeEnumMap = { - BottomNavigationBarType.fixed: 'fixed', - BottomNavigationBarType.shifting: 'shifting', -}; - -const _$BottomNavigationBarLandscapeLayoutEnumMap = { - BottomNavigationBarLandscapeLayout.spread: 'spread', - BottomNavigationBarLandscapeLayout.centered: 'centered', - BottomNavigationBarLandscapeLayout.linear: 'linear', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme_parser.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme_parser.dart new file mode 100644 index 000000000..b86bb31a7 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme_parser.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/navigation/stac_bottom_navigation_bar_landscape_layout_parser.dart'; +import 'package:stac/src/parsers/foundation/navigation/stac_bottom_navigation_bar_type_parser.dart'; +import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; +import 'package:stac/src/parsers/theme/stac_icon_theme_data_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacBottomNavBarThemeData]. +/// +/// Converts [StacBottomNavBarThemeData] to Flutter's [BottomNavigationBarThemeData]. +extension StacBottomNavBarThemeDataParser on StacBottomNavBarThemeData { + BottomNavigationBarThemeData parse(BuildContext context) { + return BottomNavigationBarThemeData( + backgroundColor: backgroundColor?.toColor(context), + elevation: elevation, + selectedIconTheme: selectedIconTheme?.parse(context), + unselectedIconTheme: unselectedIconTheme?.parse(context), + selectedItemColor: selectedItemColor?.toColor(context), + unselectedItemColor: unselectedItemColor?.toColor(context), + selectedLabelStyle: selectedLabelStyle?.parse(context), + unselectedLabelStyle: unselectedLabelStyle?.parse(context), + showSelectedLabels: showSelectedLabels, + showUnselectedLabels: showUnselectedLabels, + type: type?.parse, + enableFeedback: enableFeedback, + landscapeLayout: landscapeLayout?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart deleted file mode 100644 index 960f68094..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart +++ /dev/null @@ -1,52 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_border_parser.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_box_constraints_parser.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_size_parser.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_bottom_sheet_theme.freezed.dart'; -part 'stac_bottom_sheet_theme.g.dart'; - -@freezed -abstract class StacBottomSheetThemeData with _$StacBottomSheetThemeData { - const factory StacBottomSheetThemeData({ - String? backgroundColor, - String? surfaceTintColor, - double? elevation, - String? modalBackgroundColor, - String? modalBarrierColor, - String? shadowColor, - double? modalElevation, - StacBorder? shape, - bool? showDragHandle, - String? dragHandleColor, - StacSize? dragHandleSize, - Clip? clipBehavior, - StacBoxConstraints? constraints, - }) = _StacBottomSheetThemeData; - - factory StacBottomSheetThemeData.fromJson(Map json) => - _$StacBottomSheetThemeDataFromJson(json); -} - -extension StacBottomSheetThemeDataParser on StacBottomSheetThemeData { - BottomSheetThemeData parse(BuildContext context) { - return BottomSheetThemeData( - backgroundColor: backgroundColor.toColor(context), - surfaceTintColor: surfaceTintColor.toColor(context), - elevation: elevation, - modalBackgroundColor: modalBackgroundColor.toColor(context), - modalBarrierColor: modalBarrierColor.toColor(context), - shadowColor: shadowColor.toColor(context), - modalElevation: modalElevation, - shape: shape?.parse(context), - showDragHandle: showDragHandle, - dragHandleColor: dragHandleColor.toColor(context), - dragHandleSize: dragHandleSize?.parse, - clipBehavior: clipBehavior, - constraints: constraints?.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart deleted file mode 100644 index 871fd3224..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart +++ /dev/null @@ -1,669 +0,0 @@ -// 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 - -part of 'stac_bottom_sheet_theme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacBottomSheetThemeData { - String? get backgroundColor; - String? get surfaceTintColor; - double? get elevation; - String? get modalBackgroundColor; - String? get modalBarrierColor; - String? get shadowColor; - double? get modalElevation; - StacBorder? get shape; - bool? get showDragHandle; - String? get dragHandleColor; - StacSize? get dragHandleSize; - Clip? get clipBehavior; - StacBoxConstraints? get constraints; - - /// Create a copy of StacBottomSheetThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacBottomSheetThemeDataCopyWith get copyWith => - _$StacBottomSheetThemeDataCopyWithImpl( - this as StacBottomSheetThemeData, _$identity); - - /// Serializes this StacBottomSheetThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacBottomSheetThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.modalBackgroundColor, modalBackgroundColor) || - other.modalBackgroundColor == modalBackgroundColor) && - (identical(other.modalBarrierColor, modalBarrierColor) || - other.modalBarrierColor == modalBarrierColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.modalElevation, modalElevation) || - other.modalElevation == modalElevation) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.showDragHandle, showDragHandle) || - other.showDragHandle == showDragHandle) && - (identical(other.dragHandleColor, dragHandleColor) || - other.dragHandleColor == dragHandleColor) && - (identical(other.dragHandleSize, dragHandleSize) || - other.dragHandleSize == dragHandleSize) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - (identical(other.constraints, constraints) || - other.constraints == constraints)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - surfaceTintColor, - elevation, - modalBackgroundColor, - modalBarrierColor, - shadowColor, - modalElevation, - shape, - showDragHandle, - dragHandleColor, - dragHandleSize, - clipBehavior, - constraints); - - @override - String toString() { - return 'StacBottomSheetThemeData(backgroundColor: $backgroundColor, surfaceTintColor: $surfaceTintColor, elevation: $elevation, modalBackgroundColor: $modalBackgroundColor, modalBarrierColor: $modalBarrierColor, shadowColor: $shadowColor, modalElevation: $modalElevation, shape: $shape, showDragHandle: $showDragHandle, dragHandleColor: $dragHandleColor, dragHandleSize: $dragHandleSize, clipBehavior: $clipBehavior, constraints: $constraints)'; - } -} - -/// @nodoc -abstract mixin class $StacBottomSheetThemeDataCopyWith<$Res> { - factory $StacBottomSheetThemeDataCopyWith(StacBottomSheetThemeData value, - $Res Function(StacBottomSheetThemeData) _then) = - _$StacBottomSheetThemeDataCopyWithImpl; - @useResult - $Res call( - {String? backgroundColor, - String? surfaceTintColor, - double? elevation, - String? modalBackgroundColor, - String? modalBarrierColor, - String? shadowColor, - double? modalElevation, - StacBorder? shape, - bool? showDragHandle, - String? dragHandleColor, - StacSize? dragHandleSize, - Clip? clipBehavior, - StacBoxConstraints? constraints}); -} - -/// @nodoc -class _$StacBottomSheetThemeDataCopyWithImpl<$Res> - implements $StacBottomSheetThemeDataCopyWith<$Res> { - _$StacBottomSheetThemeDataCopyWithImpl(this._self, this._then); - - final StacBottomSheetThemeData _self; - final $Res Function(StacBottomSheetThemeData) _then; - - /// Create a copy of StacBottomSheetThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? backgroundColor = freezed, - Object? surfaceTintColor = freezed, - Object? elevation = freezed, - Object? modalBackgroundColor = freezed, - Object? modalBarrierColor = freezed, - Object? shadowColor = freezed, - Object? modalElevation = freezed, - Object? shape = freezed, - Object? showDragHandle = freezed, - Object? dragHandleColor = freezed, - Object? dragHandleSize = freezed, - Object? clipBehavior = freezed, - Object? constraints = freezed, - }) { - return _then(_self.copyWith( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - modalBackgroundColor: freezed == modalBackgroundColor - ? _self.modalBackgroundColor - : modalBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - modalBarrierColor: freezed == modalBarrierColor - ? _self.modalBarrierColor - : modalBarrierColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - modalElevation: freezed == modalElevation - ? _self.modalElevation - : modalElevation // ignore: cast_nullable_to_non_nullable - as double?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - showDragHandle: freezed == showDragHandle - ? _self.showDragHandle - : showDragHandle // ignore: cast_nullable_to_non_nullable - as bool?, - dragHandleColor: freezed == dragHandleColor - ? _self.dragHandleColor - : dragHandleColor // ignore: cast_nullable_to_non_nullable - as String?, - dragHandleSize: freezed == dragHandleSize - ? _self.dragHandleSize - : dragHandleSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - clipBehavior: freezed == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip?, - constraints: freezed == constraints - ? _self.constraints - : constraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacBottomSheetThemeData]. -extension StacBottomSheetThemeDataPatterns on StacBottomSheetThemeData { - /// 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(_StacBottomSheetThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacBottomSheetThemeData() 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(_StacBottomSheetThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomSheetThemeData(): - 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(_StacBottomSheetThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomSheetThemeData() 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? backgroundColor, - String? surfaceTintColor, - double? elevation, - String? modalBackgroundColor, - String? modalBarrierColor, - String? shadowColor, - double? modalElevation, - StacBorder? shape, - bool? showDragHandle, - String? dragHandleColor, - StacSize? dragHandleSize, - Clip? clipBehavior, - StacBoxConstraints? constraints)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacBottomSheetThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.surfaceTintColor, - _that.elevation, - _that.modalBackgroundColor, - _that.modalBarrierColor, - _that.shadowColor, - _that.modalElevation, - _that.shape, - _that.showDragHandle, - _that.dragHandleColor, - _that.dragHandleSize, - _that.clipBehavior, - _that.constraints); - 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? backgroundColor, - String? surfaceTintColor, - double? elevation, - String? modalBackgroundColor, - String? modalBarrierColor, - String? shadowColor, - double? modalElevation, - StacBorder? shape, - bool? showDragHandle, - String? dragHandleColor, - StacSize? dragHandleSize, - Clip? clipBehavior, - StacBoxConstraints? constraints) - $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomSheetThemeData(): - return $default( - _that.backgroundColor, - _that.surfaceTintColor, - _that.elevation, - _that.modalBackgroundColor, - _that.modalBarrierColor, - _that.shadowColor, - _that.modalElevation, - _that.shape, - _that.showDragHandle, - _that.dragHandleColor, - _that.dragHandleSize, - _that.clipBehavior, - _that.constraints); - 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? backgroundColor, - String? surfaceTintColor, - double? elevation, - String? modalBackgroundColor, - String? modalBarrierColor, - String? shadowColor, - double? modalElevation, - StacBorder? shape, - bool? showDragHandle, - String? dragHandleColor, - StacSize? dragHandleSize, - Clip? clipBehavior, - StacBoxConstraints? constraints)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacBottomSheetThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.surfaceTintColor, - _that.elevation, - _that.modalBackgroundColor, - _that.modalBarrierColor, - _that.shadowColor, - _that.modalElevation, - _that.shape, - _that.showDragHandle, - _that.dragHandleColor, - _that.dragHandleSize, - _that.clipBehavior, - _that.constraints); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacBottomSheetThemeData implements StacBottomSheetThemeData { - const _StacBottomSheetThemeData( - {this.backgroundColor, - this.surfaceTintColor, - this.elevation, - this.modalBackgroundColor, - this.modalBarrierColor, - this.shadowColor, - this.modalElevation, - this.shape, - this.showDragHandle, - this.dragHandleColor, - this.dragHandleSize, - this.clipBehavior, - this.constraints}); - factory _StacBottomSheetThemeData.fromJson(Map json) => - _$StacBottomSheetThemeDataFromJson(json); - - @override - final String? backgroundColor; - @override - final String? surfaceTintColor; - @override - final double? elevation; - @override - final String? modalBackgroundColor; - @override - final String? modalBarrierColor; - @override - final String? shadowColor; - @override - final double? modalElevation; - @override - final StacBorder? shape; - @override - final bool? showDragHandle; - @override - final String? dragHandleColor; - @override - final StacSize? dragHandleSize; - @override - final Clip? clipBehavior; - @override - final StacBoxConstraints? constraints; - - /// Create a copy of StacBottomSheetThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacBottomSheetThemeDataCopyWith<_StacBottomSheetThemeData> get copyWith => - __$StacBottomSheetThemeDataCopyWithImpl<_StacBottomSheetThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacBottomSheetThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacBottomSheetThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.modalBackgroundColor, modalBackgroundColor) || - other.modalBackgroundColor == modalBackgroundColor) && - (identical(other.modalBarrierColor, modalBarrierColor) || - other.modalBarrierColor == modalBarrierColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.modalElevation, modalElevation) || - other.modalElevation == modalElevation) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.showDragHandle, showDragHandle) || - other.showDragHandle == showDragHandle) && - (identical(other.dragHandleColor, dragHandleColor) || - other.dragHandleColor == dragHandleColor) && - (identical(other.dragHandleSize, dragHandleSize) || - other.dragHandleSize == dragHandleSize) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - (identical(other.constraints, constraints) || - other.constraints == constraints)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - surfaceTintColor, - elevation, - modalBackgroundColor, - modalBarrierColor, - shadowColor, - modalElevation, - shape, - showDragHandle, - dragHandleColor, - dragHandleSize, - clipBehavior, - constraints); - - @override - String toString() { - return 'StacBottomSheetThemeData(backgroundColor: $backgroundColor, surfaceTintColor: $surfaceTintColor, elevation: $elevation, modalBackgroundColor: $modalBackgroundColor, modalBarrierColor: $modalBarrierColor, shadowColor: $shadowColor, modalElevation: $modalElevation, shape: $shape, showDragHandle: $showDragHandle, dragHandleColor: $dragHandleColor, dragHandleSize: $dragHandleSize, clipBehavior: $clipBehavior, constraints: $constraints)'; - } -} - -/// @nodoc -abstract mixin class _$StacBottomSheetThemeDataCopyWith<$Res> - implements $StacBottomSheetThemeDataCopyWith<$Res> { - factory _$StacBottomSheetThemeDataCopyWith(_StacBottomSheetThemeData value, - $Res Function(_StacBottomSheetThemeData) _then) = - __$StacBottomSheetThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? backgroundColor, - String? surfaceTintColor, - double? elevation, - String? modalBackgroundColor, - String? modalBarrierColor, - String? shadowColor, - double? modalElevation, - StacBorder? shape, - bool? showDragHandle, - String? dragHandleColor, - StacSize? dragHandleSize, - Clip? clipBehavior, - StacBoxConstraints? constraints}); -} - -/// @nodoc -class __$StacBottomSheetThemeDataCopyWithImpl<$Res> - implements _$StacBottomSheetThemeDataCopyWith<$Res> { - __$StacBottomSheetThemeDataCopyWithImpl(this._self, this._then); - - final _StacBottomSheetThemeData _self; - final $Res Function(_StacBottomSheetThemeData) _then; - - /// Create a copy of StacBottomSheetThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? backgroundColor = freezed, - Object? surfaceTintColor = freezed, - Object? elevation = freezed, - Object? modalBackgroundColor = freezed, - Object? modalBarrierColor = freezed, - Object? shadowColor = freezed, - Object? modalElevation = freezed, - Object? shape = freezed, - Object? showDragHandle = freezed, - Object? dragHandleColor = freezed, - Object? dragHandleSize = freezed, - Object? clipBehavior = freezed, - Object? constraints = freezed, - }) { - return _then(_StacBottomSheetThemeData( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - modalBackgroundColor: freezed == modalBackgroundColor - ? _self.modalBackgroundColor - : modalBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - modalBarrierColor: freezed == modalBarrierColor - ? _self.modalBarrierColor - : modalBarrierColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - modalElevation: freezed == modalElevation - ? _self.modalElevation - : modalElevation // ignore: cast_nullable_to_non_nullable - as double?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - showDragHandle: freezed == showDragHandle - ? _self.showDragHandle - : showDragHandle // ignore: cast_nullable_to_non_nullable - as bool?, - dragHandleColor: freezed == dragHandleColor - ? _self.dragHandleColor - : dragHandleColor // ignore: cast_nullable_to_non_nullable - as String?, - dragHandleSize: freezed == dragHandleSize - ? _self.dragHandleSize - : dragHandleSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - clipBehavior: freezed == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip?, - constraints: freezed == constraints - ? _self.constraints - : constraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.g.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.g.dart deleted file mode 100644 index 10b4d0ce1..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.g.dart +++ /dev/null @@ -1,57 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_bottom_sheet_theme.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacBottomSheetThemeData _$StacBottomSheetThemeDataFromJson( - Map json) => - _StacBottomSheetThemeData( - backgroundColor: json['backgroundColor'] as String?, - surfaceTintColor: json['surfaceTintColor'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - modalBackgroundColor: json['modalBackgroundColor'] as String?, - modalBarrierColor: json['modalBarrierColor'] as String?, - shadowColor: json['shadowColor'] as String?, - modalElevation: (json['modalElevation'] as num?)?.toDouble(), - shape: json['shape'] == null - ? null - : StacBorder.fromJson(json['shape'] as Map), - showDragHandle: json['showDragHandle'] as bool?, - dragHandleColor: json['dragHandleColor'] as String?, - dragHandleSize: json['dragHandleSize'] == null - ? null - : StacSize.fromJson(json['dragHandleSize'] as Map), - clipBehavior: $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']), - constraints: json['constraints'] == null - ? null - : StacBoxConstraints.fromJson( - json['constraints'] as Map), - ); - -Map _$StacBottomSheetThemeDataToJson( - _StacBottomSheetThemeData instance) => - { - 'backgroundColor': instance.backgroundColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'elevation': instance.elevation, - 'modalBackgroundColor': instance.modalBackgroundColor, - 'modalBarrierColor': instance.modalBarrierColor, - 'shadowColor': instance.shadowColor, - 'modalElevation': instance.modalElevation, - 'shape': instance.shape, - 'showDragHandle': instance.showDragHandle, - 'dragHandleColor': instance.dragHandleColor, - 'dragHandleSize': instance.dragHandleSize, - 'clipBehavior': _$ClipEnumMap[instance.clipBehavior], - 'constraints': instance.constraints, - }; - -const _$ClipEnumMap = { - Clip.none: 'none', - Clip.hardEdge: 'hardEdge', - Clip.antiAlias: 'antiAlias', - Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme_parser.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme_parser.dart new file mode 100644 index 000000000..f941da553 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme_parser.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_border_parser.dart'; +import 'package:stac/src/parsers/foundation/geometry/stac_box_constraints_parser.dart'; +import 'package:stac/src/parsers/foundation/geometry/stac_size_parser.dart'; +import 'package:stac/src/parsers/foundation/layout/stac_clip_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacBottomSheetThemeData]. +/// +/// Converts [StacBottomSheetThemeData] to Flutter's [BottomSheetThemeData]. +extension StacBottomSheetThemeDataParser on StacBottomSheetThemeData { + BottomSheetThemeData parse(BuildContext context) { + return BottomSheetThemeData( + backgroundColor: backgroundColor?.toColor(context), + surfaceTintColor: surfaceTintColor?.toColor(context), + elevation: elevation, + modalBackgroundColor: modalBackgroundColor?.toColor(context), + modalBarrierColor: modalBarrierColor?.toColor(context), + shadowColor: shadowColor?.toColor(context), + modalElevation: modalElevation, + shape: shape?.parse(context), + showDragHandle: showDragHandle, + dragHandleColor: dragHandleColor?.toColor(context), + dragHandleSize: dragHandleSize?.parse, + clipBehavior: clipBehavior?.parse, + constraints: constraints?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart b/packages/stac/lib/src/parsers/theme/stac_button_style_parser.dart similarity index 100% rename from packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart rename to packages/stac/lib/src/parsers/theme/stac_button_style_parser.dart diff --git a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart deleted file mode 100644 index 007c948fe..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_shape_border_parser.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; -import 'package:stac/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_button_theme_data.freezed.dart'; -part 'stac_button_theme_data.g.dart'; - -@freezed -abstract class StacButtonThemeData with _$StacButtonThemeData { - const factory StacButtonThemeData({ - @Default(ButtonTextTheme.normal) ButtonTextTheme textTheme, - @Default(88.0) double minWidth, - @Default(36.0) double height, - StacEdgeInsets? padding, - StacShapeBorder? shape, - @Default(ButtonBarLayoutBehavior.padded) - ButtonBarLayoutBehavior layoutBehavior, - @Default(false) bool alignedDropdown, - String? buttonColor, - String? disabledColor, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - StacColorScheme? colorScheme, - MaterialTapTargetSize? materialTapTargetSize, - }) = _StacButtonThemeData; - - factory StacButtonThemeData.fromJson(Map json) => - _$StacButtonThemeDataFromJson(json); -} - -extension StacButtonThemeDataParser on StacButtonThemeData { - ButtonThemeData? parse(BuildContext context) { - return ButtonThemeData( - textTheme: textTheme, - minWidth: minWidth, - height: height, - padding: padding?.parse, - shape: shape?.parse(context), - layoutBehavior: layoutBehavior, - alignedDropdown: alignedDropdown, - buttonColor: buttonColor?.toColor(context), - disabledColor: disabledColor?.toColor(context), - focusColor: focusColor?.toColor(context), - hoverColor: hoverColor?.toColor(context), - highlightColor: highlightColor?.toColor(context), - splashColor: splashColor?.toColor(context), - colorScheme: colorScheme?.parse(context), - materialTapTargetSize: materialTapTargetSize, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.freezed.dart deleted file mode 100644 index eb6ff7d43..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.freezed.dart +++ /dev/null @@ -1,759 +0,0 @@ -// 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 - -part of 'stac_button_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacButtonThemeData { - ButtonTextTheme get textTheme; - double get minWidth; - double get height; - StacEdgeInsets? get padding; - StacShapeBorder? get shape; - ButtonBarLayoutBehavior get layoutBehavior; - bool get alignedDropdown; - String? get buttonColor; - String? get disabledColor; - String? get focusColor; - String? get hoverColor; - String? get highlightColor; - String? get splashColor; - StacColorScheme? get colorScheme; - MaterialTapTargetSize? get materialTapTargetSize; - - /// Create a copy of StacButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacButtonThemeDataCopyWith get copyWith => - _$StacButtonThemeDataCopyWithImpl( - this as StacButtonThemeData, _$identity); - - /// Serializes this StacButtonThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacButtonThemeData && - (identical(other.textTheme, textTheme) || - other.textTheme == textTheme) && - (identical(other.minWidth, minWidth) || - other.minWidth == minWidth) && - (identical(other.height, height) || other.height == height) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.layoutBehavior, layoutBehavior) || - other.layoutBehavior == layoutBehavior) && - (identical(other.alignedDropdown, alignedDropdown) || - other.alignedDropdown == alignedDropdown) && - (identical(other.buttonColor, buttonColor) || - other.buttonColor == buttonColor) && - (identical(other.disabledColor, disabledColor) || - other.disabledColor == disabledColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.highlightColor, highlightColor) || - other.highlightColor == highlightColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.colorScheme, colorScheme) || - other.colorScheme == colorScheme) && - (identical(other.materialTapTargetSize, materialTapTargetSize) || - other.materialTapTargetSize == materialTapTargetSize)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - textTheme, - minWidth, - height, - padding, - shape, - layoutBehavior, - alignedDropdown, - buttonColor, - disabledColor, - focusColor, - hoverColor, - highlightColor, - splashColor, - colorScheme, - materialTapTargetSize); - - @override - String toString() { - return 'StacButtonThemeData(textTheme: $textTheme, minWidth: $minWidth, height: $height, padding: $padding, shape: $shape, layoutBehavior: $layoutBehavior, alignedDropdown: $alignedDropdown, buttonColor: $buttonColor, disabledColor: $disabledColor, focusColor: $focusColor, hoverColor: $hoverColor, highlightColor: $highlightColor, splashColor: $splashColor, colorScheme: $colorScheme, materialTapTargetSize: $materialTapTargetSize)'; - } -} - -/// @nodoc -abstract mixin class $StacButtonThemeDataCopyWith<$Res> { - factory $StacButtonThemeDataCopyWith( - StacButtonThemeData value, $Res Function(StacButtonThemeData) _then) = - _$StacButtonThemeDataCopyWithImpl; - @useResult - $Res call( - {ButtonTextTheme textTheme, - double minWidth, - double height, - StacEdgeInsets? padding, - StacShapeBorder? shape, - ButtonBarLayoutBehavior layoutBehavior, - bool alignedDropdown, - String? buttonColor, - String? disabledColor, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - StacColorScheme? colorScheme, - MaterialTapTargetSize? materialTapTargetSize}); - - $StacColorSchemeCopyWith<$Res>? get colorScheme; -} - -/// @nodoc -class _$StacButtonThemeDataCopyWithImpl<$Res> - implements $StacButtonThemeDataCopyWith<$Res> { - _$StacButtonThemeDataCopyWithImpl(this._self, this._then); - - final StacButtonThemeData _self; - final $Res Function(StacButtonThemeData) _then; - - /// Create a copy of StacButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? textTheme = null, - Object? minWidth = null, - Object? height = null, - Object? padding = freezed, - Object? shape = freezed, - Object? layoutBehavior = null, - Object? alignedDropdown = null, - Object? buttonColor = freezed, - Object? disabledColor = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? highlightColor = freezed, - Object? splashColor = freezed, - Object? colorScheme = freezed, - Object? materialTapTargetSize = freezed, - }) { - return _then(_self.copyWith( - textTheme: null == textTheme - ? _self.textTheme - : textTheme // ignore: cast_nullable_to_non_nullable - as ButtonTextTheme, - minWidth: null == minWidth - ? _self.minWidth - : minWidth // ignore: cast_nullable_to_non_nullable - as double, - height: null == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as double, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - layoutBehavior: null == layoutBehavior - ? _self.layoutBehavior - : layoutBehavior // ignore: cast_nullable_to_non_nullable - as ButtonBarLayoutBehavior, - alignedDropdown: null == alignedDropdown - ? _self.alignedDropdown - : alignedDropdown // ignore: cast_nullable_to_non_nullable - as bool, - buttonColor: freezed == buttonColor - ? _self.buttonColor - : buttonColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledColor: freezed == disabledColor - ? _self.disabledColor - : disabledColor // ignore: cast_nullable_to_non_nullable - as String?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - highlightColor: freezed == highlightColor - ? _self.highlightColor - : highlightColor // ignore: cast_nullable_to_non_nullable - as String?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - colorScheme: freezed == colorScheme - ? _self.colorScheme - : colorScheme // ignore: cast_nullable_to_non_nullable - as StacColorScheme?, - materialTapTargetSize: freezed == materialTapTargetSize - ? _self.materialTapTargetSize - : materialTapTargetSize // ignore: cast_nullable_to_non_nullable - as MaterialTapTargetSize?, - )); - } - - /// Create a copy of StacButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacColorSchemeCopyWith<$Res>? get colorScheme { - if (_self.colorScheme == null) { - return null; - } - - return $StacColorSchemeCopyWith<$Res>(_self.colorScheme!, (value) { - return _then(_self.copyWith(colorScheme: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacButtonThemeData]. -extension StacButtonThemeDataPatterns on StacButtonThemeData { - /// 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(_StacButtonThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacButtonThemeData() 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(_StacButtonThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacButtonThemeData(): - 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(_StacButtonThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacButtonThemeData() 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( - ButtonTextTheme textTheme, - double minWidth, - double height, - StacEdgeInsets? padding, - StacShapeBorder? shape, - ButtonBarLayoutBehavior layoutBehavior, - bool alignedDropdown, - String? buttonColor, - String? disabledColor, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - StacColorScheme? colorScheme, - MaterialTapTargetSize? materialTapTargetSize)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacButtonThemeData() when $default != null: - return $default( - _that.textTheme, - _that.minWidth, - _that.height, - _that.padding, - _that.shape, - _that.layoutBehavior, - _that.alignedDropdown, - _that.buttonColor, - _that.disabledColor, - _that.focusColor, - _that.hoverColor, - _that.highlightColor, - _that.splashColor, - _that.colorScheme, - _that.materialTapTargetSize); - 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( - ButtonTextTheme textTheme, - double minWidth, - double height, - StacEdgeInsets? padding, - StacShapeBorder? shape, - ButtonBarLayoutBehavior layoutBehavior, - bool alignedDropdown, - String? buttonColor, - String? disabledColor, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - StacColorScheme? colorScheme, - MaterialTapTargetSize? materialTapTargetSize) - $default, - ) { - final _that = this; - switch (_that) { - case _StacButtonThemeData(): - return $default( - _that.textTheme, - _that.minWidth, - _that.height, - _that.padding, - _that.shape, - _that.layoutBehavior, - _that.alignedDropdown, - _that.buttonColor, - _that.disabledColor, - _that.focusColor, - _that.hoverColor, - _that.highlightColor, - _that.splashColor, - _that.colorScheme, - _that.materialTapTargetSize); - 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( - ButtonTextTheme textTheme, - double minWidth, - double height, - StacEdgeInsets? padding, - StacShapeBorder? shape, - ButtonBarLayoutBehavior layoutBehavior, - bool alignedDropdown, - String? buttonColor, - String? disabledColor, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - StacColorScheme? colorScheme, - MaterialTapTargetSize? materialTapTargetSize)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacButtonThemeData() when $default != null: - return $default( - _that.textTheme, - _that.minWidth, - _that.height, - _that.padding, - _that.shape, - _that.layoutBehavior, - _that.alignedDropdown, - _that.buttonColor, - _that.disabledColor, - _that.focusColor, - _that.hoverColor, - _that.highlightColor, - _that.splashColor, - _that.colorScheme, - _that.materialTapTargetSize); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacButtonThemeData implements StacButtonThemeData { - const _StacButtonThemeData( - {this.textTheme = ButtonTextTheme.normal, - this.minWidth = 88.0, - this.height = 36.0, - this.padding, - this.shape, - this.layoutBehavior = ButtonBarLayoutBehavior.padded, - this.alignedDropdown = false, - this.buttonColor, - this.disabledColor, - this.focusColor, - this.hoverColor, - this.highlightColor, - this.splashColor, - this.colorScheme, - this.materialTapTargetSize}); - factory _StacButtonThemeData.fromJson(Map json) => - _$StacButtonThemeDataFromJson(json); - - @override - @JsonKey() - final ButtonTextTheme textTheme; - @override - @JsonKey() - final double minWidth; - @override - @JsonKey() - final double height; - @override - final StacEdgeInsets? padding; - @override - final StacShapeBorder? shape; - @override - @JsonKey() - final ButtonBarLayoutBehavior layoutBehavior; - @override - @JsonKey() - final bool alignedDropdown; - @override - final String? buttonColor; - @override - final String? disabledColor; - @override - final String? focusColor; - @override - final String? hoverColor; - @override - final String? highlightColor; - @override - final String? splashColor; - @override - final StacColorScheme? colorScheme; - @override - final MaterialTapTargetSize? materialTapTargetSize; - - /// Create a copy of StacButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacButtonThemeDataCopyWith<_StacButtonThemeData> get copyWith => - __$StacButtonThemeDataCopyWithImpl<_StacButtonThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacButtonThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacButtonThemeData && - (identical(other.textTheme, textTheme) || - other.textTheme == textTheme) && - (identical(other.minWidth, minWidth) || - other.minWidth == minWidth) && - (identical(other.height, height) || other.height == height) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.layoutBehavior, layoutBehavior) || - other.layoutBehavior == layoutBehavior) && - (identical(other.alignedDropdown, alignedDropdown) || - other.alignedDropdown == alignedDropdown) && - (identical(other.buttonColor, buttonColor) || - other.buttonColor == buttonColor) && - (identical(other.disabledColor, disabledColor) || - other.disabledColor == disabledColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.highlightColor, highlightColor) || - other.highlightColor == highlightColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.colorScheme, colorScheme) || - other.colorScheme == colorScheme) && - (identical(other.materialTapTargetSize, materialTapTargetSize) || - other.materialTapTargetSize == materialTapTargetSize)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - textTheme, - minWidth, - height, - padding, - shape, - layoutBehavior, - alignedDropdown, - buttonColor, - disabledColor, - focusColor, - hoverColor, - highlightColor, - splashColor, - colorScheme, - materialTapTargetSize); - - @override - String toString() { - return 'StacButtonThemeData(textTheme: $textTheme, minWidth: $minWidth, height: $height, padding: $padding, shape: $shape, layoutBehavior: $layoutBehavior, alignedDropdown: $alignedDropdown, buttonColor: $buttonColor, disabledColor: $disabledColor, focusColor: $focusColor, hoverColor: $hoverColor, highlightColor: $highlightColor, splashColor: $splashColor, colorScheme: $colorScheme, materialTapTargetSize: $materialTapTargetSize)'; - } -} - -/// @nodoc -abstract mixin class _$StacButtonThemeDataCopyWith<$Res> - implements $StacButtonThemeDataCopyWith<$Res> { - factory _$StacButtonThemeDataCopyWith(_StacButtonThemeData value, - $Res Function(_StacButtonThemeData) _then) = - __$StacButtonThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {ButtonTextTheme textTheme, - double minWidth, - double height, - StacEdgeInsets? padding, - StacShapeBorder? shape, - ButtonBarLayoutBehavior layoutBehavior, - bool alignedDropdown, - String? buttonColor, - String? disabledColor, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - StacColorScheme? colorScheme, - MaterialTapTargetSize? materialTapTargetSize}); - - @override - $StacColorSchemeCopyWith<$Res>? get colorScheme; -} - -/// @nodoc -class __$StacButtonThemeDataCopyWithImpl<$Res> - implements _$StacButtonThemeDataCopyWith<$Res> { - __$StacButtonThemeDataCopyWithImpl(this._self, this._then); - - final _StacButtonThemeData _self; - final $Res Function(_StacButtonThemeData) _then; - - /// Create a copy of StacButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? textTheme = null, - Object? minWidth = null, - Object? height = null, - Object? padding = freezed, - Object? shape = freezed, - Object? layoutBehavior = null, - Object? alignedDropdown = null, - Object? buttonColor = freezed, - Object? disabledColor = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? highlightColor = freezed, - Object? splashColor = freezed, - Object? colorScheme = freezed, - Object? materialTapTargetSize = freezed, - }) { - return _then(_StacButtonThemeData( - textTheme: null == textTheme - ? _self.textTheme - : textTheme // ignore: cast_nullable_to_non_nullable - as ButtonTextTheme, - minWidth: null == minWidth - ? _self.minWidth - : minWidth // ignore: cast_nullable_to_non_nullable - as double, - height: null == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as double, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - layoutBehavior: null == layoutBehavior - ? _self.layoutBehavior - : layoutBehavior // ignore: cast_nullable_to_non_nullable - as ButtonBarLayoutBehavior, - alignedDropdown: null == alignedDropdown - ? _self.alignedDropdown - : alignedDropdown // ignore: cast_nullable_to_non_nullable - as bool, - buttonColor: freezed == buttonColor - ? _self.buttonColor - : buttonColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledColor: freezed == disabledColor - ? _self.disabledColor - : disabledColor // ignore: cast_nullable_to_non_nullable - as String?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - highlightColor: freezed == highlightColor - ? _self.highlightColor - : highlightColor // ignore: cast_nullable_to_non_nullable - as String?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - colorScheme: freezed == colorScheme - ? _self.colorScheme - : colorScheme // ignore: cast_nullable_to_non_nullable - as StacColorScheme?, - materialTapTargetSize: freezed == materialTapTargetSize - ? _self.materialTapTargetSize - : materialTapTargetSize // ignore: cast_nullable_to_non_nullable - as MaterialTapTargetSize?, - )); - } - - /// Create a copy of StacButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacColorSchemeCopyWith<$Res>? get colorScheme { - if (_self.colorScheme == null) { - return null; - } - - return $StacColorSchemeCopyWith<$Res>(_self.colorScheme!, (value) { - return _then(_self.copyWith(colorScheme: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.g.dart deleted file mode 100644 index 3b90dd9c8..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.g.dart +++ /dev/null @@ -1,76 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_button_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacButtonThemeData _$StacButtonThemeDataFromJson(Map json) => - _StacButtonThemeData( - textTheme: - $enumDecodeNullable(_$ButtonTextThemeEnumMap, json['textTheme']) ?? - ButtonTextTheme.normal, - minWidth: (json['minWidth'] as num?)?.toDouble() ?? 88.0, - height: (json['height'] as num?)?.toDouble() ?? 36.0, - padding: json['padding'] == null - ? null - : StacEdgeInsets.fromJson(json['padding']), - shape: json['shape'] == null - ? null - : StacShapeBorder.fromJson(json['shape'] as Map), - layoutBehavior: $enumDecodeNullable( - _$ButtonBarLayoutBehaviorEnumMap, json['layoutBehavior']) ?? - ButtonBarLayoutBehavior.padded, - alignedDropdown: json['alignedDropdown'] as bool? ?? false, - buttonColor: json['buttonColor'] as String?, - disabledColor: json['disabledColor'] as String?, - focusColor: json['focusColor'] as String?, - hoverColor: json['hoverColor'] as String?, - highlightColor: json['highlightColor'] as String?, - splashColor: json['splashColor'] as String?, - colorScheme: json['colorScheme'] == null - ? null - : StacColorScheme.fromJson( - json['colorScheme'] as Map), - materialTapTargetSize: $enumDecodeNullable( - _$MaterialTapTargetSizeEnumMap, json['materialTapTargetSize']), - ); - -Map _$StacButtonThemeDataToJson( - _StacButtonThemeData instance) => - { - 'textTheme': _$ButtonTextThemeEnumMap[instance.textTheme]!, - 'minWidth': instance.minWidth, - 'height': instance.height, - 'padding': instance.padding, - 'shape': instance.shape, - 'layoutBehavior': - _$ButtonBarLayoutBehaviorEnumMap[instance.layoutBehavior]!, - 'alignedDropdown': instance.alignedDropdown, - 'buttonColor': instance.buttonColor, - 'disabledColor': instance.disabledColor, - 'focusColor': instance.focusColor, - 'hoverColor': instance.hoverColor, - 'highlightColor': instance.highlightColor, - 'splashColor': instance.splashColor, - 'colorScheme': instance.colorScheme, - 'materialTapTargetSize': - _$MaterialTapTargetSizeEnumMap[instance.materialTapTargetSize], - }; - -const _$ButtonTextThemeEnumMap = { - ButtonTextTheme.normal: 'normal', - ButtonTextTheme.accent: 'accent', - ButtonTextTheme.primary: 'primary', -}; - -const _$ButtonBarLayoutBehaviorEnumMap = { - ButtonBarLayoutBehavior.constrained: 'constrained', - ButtonBarLayoutBehavior.padded: 'padded', -}; - -const _$MaterialTapTargetSizeEnumMap = { - MaterialTapTargetSize.padded: 'padded', - MaterialTapTargetSize.shrinkWrap: 'shrinkWrap', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_button_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_button_theme_data_parser.dart new file mode 100644 index 000000000..b51960a94 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_button_theme_data_parser.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/foundation.dart'; +import 'package:stac/stac.dart'; + +/// Parser extension for [StacButtonThemeData]. +/// +/// Converts [StacButtonThemeData] to Flutter's [ButtonThemeData]. +extension StacButtonThemeDataParser on StacButtonThemeData { + ButtonThemeData? parse(BuildContext context) { + return ButtonThemeData( + textTheme: textTheme?.parse(context) ?? ButtonTextTheme.normal, + minWidth: minWidth ?? 88.0, + height: height ?? 36.0, + padding: padding?.parse, + shape: shape?.parse(context), + layoutBehavior: layoutBehavior?.parse ?? ButtonBarLayoutBehavior.padded, + alignedDropdown: alignedDropdown ?? false, + buttonColor: buttonColor?.toColor(context), + disabledColor: disabledColor?.toColor(context), + focusColor: focusColor?.toColor(context), + hoverColor: hoverColor?.toColor(context), + highlightColor: highlightColor?.toColor(context), + splashColor: splashColor?.toColor(context), + colorScheme: colorScheme?.parse(context), + materialTapTargetSize: materialTapTargetSize?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart deleted file mode 100644 index 85c83272b..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_border_parser.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; -import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; - -part 'stac_card_theme_data.freezed.dart'; -part 'stac_card_theme_data.g.dart'; - -@freezed -abstract class StacCardThemeData with _$StacCardThemeData { - const factory StacCardThemeData({ - Clip? clipBehavior, - String? color, - String? shadowColor, - String? surfaceTintColor, - double? elevation, - StacEdgeInsets? margin, - StacBorder? shape, - }) = _StacCardThemeData; - - factory StacCardThemeData.fromJson(Map json) => - _$StacCardThemeDataFromJson(json); -} - -extension StacCardThemeDataParser on StacCardThemeData { - CardThemeData? parse(BuildContext context) { - return CardThemeData( - clipBehavior: clipBehavior, - color: color.toColor(context), - shadowColor: shadowColor.toColor(context), - surfaceTintColor: surfaceTintColor.toColor(context), - elevation: elevation, - margin: margin?.parse, - shape: shape?.parse(context), - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.freezed.dart deleted file mode 100644 index 2eb980fa3..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.freezed.dart +++ /dev/null @@ -1,464 +0,0 @@ -// 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 - -part of 'stac_card_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacCardThemeData { - Clip? get clipBehavior; - String? get color; - String? get shadowColor; - String? get surfaceTintColor; - double? get elevation; - StacEdgeInsets? get margin; - StacBorder? get shape; - - /// Create a copy of StacCardThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacCardThemeDataCopyWith get copyWith => - _$StacCardThemeDataCopyWithImpl( - this as StacCardThemeData, _$identity); - - /// Serializes this StacCardThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacCardThemeData && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - (identical(other.color, color) || other.color == color) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.margin, margin) || other.margin == margin) && - (identical(other.shape, shape) || other.shape == shape)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, clipBehavior, color, shadowColor, - surfaceTintColor, elevation, margin, shape); - - @override - String toString() { - return 'StacCardThemeData(clipBehavior: $clipBehavior, color: $color, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, elevation: $elevation, margin: $margin, shape: $shape)'; - } -} - -/// @nodoc -abstract mixin class $StacCardThemeDataCopyWith<$Res> { - factory $StacCardThemeDataCopyWith( - StacCardThemeData value, $Res Function(StacCardThemeData) _then) = - _$StacCardThemeDataCopyWithImpl; - @useResult - $Res call( - {Clip? clipBehavior, - String? color, - String? shadowColor, - String? surfaceTintColor, - double? elevation, - StacEdgeInsets? margin, - StacBorder? shape}); -} - -/// @nodoc -class _$StacCardThemeDataCopyWithImpl<$Res> - implements $StacCardThemeDataCopyWith<$Res> { - _$StacCardThemeDataCopyWithImpl(this._self, this._then); - - final StacCardThemeData _self; - final $Res Function(StacCardThemeData) _then; - - /// Create a copy of StacCardThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? clipBehavior = freezed, - Object? color = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? elevation = freezed, - Object? margin = freezed, - Object? shape = freezed, - }) { - return _then(_self.copyWith( - clipBehavior: freezed == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip?, - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - margin: freezed == margin - ? _self.margin - : margin // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacCardThemeData]. -extension StacCardThemeDataPatterns on StacCardThemeData { - /// 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(_StacCardThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacCardThemeData() 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(_StacCardThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacCardThemeData(): - 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(_StacCardThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacCardThemeData() 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( - Clip? clipBehavior, - String? color, - String? shadowColor, - String? surfaceTintColor, - double? elevation, - StacEdgeInsets? margin, - StacBorder? shape)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacCardThemeData() when $default != null: - return $default(_that.clipBehavior, _that.color, _that.shadowColor, - _that.surfaceTintColor, _that.elevation, _that.margin, _that.shape); - 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( - Clip? clipBehavior, - String? color, - String? shadowColor, - String? surfaceTintColor, - double? elevation, - StacEdgeInsets? margin, - StacBorder? shape) - $default, - ) { - final _that = this; - switch (_that) { - case _StacCardThemeData(): - return $default(_that.clipBehavior, _that.color, _that.shadowColor, - _that.surfaceTintColor, _that.elevation, _that.margin, _that.shape); - 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( - Clip? clipBehavior, - String? color, - String? shadowColor, - String? surfaceTintColor, - double? elevation, - StacEdgeInsets? margin, - StacBorder? shape)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacCardThemeData() when $default != null: - return $default(_that.clipBehavior, _that.color, _that.shadowColor, - _that.surfaceTintColor, _that.elevation, _that.margin, _that.shape); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacCardThemeData implements StacCardThemeData { - const _StacCardThemeData( - {this.clipBehavior, - this.color, - this.shadowColor, - this.surfaceTintColor, - this.elevation, - this.margin, - this.shape}); - factory _StacCardThemeData.fromJson(Map json) => - _$StacCardThemeDataFromJson(json); - - @override - final Clip? clipBehavior; - @override - final String? color; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final double? elevation; - @override - final StacEdgeInsets? margin; - @override - final StacBorder? shape; - - /// Create a copy of StacCardThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacCardThemeDataCopyWith<_StacCardThemeData> get copyWith => - __$StacCardThemeDataCopyWithImpl<_StacCardThemeData>(this, _$identity); - - @override - Map toJson() { - return _$StacCardThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacCardThemeData && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - (identical(other.color, color) || other.color == color) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.margin, margin) || other.margin == margin) && - (identical(other.shape, shape) || other.shape == shape)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, clipBehavior, color, shadowColor, - surfaceTintColor, elevation, margin, shape); - - @override - String toString() { - return 'StacCardThemeData(clipBehavior: $clipBehavior, color: $color, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, elevation: $elevation, margin: $margin, shape: $shape)'; - } -} - -/// @nodoc -abstract mixin class _$StacCardThemeDataCopyWith<$Res> - implements $StacCardThemeDataCopyWith<$Res> { - factory _$StacCardThemeDataCopyWith( - _StacCardThemeData value, $Res Function(_StacCardThemeData) _then) = - __$StacCardThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {Clip? clipBehavior, - String? color, - String? shadowColor, - String? surfaceTintColor, - double? elevation, - StacEdgeInsets? margin, - StacBorder? shape}); -} - -/// @nodoc -class __$StacCardThemeDataCopyWithImpl<$Res> - implements _$StacCardThemeDataCopyWith<$Res> { - __$StacCardThemeDataCopyWithImpl(this._self, this._then); - - final _StacCardThemeData _self; - final $Res Function(_StacCardThemeData) _then; - - /// Create a copy of StacCardThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? clipBehavior = freezed, - Object? color = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? elevation = freezed, - Object? margin = freezed, - Object? shape = freezed, - }) { - return _then(_StacCardThemeData( - clipBehavior: freezed == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip?, - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - margin: freezed == margin - ? _self.margin - : margin // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_card_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_card_theme_data_parser.dart new file mode 100644 index 000000000..8a10b9c11 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_card_theme_data_parser.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_border_parser.dart'; +import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; +import 'package:stac/src/parsers/foundation/layout/stac_clip_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacCardThemeData]. +/// +/// Converts [StacCardThemeData] to Flutter's [CardThemeData]. +extension StacCardThemeDataParser on StacCardThemeData { + CardThemeData parse(BuildContext context) { + return CardThemeData( + clipBehavior: clipBehavior?.parse, + color: color?.toColor(context), + shadowColor: shadowColor?.toColor(context), + surfaceTintColor: surfaceTintColor?.toColor(context), + elevation: elevation, + margin: margin?.parse, + shape: shape?.parse(context), + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart deleted file mode 100644 index 144877ce2..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart +++ /dev/null @@ -1,555 +0,0 @@ -// 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 - -part of 'stac_checkbox_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacCheckboxThemeData { - StacMouseCursor? get mouseCursor; - String? get fillColor; - String? get checkColor; - String? get overlayColor; - double? get splashRadius; - MaterialTapTargetSize? get materialTapTargetSize; - StacVisualDensity? get visualDensity; - StacShapeBorder? get shape; - StacBorderSide? get side; - - /// Create a copy of StacCheckboxThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacCheckboxThemeDataCopyWith get copyWith => - _$StacCheckboxThemeDataCopyWithImpl( - this as StacCheckboxThemeData, _$identity); - - /// Serializes this StacCheckboxThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacCheckboxThemeData && - (identical(other.mouseCursor, mouseCursor) || - other.mouseCursor == mouseCursor) && - (identical(other.fillColor, fillColor) || - other.fillColor == fillColor) && - (identical(other.checkColor, checkColor) || - other.checkColor == checkColor) && - (identical(other.overlayColor, overlayColor) || - other.overlayColor == overlayColor) && - (identical(other.splashRadius, splashRadius) || - other.splashRadius == splashRadius) && - (identical(other.materialTapTargetSize, materialTapTargetSize) || - other.materialTapTargetSize == materialTapTargetSize) && - (identical(other.visualDensity, visualDensity) || - other.visualDensity == visualDensity) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.side, side) || other.side == side)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - mouseCursor, - fillColor, - checkColor, - overlayColor, - splashRadius, - materialTapTargetSize, - visualDensity, - shape, - side); - - @override - String toString() { - return 'StacCheckboxThemeData(mouseCursor: $mouseCursor, fillColor: $fillColor, checkColor: $checkColor, overlayColor: $overlayColor, splashRadius: $splashRadius, materialTapTargetSize: $materialTapTargetSize, visualDensity: $visualDensity, shape: $shape, side: $side)'; - } -} - -/// @nodoc -abstract mixin class $StacCheckboxThemeDataCopyWith<$Res> { - factory $StacCheckboxThemeDataCopyWith(StacCheckboxThemeData value, - $Res Function(StacCheckboxThemeData) _then) = - _$StacCheckboxThemeDataCopyWithImpl; - @useResult - $Res call( - {StacMouseCursor? mouseCursor, - String? fillColor, - String? checkColor, - String? overlayColor, - double? splashRadius, - MaterialTapTargetSize? materialTapTargetSize, - StacVisualDensity? visualDensity, - StacShapeBorder? shape, - StacBorderSide? side}); -} - -/// @nodoc -class _$StacCheckboxThemeDataCopyWithImpl<$Res> - implements $StacCheckboxThemeDataCopyWith<$Res> { - _$StacCheckboxThemeDataCopyWithImpl(this._self, this._then); - - final StacCheckboxThemeData _self; - final $Res Function(StacCheckboxThemeData) _then; - - /// Create a copy of StacCheckboxThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? mouseCursor = freezed, - Object? fillColor = freezed, - Object? checkColor = freezed, - Object? overlayColor = freezed, - Object? splashRadius = freezed, - Object? materialTapTargetSize = freezed, - Object? visualDensity = freezed, - Object? shape = freezed, - Object? side = freezed, - }) { - return _then(_self.copyWith( - mouseCursor: freezed == mouseCursor - ? _self.mouseCursor - : mouseCursor // ignore: cast_nullable_to_non_nullable - as StacMouseCursor?, - fillColor: freezed == fillColor - ? _self.fillColor - : fillColor // ignore: cast_nullable_to_non_nullable - as String?, - checkColor: freezed == checkColor - ? _self.checkColor - : checkColor // ignore: cast_nullable_to_non_nullable - as String?, - overlayColor: freezed == overlayColor - ? _self.overlayColor - : overlayColor // ignore: cast_nullable_to_non_nullable - as String?, - splashRadius: freezed == splashRadius - ? _self.splashRadius - : splashRadius // ignore: cast_nullable_to_non_nullable - as double?, - materialTapTargetSize: freezed == materialTapTargetSize - ? _self.materialTapTargetSize - : materialTapTargetSize // ignore: cast_nullable_to_non_nullable - as MaterialTapTargetSize?, - visualDensity: freezed == visualDensity - ? _self.visualDensity - : visualDensity // ignore: cast_nullable_to_non_nullable - as StacVisualDensity?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - side: freezed == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacCheckboxThemeData]. -extension StacCheckboxThemeDataPatterns on StacCheckboxThemeData { - /// 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(_StacCheckboxThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacCheckboxThemeData() 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(_StacCheckboxThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacCheckboxThemeData(): - 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(_StacCheckboxThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacCheckboxThemeData() 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( - StacMouseCursor? mouseCursor, - String? fillColor, - String? checkColor, - String? overlayColor, - double? splashRadius, - MaterialTapTargetSize? materialTapTargetSize, - StacVisualDensity? visualDensity, - StacShapeBorder? shape, - StacBorderSide? side)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacCheckboxThemeData() when $default != null: - return $default( - _that.mouseCursor, - _that.fillColor, - _that.checkColor, - _that.overlayColor, - _that.splashRadius, - _that.materialTapTargetSize, - _that.visualDensity, - _that.shape, - _that.side); - 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( - StacMouseCursor? mouseCursor, - String? fillColor, - String? checkColor, - String? overlayColor, - double? splashRadius, - MaterialTapTargetSize? materialTapTargetSize, - StacVisualDensity? visualDensity, - StacShapeBorder? shape, - StacBorderSide? side) - $default, - ) { - final _that = this; - switch (_that) { - case _StacCheckboxThemeData(): - return $default( - _that.mouseCursor, - _that.fillColor, - _that.checkColor, - _that.overlayColor, - _that.splashRadius, - _that.materialTapTargetSize, - _that.visualDensity, - _that.shape, - _that.side); - 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( - StacMouseCursor? mouseCursor, - String? fillColor, - String? checkColor, - String? overlayColor, - double? splashRadius, - MaterialTapTargetSize? materialTapTargetSize, - StacVisualDensity? visualDensity, - StacShapeBorder? shape, - StacBorderSide? side)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacCheckboxThemeData() when $default != null: - return $default( - _that.mouseCursor, - _that.fillColor, - _that.checkColor, - _that.overlayColor, - _that.splashRadius, - _that.materialTapTargetSize, - _that.visualDensity, - _that.shape, - _that.side); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacCheckboxThemeData implements StacCheckboxThemeData { - const _StacCheckboxThemeData( - {this.mouseCursor, - this.fillColor, - this.checkColor, - this.overlayColor, - this.splashRadius, - this.materialTapTargetSize, - this.visualDensity, - this.shape, - this.side}); - factory _StacCheckboxThemeData.fromJson(Map json) => - _$StacCheckboxThemeDataFromJson(json); - - @override - final StacMouseCursor? mouseCursor; - @override - final String? fillColor; - @override - final String? checkColor; - @override - final String? overlayColor; - @override - final double? splashRadius; - @override - final MaterialTapTargetSize? materialTapTargetSize; - @override - final StacVisualDensity? visualDensity; - @override - final StacShapeBorder? shape; - @override - final StacBorderSide? side; - - /// Create a copy of StacCheckboxThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacCheckboxThemeDataCopyWith<_StacCheckboxThemeData> get copyWith => - __$StacCheckboxThemeDataCopyWithImpl<_StacCheckboxThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacCheckboxThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacCheckboxThemeData && - (identical(other.mouseCursor, mouseCursor) || - other.mouseCursor == mouseCursor) && - (identical(other.fillColor, fillColor) || - other.fillColor == fillColor) && - (identical(other.checkColor, checkColor) || - other.checkColor == checkColor) && - (identical(other.overlayColor, overlayColor) || - other.overlayColor == overlayColor) && - (identical(other.splashRadius, splashRadius) || - other.splashRadius == splashRadius) && - (identical(other.materialTapTargetSize, materialTapTargetSize) || - other.materialTapTargetSize == materialTapTargetSize) && - (identical(other.visualDensity, visualDensity) || - other.visualDensity == visualDensity) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.side, side) || other.side == side)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - mouseCursor, - fillColor, - checkColor, - overlayColor, - splashRadius, - materialTapTargetSize, - visualDensity, - shape, - side); - - @override - String toString() { - return 'StacCheckboxThemeData(mouseCursor: $mouseCursor, fillColor: $fillColor, checkColor: $checkColor, overlayColor: $overlayColor, splashRadius: $splashRadius, materialTapTargetSize: $materialTapTargetSize, visualDensity: $visualDensity, shape: $shape, side: $side)'; - } -} - -/// @nodoc -abstract mixin class _$StacCheckboxThemeDataCopyWith<$Res> - implements $StacCheckboxThemeDataCopyWith<$Res> { - factory _$StacCheckboxThemeDataCopyWith(_StacCheckboxThemeData value, - $Res Function(_StacCheckboxThemeData) _then) = - __$StacCheckboxThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {StacMouseCursor? mouseCursor, - String? fillColor, - String? checkColor, - String? overlayColor, - double? splashRadius, - MaterialTapTargetSize? materialTapTargetSize, - StacVisualDensity? visualDensity, - StacShapeBorder? shape, - StacBorderSide? side}); -} - -/// @nodoc -class __$StacCheckboxThemeDataCopyWithImpl<$Res> - implements _$StacCheckboxThemeDataCopyWith<$Res> { - __$StacCheckboxThemeDataCopyWithImpl(this._self, this._then); - - final _StacCheckboxThemeData _self; - final $Res Function(_StacCheckboxThemeData) _then; - - /// Create a copy of StacCheckboxThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? mouseCursor = freezed, - Object? fillColor = freezed, - Object? checkColor = freezed, - Object? overlayColor = freezed, - Object? splashRadius = freezed, - Object? materialTapTargetSize = freezed, - Object? visualDensity = freezed, - Object? shape = freezed, - Object? side = freezed, - }) { - return _then(_StacCheckboxThemeData( - mouseCursor: freezed == mouseCursor - ? _self.mouseCursor - : mouseCursor // ignore: cast_nullable_to_non_nullable - as StacMouseCursor?, - fillColor: freezed == fillColor - ? _self.fillColor - : fillColor // ignore: cast_nullable_to_non_nullable - as String?, - checkColor: freezed == checkColor - ? _self.checkColor - : checkColor // ignore: cast_nullable_to_non_nullable - as String?, - overlayColor: freezed == overlayColor - ? _self.overlayColor - : overlayColor // ignore: cast_nullable_to_non_nullable - as String?, - splashRadius: freezed == splashRadius - ? _self.splashRadius - : splashRadius // ignore: cast_nullable_to_non_nullable - as double?, - materialTapTargetSize: freezed == materialTapTargetSize - ? _self.materialTapTargetSize - : materialTapTargetSize // ignore: cast_nullable_to_non_nullable - as MaterialTapTargetSize?, - visualDensity: freezed == visualDensity - ? _self.visualDensity - : visualDensity // ignore: cast_nullable_to_non_nullable - as StacVisualDensity?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - side: freezed == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data_parser.dart similarity index 61% rename from packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart rename to packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data_parser.dart index 32ae7820d..d9fb21b03 100644 --- a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data_parser.dart @@ -1,33 +1,15 @@ import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/foundation/borders/stac_border_side_parser.dart'; import 'package:stac/src/parsers/foundation/borders/stac_shape_border_parser.dart'; import 'package:stac/src/parsers/foundation/geometry/stac_visual_density_parser.dart'; import 'package:stac/src/parsers/foundation/interaction/stac_mouse_cursor_parser.dart'; +import 'package:stac/src/parsers/foundation/layout/stac_material_tap_target_size_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_core/stac_core.dart'; -part 'stac_checkbox_theme_data.freezed.dart'; -part 'stac_checkbox_theme_data.g.dart'; - -@freezed -abstract class StacCheckboxThemeData with _$StacCheckboxThemeData { - const factory StacCheckboxThemeData({ - StacMouseCursor? mouseCursor, - String? fillColor, - String? checkColor, - String? overlayColor, - double? splashRadius, - MaterialTapTargetSize? materialTapTargetSize, - StacVisualDensity? visualDensity, - StacShapeBorder? shape, - StacBorderSide? side, - }) = _StacCheckboxThemeData; - - factory StacCheckboxThemeData.fromJson(Map json) => - _$StacCheckboxThemeDataFromJson(json); -} - +/// Parser extension for [StacCheckboxThemeData]. +/// +/// Converts [StacCheckboxThemeData] to Flutter's [CheckboxThemeData]. extension StacCheckboxThemeDataParser on StacCheckboxThemeData { CheckboxThemeData parse(BuildContext context) { return CheckboxThemeData( @@ -42,7 +24,7 @@ extension StacCheckboxThemeDataParser on StacCheckboxThemeData { ? WidgetStateProperty.all(overlayColor!.toColor(context)) : null, splashRadius: splashRadius, - materialTapTargetSize: materialTapTargetSize, + materialTapTargetSize: materialTapTargetSize?.parse, visualDensity: visualDensity?.parse, shape: shape?.parse(context), side: side?.parse(context), diff --git a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.freezed.dart deleted file mode 100644 index 9adb99ee4..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.freezed.dart +++ /dev/null @@ -1,979 +0,0 @@ -// 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 - -part of 'stac_chip_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacChipThemeData { - String? get color; - String? get backgroundColor; - String? get deleteIconColor; - String? get disabledColor; - String? get selectedColor; - String? get secondarySelectedColor; - String? get shadowColor; - String? get surfaceTintColor; - String? get selectedShadowColor; - bool? get showCheckmark; - String? get checkmarkColor; - StacEdgeInsets? get labelPadding; - StacEdgeInsets? get padding; - StacBorderSide? get side; - StacShapeBorder? get shape; - StacTextStyle? get labelStyle; - StacTextStyle? get secondaryLabelStyle; - Brightness? get brightness; - double? get elevation; - double? get pressElevation; - StacIconThemeData? get iconTheme; - StacBoxConstraints? get avatarBoxConstraints; - StacBoxConstraints? get deleteIconBoxConstraints; - - /// Create a copy of StacChipThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacChipThemeDataCopyWith get copyWith => - _$StacChipThemeDataCopyWithImpl( - this as StacChipThemeData, _$identity); - - /// Serializes this StacChipThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacChipThemeData && - (identical(other.color, color) || other.color == color) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.deleteIconColor, deleteIconColor) || - other.deleteIconColor == deleteIconColor) && - (identical(other.disabledColor, disabledColor) || - other.disabledColor == disabledColor) && - (identical(other.selectedColor, selectedColor) || - other.selectedColor == selectedColor) && - (identical(other.secondarySelectedColor, secondarySelectedColor) || - other.secondarySelectedColor == secondarySelectedColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.selectedShadowColor, selectedShadowColor) || - other.selectedShadowColor == selectedShadowColor) && - (identical(other.showCheckmark, showCheckmark) || - other.showCheckmark == showCheckmark) && - (identical(other.checkmarkColor, checkmarkColor) || - other.checkmarkColor == checkmarkColor) && - (identical(other.labelPadding, labelPadding) || - other.labelPadding == labelPadding) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.side, side) || other.side == side) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.labelStyle, labelStyle) || - other.labelStyle == labelStyle) && - (identical(other.secondaryLabelStyle, secondaryLabelStyle) || - other.secondaryLabelStyle == secondaryLabelStyle) && - (identical(other.brightness, brightness) || - other.brightness == brightness) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.pressElevation, pressElevation) || - other.pressElevation == pressElevation) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme) && - (identical(other.avatarBoxConstraints, avatarBoxConstraints) || - other.avatarBoxConstraints == avatarBoxConstraints) && - (identical( - other.deleteIconBoxConstraints, deleteIconBoxConstraints) || - other.deleteIconBoxConstraints == deleteIconBoxConstraints)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - color, - backgroundColor, - deleteIconColor, - disabledColor, - selectedColor, - secondarySelectedColor, - shadowColor, - surfaceTintColor, - selectedShadowColor, - showCheckmark, - checkmarkColor, - labelPadding, - padding, - side, - shape, - labelStyle, - secondaryLabelStyle, - brightness, - elevation, - pressElevation, - iconTheme, - avatarBoxConstraints, - deleteIconBoxConstraints - ]); - - @override - String toString() { - return 'StacChipThemeData(color: $color, backgroundColor: $backgroundColor, deleteIconColor: $deleteIconColor, disabledColor: $disabledColor, selectedColor: $selectedColor, secondarySelectedColor: $secondarySelectedColor, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, selectedShadowColor: $selectedShadowColor, showCheckmark: $showCheckmark, checkmarkColor: $checkmarkColor, labelPadding: $labelPadding, padding: $padding, side: $side, shape: $shape, labelStyle: $labelStyle, secondaryLabelStyle: $secondaryLabelStyle, brightness: $brightness, elevation: $elevation, pressElevation: $pressElevation, iconTheme: $iconTheme, avatarBoxConstraints: $avatarBoxConstraints, deleteIconBoxConstraints: $deleteIconBoxConstraints)'; - } -} - -/// @nodoc -abstract mixin class $StacChipThemeDataCopyWith<$Res> { - factory $StacChipThemeDataCopyWith( - StacChipThemeData value, $Res Function(StacChipThemeData) _then) = - _$StacChipThemeDataCopyWithImpl; - @useResult - $Res call( - {String? color, - String? backgroundColor, - String? deleteIconColor, - String? disabledColor, - String? selectedColor, - String? secondarySelectedColor, - String? shadowColor, - String? surfaceTintColor, - String? selectedShadowColor, - bool? showCheckmark, - String? checkmarkColor, - StacEdgeInsets? labelPadding, - StacEdgeInsets? padding, - StacBorderSide? side, - StacShapeBorder? shape, - StacTextStyle? labelStyle, - StacTextStyle? secondaryLabelStyle, - Brightness? brightness, - double? elevation, - double? pressElevation, - StacIconThemeData? iconTheme, - StacBoxConstraints? avatarBoxConstraints, - StacBoxConstraints? deleteIconBoxConstraints}); - - $StacIconThemeDataCopyWith<$Res>? get iconTheme; -} - -/// @nodoc -class _$StacChipThemeDataCopyWithImpl<$Res> - implements $StacChipThemeDataCopyWith<$Res> { - _$StacChipThemeDataCopyWithImpl(this._self, this._then); - - final StacChipThemeData _self; - final $Res Function(StacChipThemeData) _then; - - /// Create a copy of StacChipThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? color = freezed, - Object? backgroundColor = freezed, - Object? deleteIconColor = freezed, - Object? disabledColor = freezed, - Object? selectedColor = freezed, - Object? secondarySelectedColor = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? selectedShadowColor = freezed, - Object? showCheckmark = freezed, - Object? checkmarkColor = freezed, - Object? labelPadding = freezed, - Object? padding = freezed, - Object? side = freezed, - Object? shape = freezed, - Object? labelStyle = freezed, - Object? secondaryLabelStyle = freezed, - Object? brightness = freezed, - Object? elevation = freezed, - Object? pressElevation = freezed, - Object? iconTheme = freezed, - Object? avatarBoxConstraints = freezed, - Object? deleteIconBoxConstraints = freezed, - }) { - return _then(_self.copyWith( - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - deleteIconColor: freezed == deleteIconColor - ? _self.deleteIconColor - : deleteIconColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledColor: freezed == disabledColor - ? _self.disabledColor - : disabledColor // ignore: cast_nullable_to_non_nullable - as String?, - selectedColor: freezed == selectedColor - ? _self.selectedColor - : selectedColor // ignore: cast_nullable_to_non_nullable - as String?, - secondarySelectedColor: freezed == secondarySelectedColor - ? _self.secondarySelectedColor - : secondarySelectedColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - selectedShadowColor: freezed == selectedShadowColor - ? _self.selectedShadowColor - : selectedShadowColor // ignore: cast_nullable_to_non_nullable - as String?, - showCheckmark: freezed == showCheckmark - ? _self.showCheckmark - : showCheckmark // ignore: cast_nullable_to_non_nullable - as bool?, - checkmarkColor: freezed == checkmarkColor - ? _self.checkmarkColor - : checkmarkColor // ignore: cast_nullable_to_non_nullable - as String?, - labelPadding: freezed == labelPadding - ? _self.labelPadding - : labelPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - side: freezed == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - labelStyle: freezed == labelStyle - ? _self.labelStyle - : labelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - secondaryLabelStyle: freezed == secondaryLabelStyle - ? _self.secondaryLabelStyle - : secondaryLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - brightness: freezed == brightness - ? _self.brightness - : brightness // ignore: cast_nullable_to_non_nullable - as Brightness?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - pressElevation: freezed == pressElevation - ? _self.pressElevation - : pressElevation // ignore: cast_nullable_to_non_nullable - as double?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - avatarBoxConstraints: freezed == avatarBoxConstraints - ? _self.avatarBoxConstraints - : avatarBoxConstraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - deleteIconBoxConstraints: freezed == deleteIconBoxConstraints - ? _self.deleteIconBoxConstraints - : deleteIconBoxConstraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - )); - } - - /// Create a copy of StacChipThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacChipThemeData]. -extension StacChipThemeDataPatterns on StacChipThemeData { - /// 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(_StacChipThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacChipThemeData() 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(_StacChipThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacChipThemeData(): - 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(_StacChipThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacChipThemeData() 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? color, - String? backgroundColor, - String? deleteIconColor, - String? disabledColor, - String? selectedColor, - String? secondarySelectedColor, - String? shadowColor, - String? surfaceTintColor, - String? selectedShadowColor, - bool? showCheckmark, - String? checkmarkColor, - StacEdgeInsets? labelPadding, - StacEdgeInsets? padding, - StacBorderSide? side, - StacShapeBorder? shape, - StacTextStyle? labelStyle, - StacTextStyle? secondaryLabelStyle, - Brightness? brightness, - double? elevation, - double? pressElevation, - StacIconThemeData? iconTheme, - StacBoxConstraints? avatarBoxConstraints, - StacBoxConstraints? deleteIconBoxConstraints)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacChipThemeData() when $default != null: - return $default( - _that.color, - _that.backgroundColor, - _that.deleteIconColor, - _that.disabledColor, - _that.selectedColor, - _that.secondarySelectedColor, - _that.shadowColor, - _that.surfaceTintColor, - _that.selectedShadowColor, - _that.showCheckmark, - _that.checkmarkColor, - _that.labelPadding, - _that.padding, - _that.side, - _that.shape, - _that.labelStyle, - _that.secondaryLabelStyle, - _that.brightness, - _that.elevation, - _that.pressElevation, - _that.iconTheme, - _that.avatarBoxConstraints, - _that.deleteIconBoxConstraints); - 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? color, - String? backgroundColor, - String? deleteIconColor, - String? disabledColor, - String? selectedColor, - String? secondarySelectedColor, - String? shadowColor, - String? surfaceTintColor, - String? selectedShadowColor, - bool? showCheckmark, - String? checkmarkColor, - StacEdgeInsets? labelPadding, - StacEdgeInsets? padding, - StacBorderSide? side, - StacShapeBorder? shape, - StacTextStyle? labelStyle, - StacTextStyle? secondaryLabelStyle, - Brightness? brightness, - double? elevation, - double? pressElevation, - StacIconThemeData? iconTheme, - StacBoxConstraints? avatarBoxConstraints, - StacBoxConstraints? deleteIconBoxConstraints) - $default, - ) { - final _that = this; - switch (_that) { - case _StacChipThemeData(): - return $default( - _that.color, - _that.backgroundColor, - _that.deleteIconColor, - _that.disabledColor, - _that.selectedColor, - _that.secondarySelectedColor, - _that.shadowColor, - _that.surfaceTintColor, - _that.selectedShadowColor, - _that.showCheckmark, - _that.checkmarkColor, - _that.labelPadding, - _that.padding, - _that.side, - _that.shape, - _that.labelStyle, - _that.secondaryLabelStyle, - _that.brightness, - _that.elevation, - _that.pressElevation, - _that.iconTheme, - _that.avatarBoxConstraints, - _that.deleteIconBoxConstraints); - 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? color, - String? backgroundColor, - String? deleteIconColor, - String? disabledColor, - String? selectedColor, - String? secondarySelectedColor, - String? shadowColor, - String? surfaceTintColor, - String? selectedShadowColor, - bool? showCheckmark, - String? checkmarkColor, - StacEdgeInsets? labelPadding, - StacEdgeInsets? padding, - StacBorderSide? side, - StacShapeBorder? shape, - StacTextStyle? labelStyle, - StacTextStyle? secondaryLabelStyle, - Brightness? brightness, - double? elevation, - double? pressElevation, - StacIconThemeData? iconTheme, - StacBoxConstraints? avatarBoxConstraints, - StacBoxConstraints? deleteIconBoxConstraints)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacChipThemeData() when $default != null: - return $default( - _that.color, - _that.backgroundColor, - _that.deleteIconColor, - _that.disabledColor, - _that.selectedColor, - _that.secondarySelectedColor, - _that.shadowColor, - _that.surfaceTintColor, - _that.selectedShadowColor, - _that.showCheckmark, - _that.checkmarkColor, - _that.labelPadding, - _that.padding, - _that.side, - _that.shape, - _that.labelStyle, - _that.secondaryLabelStyle, - _that.brightness, - _that.elevation, - _that.pressElevation, - _that.iconTheme, - _that.avatarBoxConstraints, - _that.deleteIconBoxConstraints); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacChipThemeData implements StacChipThemeData { - const _StacChipThemeData( - {this.color, - this.backgroundColor, - this.deleteIconColor, - this.disabledColor, - this.selectedColor, - this.secondarySelectedColor, - this.shadowColor, - this.surfaceTintColor, - this.selectedShadowColor, - this.showCheckmark, - this.checkmarkColor, - this.labelPadding, - this.padding, - this.side, - this.shape, - this.labelStyle, - this.secondaryLabelStyle, - this.brightness, - this.elevation, - this.pressElevation, - this.iconTheme, - this.avatarBoxConstraints, - this.deleteIconBoxConstraints}); - factory _StacChipThemeData.fromJson(Map json) => - _$StacChipThemeDataFromJson(json); - - @override - final String? color; - @override - final String? backgroundColor; - @override - final String? deleteIconColor; - @override - final String? disabledColor; - @override - final String? selectedColor; - @override - final String? secondarySelectedColor; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final String? selectedShadowColor; - @override - final bool? showCheckmark; - @override - final String? checkmarkColor; - @override - final StacEdgeInsets? labelPadding; - @override - final StacEdgeInsets? padding; - @override - final StacBorderSide? side; - @override - final StacShapeBorder? shape; - @override - final StacTextStyle? labelStyle; - @override - final StacTextStyle? secondaryLabelStyle; - @override - final Brightness? brightness; - @override - final double? elevation; - @override - final double? pressElevation; - @override - final StacIconThemeData? iconTheme; - @override - final StacBoxConstraints? avatarBoxConstraints; - @override - final StacBoxConstraints? deleteIconBoxConstraints; - - /// Create a copy of StacChipThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacChipThemeDataCopyWith<_StacChipThemeData> get copyWith => - __$StacChipThemeDataCopyWithImpl<_StacChipThemeData>(this, _$identity); - - @override - Map toJson() { - return _$StacChipThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacChipThemeData && - (identical(other.color, color) || other.color == color) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.deleteIconColor, deleteIconColor) || - other.deleteIconColor == deleteIconColor) && - (identical(other.disabledColor, disabledColor) || - other.disabledColor == disabledColor) && - (identical(other.selectedColor, selectedColor) || - other.selectedColor == selectedColor) && - (identical(other.secondarySelectedColor, secondarySelectedColor) || - other.secondarySelectedColor == secondarySelectedColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.selectedShadowColor, selectedShadowColor) || - other.selectedShadowColor == selectedShadowColor) && - (identical(other.showCheckmark, showCheckmark) || - other.showCheckmark == showCheckmark) && - (identical(other.checkmarkColor, checkmarkColor) || - other.checkmarkColor == checkmarkColor) && - (identical(other.labelPadding, labelPadding) || - other.labelPadding == labelPadding) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.side, side) || other.side == side) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.labelStyle, labelStyle) || - other.labelStyle == labelStyle) && - (identical(other.secondaryLabelStyle, secondaryLabelStyle) || - other.secondaryLabelStyle == secondaryLabelStyle) && - (identical(other.brightness, brightness) || - other.brightness == brightness) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.pressElevation, pressElevation) || - other.pressElevation == pressElevation) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme) && - (identical(other.avatarBoxConstraints, avatarBoxConstraints) || - other.avatarBoxConstraints == avatarBoxConstraints) && - (identical( - other.deleteIconBoxConstraints, deleteIconBoxConstraints) || - other.deleteIconBoxConstraints == deleteIconBoxConstraints)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - color, - backgroundColor, - deleteIconColor, - disabledColor, - selectedColor, - secondarySelectedColor, - shadowColor, - surfaceTintColor, - selectedShadowColor, - showCheckmark, - checkmarkColor, - labelPadding, - padding, - side, - shape, - labelStyle, - secondaryLabelStyle, - brightness, - elevation, - pressElevation, - iconTheme, - avatarBoxConstraints, - deleteIconBoxConstraints - ]); - - @override - String toString() { - return 'StacChipThemeData(color: $color, backgroundColor: $backgroundColor, deleteIconColor: $deleteIconColor, disabledColor: $disabledColor, selectedColor: $selectedColor, secondarySelectedColor: $secondarySelectedColor, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, selectedShadowColor: $selectedShadowColor, showCheckmark: $showCheckmark, checkmarkColor: $checkmarkColor, labelPadding: $labelPadding, padding: $padding, side: $side, shape: $shape, labelStyle: $labelStyle, secondaryLabelStyle: $secondaryLabelStyle, brightness: $brightness, elevation: $elevation, pressElevation: $pressElevation, iconTheme: $iconTheme, avatarBoxConstraints: $avatarBoxConstraints, deleteIconBoxConstraints: $deleteIconBoxConstraints)'; - } -} - -/// @nodoc -abstract mixin class _$StacChipThemeDataCopyWith<$Res> - implements $StacChipThemeDataCopyWith<$Res> { - factory _$StacChipThemeDataCopyWith( - _StacChipThemeData value, $Res Function(_StacChipThemeData) _then) = - __$StacChipThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? color, - String? backgroundColor, - String? deleteIconColor, - String? disabledColor, - String? selectedColor, - String? secondarySelectedColor, - String? shadowColor, - String? surfaceTintColor, - String? selectedShadowColor, - bool? showCheckmark, - String? checkmarkColor, - StacEdgeInsets? labelPadding, - StacEdgeInsets? padding, - StacBorderSide? side, - StacShapeBorder? shape, - StacTextStyle? labelStyle, - StacTextStyle? secondaryLabelStyle, - Brightness? brightness, - double? elevation, - double? pressElevation, - StacIconThemeData? iconTheme, - StacBoxConstraints? avatarBoxConstraints, - StacBoxConstraints? deleteIconBoxConstraints}); - - @override - $StacIconThemeDataCopyWith<$Res>? get iconTheme; -} - -/// @nodoc -class __$StacChipThemeDataCopyWithImpl<$Res> - implements _$StacChipThemeDataCopyWith<$Res> { - __$StacChipThemeDataCopyWithImpl(this._self, this._then); - - final _StacChipThemeData _self; - final $Res Function(_StacChipThemeData) _then; - - /// Create a copy of StacChipThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? color = freezed, - Object? backgroundColor = freezed, - Object? deleteIconColor = freezed, - Object? disabledColor = freezed, - Object? selectedColor = freezed, - Object? secondarySelectedColor = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? selectedShadowColor = freezed, - Object? showCheckmark = freezed, - Object? checkmarkColor = freezed, - Object? labelPadding = freezed, - Object? padding = freezed, - Object? side = freezed, - Object? shape = freezed, - Object? labelStyle = freezed, - Object? secondaryLabelStyle = freezed, - Object? brightness = freezed, - Object? elevation = freezed, - Object? pressElevation = freezed, - Object? iconTheme = freezed, - Object? avatarBoxConstraints = freezed, - Object? deleteIconBoxConstraints = freezed, - }) { - return _then(_StacChipThemeData( - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - deleteIconColor: freezed == deleteIconColor - ? _self.deleteIconColor - : deleteIconColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledColor: freezed == disabledColor - ? _self.disabledColor - : disabledColor // ignore: cast_nullable_to_non_nullable - as String?, - selectedColor: freezed == selectedColor - ? _self.selectedColor - : selectedColor // ignore: cast_nullable_to_non_nullable - as String?, - secondarySelectedColor: freezed == secondarySelectedColor - ? _self.secondarySelectedColor - : secondarySelectedColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - selectedShadowColor: freezed == selectedShadowColor - ? _self.selectedShadowColor - : selectedShadowColor // ignore: cast_nullable_to_non_nullable - as String?, - showCheckmark: freezed == showCheckmark - ? _self.showCheckmark - : showCheckmark // ignore: cast_nullable_to_non_nullable - as bool?, - checkmarkColor: freezed == checkmarkColor - ? _self.checkmarkColor - : checkmarkColor // ignore: cast_nullable_to_non_nullable - as String?, - labelPadding: freezed == labelPadding - ? _self.labelPadding - : labelPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - side: freezed == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - labelStyle: freezed == labelStyle - ? _self.labelStyle - : labelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - secondaryLabelStyle: freezed == secondaryLabelStyle - ? _self.secondaryLabelStyle - : secondaryLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - brightness: freezed == brightness - ? _self.brightness - : brightness // ignore: cast_nullable_to_non_nullable - as Brightness?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - pressElevation: freezed == pressElevation - ? _self.pressElevation - : pressElevation // ignore: cast_nullable_to_non_nullable - as double?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - avatarBoxConstraints: freezed == avatarBoxConstraints - ? _self.avatarBoxConstraints - : avatarBoxConstraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - deleteIconBoxConstraints: freezed == deleteIconBoxConstraints - ? _self.deleteIconBoxConstraints - : deleteIconBoxConstraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - )); - } - - /// Create a copy of StacChipThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.g.dart deleted file mode 100644 index 7e88c5f8e..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.g.dart +++ /dev/null @@ -1,87 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_chip_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacChipThemeData _$StacChipThemeDataFromJson(Map json) => - _StacChipThemeData( - color: json['color'] as String?, - backgroundColor: json['backgroundColor'] as String?, - deleteIconColor: json['deleteIconColor'] as String?, - disabledColor: json['disabledColor'] as String?, - selectedColor: json['selectedColor'] as String?, - secondarySelectedColor: json['secondarySelectedColor'] as String?, - shadowColor: json['shadowColor'] as String?, - surfaceTintColor: json['surfaceTintColor'] as String?, - selectedShadowColor: json['selectedShadowColor'] as String?, - showCheckmark: json['showCheckmark'] as bool?, - checkmarkColor: json['checkmarkColor'] as String?, - labelPadding: json['labelPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['labelPadding']), - padding: json['padding'] == null - ? null - : StacEdgeInsets.fromJson(json['padding']), - side: json['side'] == null - ? null - : StacBorderSide.fromJson(json['side'] as Map), - shape: json['shape'] == null - ? null - : StacShapeBorder.fromJson(json['shape'] as Map), - labelStyle: json['labelStyle'] == null - ? null - : StacTextStyle.fromJson(json['labelStyle']), - secondaryLabelStyle: json['secondaryLabelStyle'] == null - ? null - : StacTextStyle.fromJson(json['secondaryLabelStyle']), - brightness: $enumDecodeNullable(_$BrightnessEnumMap, json['brightness']), - elevation: (json['elevation'] as num?)?.toDouble(), - pressElevation: (json['pressElevation'] as num?)?.toDouble(), - iconTheme: json['iconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['iconTheme'] as Map), - avatarBoxConstraints: json['avatarBoxConstraints'] == null - ? null - : StacBoxConstraints.fromJson( - json['avatarBoxConstraints'] as Map), - deleteIconBoxConstraints: json['deleteIconBoxConstraints'] == null - ? null - : StacBoxConstraints.fromJson( - json['deleteIconBoxConstraints'] as Map), - ); - -Map _$StacChipThemeDataToJson(_StacChipThemeData instance) => - { - 'color': instance.color, - 'backgroundColor': instance.backgroundColor, - 'deleteIconColor': instance.deleteIconColor, - 'disabledColor': instance.disabledColor, - 'selectedColor': instance.selectedColor, - 'secondarySelectedColor': instance.secondarySelectedColor, - 'shadowColor': instance.shadowColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'selectedShadowColor': instance.selectedShadowColor, - 'showCheckmark': instance.showCheckmark, - 'checkmarkColor': instance.checkmarkColor, - 'labelPadding': instance.labelPadding, - 'padding': instance.padding, - 'side': instance.side, - 'shape': instance.shape, - 'labelStyle': instance.labelStyle, - 'secondaryLabelStyle': instance.secondaryLabelStyle, - 'brightness': _$BrightnessEnumMap[instance.brightness], - 'elevation': instance.elevation, - 'pressElevation': instance.pressElevation, - 'iconTheme': instance.iconTheme, - 'avatarBoxConstraints': instance.avatarBoxConstraints, - 'deleteIconBoxConstraints': instance.deleteIconBoxConstraints, - }; - -const _$BrightnessEnumMap = { - Brightness.dark: 'dark', - Brightness.light: 'light', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_chip_theme_data_parser.dart similarity index 58% rename from packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.dart rename to packages/stac/lib/src/parsers/theme/stac_chip_theme_data_parser.dart index 35a256815..18d59dd42 100644 --- a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_chip_theme_data_parser.dart @@ -1,48 +1,17 @@ import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/foundation/borders/stac_border_side_parser.dart'; import 'package:stac/src/parsers/foundation/borders/stac_shape_border_parser.dart'; +import 'package:stac/src/parsers/foundation/colors/stac_brightness_parser.dart'; import 'package:stac/src/parsers/foundation/geometry/stac_box_constraints_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/stac.dart'; +import 'package:stac/src/parsers/theme/stac_icon_theme_data_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_core/stac_core.dart'; -part 'stac_chip_theme_data.freezed.dart'; -part 'stac_chip_theme_data.g.dart'; - -@freezed -abstract class StacChipThemeData with _$StacChipThemeData { - const factory StacChipThemeData({ - String? color, - String? backgroundColor, - String? deleteIconColor, - String? disabledColor, - String? selectedColor, - String? secondarySelectedColor, - String? shadowColor, - String? surfaceTintColor, - String? selectedShadowColor, - bool? showCheckmark, - String? checkmarkColor, - StacEdgeInsets? labelPadding, - StacEdgeInsets? padding, - StacBorderSide? side, - StacShapeBorder? shape, - StacTextStyle? labelStyle, - StacTextStyle? secondaryLabelStyle, - Brightness? brightness, - double? elevation, - double? pressElevation, - StacIconThemeData? iconTheme, - StacBoxConstraints? avatarBoxConstraints, - StacBoxConstraints? deleteIconBoxConstraints, - }) = _StacChipThemeData; - - factory StacChipThemeData.fromJson(Map json) => - _$StacChipThemeDataFromJson(json); -} - +/// Parser extension for [StacChipThemeData]. +/// +/// Converts [StacChipThemeData] to Flutter's [ChipThemeData]. extension StacChipThemeDataParser on StacChipThemeData { ChipThemeData parse(BuildContext context) { return ChipThemeData( @@ -60,10 +29,10 @@ extension StacChipThemeDataParser on StacChipThemeData { labelPadding: labelPadding?.parse, padding: padding?.parse, side: side?.parse(context), - shape: shape?.parse(context) as OutlinedBorder, + shape: shape?.parse(context), labelStyle: labelStyle?.parse(context), secondaryLabelStyle: secondaryLabelStyle?.parse(context), - brightness: brightness, + brightness: brightness?.parse, elevation: elevation, pressElevation: pressElevation, iconTheme: iconTheme?.parse(context), diff --git a/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart b/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart deleted file mode 100644 index 1c5957ae1..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart +++ /dev/null @@ -1,116 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/utils/color_utils.dart'; - -part 'stac_color_scheme.freezed.dart'; -part 'stac_color_scheme.g.dart'; - -@freezed -abstract class StacColorScheme with _$StacColorScheme { - const factory StacColorScheme({ - required Brightness brightness, - required String primary, - required String onPrimary, - String? primaryContainer, - String? onPrimaryContainer, - String? primaryFixed, - String? primaryFixedDim, - String? onPrimaryFixed, - String? onPrimaryFixedVariant, - required String secondary, - required String onSecondary, - String? secondaryContainer, - String? onSecondaryContainer, - String? secondaryFixed, - String? secondaryFixedDim, - String? onSecondaryFixed, - String? onSecondaryFixedVariant, - String? tertiary, - String? onTertiary, - String? tertiaryContainer, - String? onTertiaryContainer, - String? tertiaryFixed, - String? tertiaryFixedDim, - String? onTertiaryFixed, - String? onTertiaryFixedVariant, - required String error, - required String onError, - String? errorContainer, - String? onErrorContainer, - required String surface, - required String onSurface, - String? surfaceDim, - String? surfaceBright, - String? surfaceContainerLowest, - String? surfaceContainerLow, - String? surfaceContainer, - String? surfaceContainerHigh, - String? surfaceContainerHighest, - String? onSurfaceVariant, - String? outline, - String? outlineVariant, - String? shadow, - String? scrim, - String? inverseSurface, - String? onInverseSurface, - String? inversePrimary, - String? surfaceTint, - }) = _StacColorScheme; - - factory StacColorScheme.fromJson(Map json) => - _$StacColorSchemeFromJson(json); -} - -extension StacColorSchemeParser on StacColorScheme { - ColorScheme parse(BuildContext context) { - return ColorScheme( - brightness: brightness, - primary: primary.toColor(context)!, - onPrimary: onPrimary.toColor(context)!, - primaryContainer: primaryContainer.toColor(context), - onPrimaryContainer: onPrimaryContainer.toColor(context), - primaryFixed: primaryFixed.toColor(context), - primaryFixedDim: primaryFixedDim.toColor(context), - onPrimaryFixed: onPrimaryFixed.toColor(context), - onPrimaryFixedVariant: onPrimaryFixedVariant.toColor(context), - secondary: secondary.toColor(context)!, - onSecondary: onSecondary.toColor(context)!, - secondaryContainer: secondaryContainer.toColor(context), - onSecondaryContainer: onSecondaryContainer.toColor(context), - secondaryFixed: secondaryFixed.toColor(context), - secondaryFixedDim: secondaryFixedDim.toColor(context), - onSecondaryFixed: onSecondaryFixed.toColor(context), - onSecondaryFixedVariant: onSecondaryFixedVariant.toColor(context), - tertiary: tertiary.toColor(context), - onTertiary: onTertiary.toColor(context), - tertiaryContainer: tertiaryContainer.toColor(context), - onTertiaryContainer: onTertiaryContainer.toColor(context), - tertiaryFixed: tertiaryFixed.toColor(context), - tertiaryFixedDim: tertiaryFixedDim.toColor(context), - onTertiaryFixed: onTertiaryFixed.toColor(context), - onTertiaryFixedVariant: onTertiaryFixedVariant.toColor(context), - error: error.toColor(context)!, - onError: onError.toColor(context)!, - errorContainer: errorContainer.toColor(context), - onErrorContainer: onErrorContainer.toColor(context), - surface: surface.toColor(context)!, - onSurface: onSurface.toColor(context)!, - surfaceDim: surfaceDim.toColor(context), - surfaceBright: surfaceBright.toColor(context), - surfaceContainerLowest: surfaceContainerLowest.toColor(context), - surfaceContainerLow: surfaceContainerLow.toColor(context), - surfaceContainer: surfaceContainer.toColor(context), - surfaceContainerHigh: surfaceContainerHigh.toColor(context), - surfaceContainerHighest: surfaceContainerHighest.toColor(context), - onSurfaceVariant: onSurfaceVariant.toColor(context), - outline: outline.toColor(context), - outlineVariant: outlineVariant.toColor(context), - shadow: shadow.toColor(context), - scrim: scrim.toColor(context), - inverseSurface: inverseSurface.toColor(context), - onInverseSurface: onInverseSurface.toColor(context), - inversePrimary: inversePrimary.toColor(context), - surfaceTint: surfaceTint.toColor(context), - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart deleted file mode 100644 index 0db772904..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart +++ /dev/null @@ -1,1604 +0,0 @@ -// 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 - -part of 'stac_color_scheme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacColorScheme { - Brightness get brightness; - String get primary; - String get onPrimary; - String? get primaryContainer; - String? get onPrimaryContainer; - String? get primaryFixed; - String? get primaryFixedDim; - String? get onPrimaryFixed; - String? get onPrimaryFixedVariant; - String get secondary; - String get onSecondary; - String? get secondaryContainer; - String? get onSecondaryContainer; - String? get secondaryFixed; - String? get secondaryFixedDim; - String? get onSecondaryFixed; - String? get onSecondaryFixedVariant; - String? get tertiary; - String? get onTertiary; - String? get tertiaryContainer; - String? get onTertiaryContainer; - String? get tertiaryFixed; - String? get tertiaryFixedDim; - String? get onTertiaryFixed; - String? get onTertiaryFixedVariant; - String get error; - String get onError; - String? get errorContainer; - String? get onErrorContainer; - String get surface; - String get onSurface; - String? get surfaceDim; - String? get surfaceBright; - String? get surfaceContainerLowest; - String? get surfaceContainerLow; - String? get surfaceContainer; - String? get surfaceContainerHigh; - String? get surfaceContainerHighest; - String? get onSurfaceVariant; - String? get outline; - String? get outlineVariant; - String? get shadow; - String? get scrim; - String? get inverseSurface; - String? get onInverseSurface; - String? get inversePrimary; - String? get surfaceTint; - - /// Create a copy of StacColorScheme - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacColorSchemeCopyWith get copyWith => - _$StacColorSchemeCopyWithImpl( - this as StacColorScheme, _$identity); - - /// Serializes this StacColorScheme to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacColorScheme && - (identical(other.brightness, brightness) || - other.brightness == brightness) && - (identical(other.primary, primary) || other.primary == primary) && - (identical(other.onPrimary, onPrimary) || - other.onPrimary == onPrimary) && - (identical(other.primaryContainer, primaryContainer) || - other.primaryContainer == primaryContainer) && - (identical(other.onPrimaryContainer, onPrimaryContainer) || - other.onPrimaryContainer == onPrimaryContainer) && - (identical(other.primaryFixed, primaryFixed) || - other.primaryFixed == primaryFixed) && - (identical(other.primaryFixedDim, primaryFixedDim) || - other.primaryFixedDim == primaryFixedDim) && - (identical(other.onPrimaryFixed, onPrimaryFixed) || - other.onPrimaryFixed == onPrimaryFixed) && - (identical(other.onPrimaryFixedVariant, onPrimaryFixedVariant) || - other.onPrimaryFixedVariant == onPrimaryFixedVariant) && - (identical(other.secondary, secondary) || - other.secondary == secondary) && - (identical(other.onSecondary, onSecondary) || - other.onSecondary == onSecondary) && - (identical(other.secondaryContainer, secondaryContainer) || - other.secondaryContainer == secondaryContainer) && - (identical(other.onSecondaryContainer, onSecondaryContainer) || - other.onSecondaryContainer == onSecondaryContainer) && - (identical(other.secondaryFixed, secondaryFixed) || - other.secondaryFixed == secondaryFixed) && - (identical(other.secondaryFixedDim, secondaryFixedDim) || - other.secondaryFixedDim == secondaryFixedDim) && - (identical(other.onSecondaryFixed, onSecondaryFixed) || - other.onSecondaryFixed == onSecondaryFixed) && - (identical(other.onSecondaryFixedVariant, onSecondaryFixedVariant) || - other.onSecondaryFixedVariant == onSecondaryFixedVariant) && - (identical(other.tertiary, tertiary) || - other.tertiary == tertiary) && - (identical(other.onTertiary, onTertiary) || - other.onTertiary == onTertiary) && - (identical(other.tertiaryContainer, tertiaryContainer) || - other.tertiaryContainer == tertiaryContainer) && - (identical(other.onTertiaryContainer, onTertiaryContainer) || - other.onTertiaryContainer == onTertiaryContainer) && - (identical(other.tertiaryFixed, tertiaryFixed) || - other.tertiaryFixed == tertiaryFixed) && - (identical(other.tertiaryFixedDim, tertiaryFixedDim) || - other.tertiaryFixedDim == tertiaryFixedDim) && - (identical(other.onTertiaryFixed, onTertiaryFixed) || - other.onTertiaryFixed == onTertiaryFixed) && - (identical(other.onTertiaryFixedVariant, onTertiaryFixedVariant) || - other.onTertiaryFixedVariant == onTertiaryFixedVariant) && - (identical(other.error, error) || other.error == error) && - (identical(other.onError, onError) || other.onError == onError) && - (identical(other.errorContainer, errorContainer) || - other.errorContainer == errorContainer) && - (identical(other.onErrorContainer, onErrorContainer) || - other.onErrorContainer == onErrorContainer) && - (identical(other.surface, surface) || other.surface == surface) && - (identical(other.onSurface, onSurface) || - other.onSurface == onSurface) && - (identical(other.surfaceDim, surfaceDim) || - other.surfaceDim == surfaceDim) && - (identical(other.surfaceBright, surfaceBright) || - other.surfaceBright == surfaceBright) && - (identical(other.surfaceContainerLowest, surfaceContainerLowest) || - other.surfaceContainerLowest == surfaceContainerLowest) && - (identical(other.surfaceContainerLow, surfaceContainerLow) || - other.surfaceContainerLow == surfaceContainerLow) && - (identical(other.surfaceContainer, surfaceContainer) || - other.surfaceContainer == surfaceContainer) && - (identical(other.surfaceContainerHigh, surfaceContainerHigh) || - other.surfaceContainerHigh == surfaceContainerHigh) && - (identical(other.surfaceContainerHighest, surfaceContainerHighest) || - other.surfaceContainerHighest == surfaceContainerHighest) && - (identical(other.onSurfaceVariant, onSurfaceVariant) || - other.onSurfaceVariant == onSurfaceVariant) && - (identical(other.outline, outline) || other.outline == outline) && - (identical(other.outlineVariant, outlineVariant) || - other.outlineVariant == outlineVariant) && - (identical(other.shadow, shadow) || other.shadow == shadow) && - (identical(other.scrim, scrim) || other.scrim == scrim) && - (identical(other.inverseSurface, inverseSurface) || - other.inverseSurface == inverseSurface) && - (identical(other.onInverseSurface, onInverseSurface) || other.onInverseSurface == onInverseSurface) && - (identical(other.inversePrimary, inversePrimary) || other.inversePrimary == inversePrimary) && - (identical(other.surfaceTint, surfaceTint) || other.surfaceTint == surfaceTint)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - brightness, - primary, - onPrimary, - primaryContainer, - onPrimaryContainer, - primaryFixed, - primaryFixedDim, - onPrimaryFixed, - onPrimaryFixedVariant, - secondary, - onSecondary, - secondaryContainer, - onSecondaryContainer, - secondaryFixed, - secondaryFixedDim, - onSecondaryFixed, - onSecondaryFixedVariant, - tertiary, - onTertiary, - tertiaryContainer, - onTertiaryContainer, - tertiaryFixed, - tertiaryFixedDim, - onTertiaryFixed, - onTertiaryFixedVariant, - error, - onError, - errorContainer, - onErrorContainer, - surface, - onSurface, - surfaceDim, - surfaceBright, - surfaceContainerLowest, - surfaceContainerLow, - surfaceContainer, - surfaceContainerHigh, - surfaceContainerHighest, - onSurfaceVariant, - outline, - outlineVariant, - shadow, - scrim, - inverseSurface, - onInverseSurface, - inversePrimary, - surfaceTint - ]); - - @override - String toString() { - return 'StacColorScheme(brightness: $brightness, primary: $primary, onPrimary: $onPrimary, primaryContainer: $primaryContainer, onPrimaryContainer: $onPrimaryContainer, primaryFixed: $primaryFixed, primaryFixedDim: $primaryFixedDim, onPrimaryFixed: $onPrimaryFixed, onPrimaryFixedVariant: $onPrimaryFixedVariant, secondary: $secondary, onSecondary: $onSecondary, secondaryContainer: $secondaryContainer, onSecondaryContainer: $onSecondaryContainer, secondaryFixed: $secondaryFixed, secondaryFixedDim: $secondaryFixedDim, onSecondaryFixed: $onSecondaryFixed, onSecondaryFixedVariant: $onSecondaryFixedVariant, tertiary: $tertiary, onTertiary: $onTertiary, tertiaryContainer: $tertiaryContainer, onTertiaryContainer: $onTertiaryContainer, tertiaryFixed: $tertiaryFixed, tertiaryFixedDim: $tertiaryFixedDim, onTertiaryFixed: $onTertiaryFixed, onTertiaryFixedVariant: $onTertiaryFixedVariant, error: $error, onError: $onError, errorContainer: $errorContainer, onErrorContainer: $onErrorContainer, surface: $surface, onSurface: $onSurface, surfaceDim: $surfaceDim, surfaceBright: $surfaceBright, surfaceContainerLowest: $surfaceContainerLowest, surfaceContainerLow: $surfaceContainerLow, surfaceContainer: $surfaceContainer, surfaceContainerHigh: $surfaceContainerHigh, surfaceContainerHighest: $surfaceContainerHighest, onSurfaceVariant: $onSurfaceVariant, outline: $outline, outlineVariant: $outlineVariant, shadow: $shadow, scrim: $scrim, inverseSurface: $inverseSurface, onInverseSurface: $onInverseSurface, inversePrimary: $inversePrimary, surfaceTint: $surfaceTint)'; - } -} - -/// @nodoc -abstract mixin class $StacColorSchemeCopyWith<$Res> { - factory $StacColorSchemeCopyWith( - StacColorScheme value, $Res Function(StacColorScheme) _then) = - _$StacColorSchemeCopyWithImpl; - @useResult - $Res call( - {Brightness brightness, - String primary, - String onPrimary, - String? primaryContainer, - String? onPrimaryContainer, - String? primaryFixed, - String? primaryFixedDim, - String? onPrimaryFixed, - String? onPrimaryFixedVariant, - String secondary, - String onSecondary, - String? secondaryContainer, - String? onSecondaryContainer, - String? secondaryFixed, - String? secondaryFixedDim, - String? onSecondaryFixed, - String? onSecondaryFixedVariant, - String? tertiary, - String? onTertiary, - String? tertiaryContainer, - String? onTertiaryContainer, - String? tertiaryFixed, - String? tertiaryFixedDim, - String? onTertiaryFixed, - String? onTertiaryFixedVariant, - String error, - String onError, - String? errorContainer, - String? onErrorContainer, - String surface, - String onSurface, - String? surfaceDim, - String? surfaceBright, - String? surfaceContainerLowest, - String? surfaceContainerLow, - String? surfaceContainer, - String? surfaceContainerHigh, - String? surfaceContainerHighest, - String? onSurfaceVariant, - String? outline, - String? outlineVariant, - String? shadow, - String? scrim, - String? inverseSurface, - String? onInverseSurface, - String? inversePrimary, - String? surfaceTint}); -} - -/// @nodoc -class _$StacColorSchemeCopyWithImpl<$Res> - implements $StacColorSchemeCopyWith<$Res> { - _$StacColorSchemeCopyWithImpl(this._self, this._then); - - final StacColorScheme _self; - final $Res Function(StacColorScheme) _then; - - /// Create a copy of StacColorScheme - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? brightness = null, - Object? primary = null, - Object? onPrimary = null, - Object? primaryContainer = freezed, - Object? onPrimaryContainer = freezed, - Object? primaryFixed = freezed, - Object? primaryFixedDim = freezed, - Object? onPrimaryFixed = freezed, - Object? onPrimaryFixedVariant = freezed, - Object? secondary = null, - Object? onSecondary = null, - Object? secondaryContainer = freezed, - Object? onSecondaryContainer = freezed, - Object? secondaryFixed = freezed, - Object? secondaryFixedDim = freezed, - Object? onSecondaryFixed = freezed, - Object? onSecondaryFixedVariant = freezed, - Object? tertiary = freezed, - Object? onTertiary = freezed, - Object? tertiaryContainer = freezed, - Object? onTertiaryContainer = freezed, - Object? tertiaryFixed = freezed, - Object? tertiaryFixedDim = freezed, - Object? onTertiaryFixed = freezed, - Object? onTertiaryFixedVariant = freezed, - Object? error = null, - Object? onError = null, - Object? errorContainer = freezed, - Object? onErrorContainer = freezed, - Object? surface = null, - Object? onSurface = null, - Object? surfaceDim = freezed, - Object? surfaceBright = freezed, - Object? surfaceContainerLowest = freezed, - Object? surfaceContainerLow = freezed, - Object? surfaceContainer = freezed, - Object? surfaceContainerHigh = freezed, - Object? surfaceContainerHighest = freezed, - Object? onSurfaceVariant = freezed, - Object? outline = freezed, - Object? outlineVariant = freezed, - Object? shadow = freezed, - Object? scrim = freezed, - Object? inverseSurface = freezed, - Object? onInverseSurface = freezed, - Object? inversePrimary = freezed, - Object? surfaceTint = freezed, - }) { - return _then(_self.copyWith( - brightness: null == brightness - ? _self.brightness - : brightness // ignore: cast_nullable_to_non_nullable - as Brightness, - primary: null == primary - ? _self.primary - : primary // ignore: cast_nullable_to_non_nullable - as String, - onPrimary: null == onPrimary - ? _self.onPrimary - : onPrimary // ignore: cast_nullable_to_non_nullable - as String, - primaryContainer: freezed == primaryContainer - ? _self.primaryContainer - : primaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - onPrimaryContainer: freezed == onPrimaryContainer - ? _self.onPrimaryContainer - : onPrimaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - primaryFixed: freezed == primaryFixed - ? _self.primaryFixed - : primaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - primaryFixedDim: freezed == primaryFixedDim - ? _self.primaryFixedDim - : primaryFixedDim // ignore: cast_nullable_to_non_nullable - as String?, - onPrimaryFixed: freezed == onPrimaryFixed - ? _self.onPrimaryFixed - : onPrimaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - onPrimaryFixedVariant: freezed == onPrimaryFixedVariant - ? _self.onPrimaryFixedVariant - : onPrimaryFixedVariant // ignore: cast_nullable_to_non_nullable - as String?, - secondary: null == secondary - ? _self.secondary - : secondary // ignore: cast_nullable_to_non_nullable - as String, - onSecondary: null == onSecondary - ? _self.onSecondary - : onSecondary // ignore: cast_nullable_to_non_nullable - as String, - secondaryContainer: freezed == secondaryContainer - ? _self.secondaryContainer - : secondaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - onSecondaryContainer: freezed == onSecondaryContainer - ? _self.onSecondaryContainer - : onSecondaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - secondaryFixed: freezed == secondaryFixed - ? _self.secondaryFixed - : secondaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - secondaryFixedDim: freezed == secondaryFixedDim - ? _self.secondaryFixedDim - : secondaryFixedDim // ignore: cast_nullable_to_non_nullable - as String?, - onSecondaryFixed: freezed == onSecondaryFixed - ? _self.onSecondaryFixed - : onSecondaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - onSecondaryFixedVariant: freezed == onSecondaryFixedVariant - ? _self.onSecondaryFixedVariant - : onSecondaryFixedVariant // ignore: cast_nullable_to_non_nullable - as String?, - tertiary: freezed == tertiary - ? _self.tertiary - : tertiary // ignore: cast_nullable_to_non_nullable - as String?, - onTertiary: freezed == onTertiary - ? _self.onTertiary - : onTertiary // ignore: cast_nullable_to_non_nullable - as String?, - tertiaryContainer: freezed == tertiaryContainer - ? _self.tertiaryContainer - : tertiaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - onTertiaryContainer: freezed == onTertiaryContainer - ? _self.onTertiaryContainer - : onTertiaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - tertiaryFixed: freezed == tertiaryFixed - ? _self.tertiaryFixed - : tertiaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - tertiaryFixedDim: freezed == tertiaryFixedDim - ? _self.tertiaryFixedDim - : tertiaryFixedDim // ignore: cast_nullable_to_non_nullable - as String?, - onTertiaryFixed: freezed == onTertiaryFixed - ? _self.onTertiaryFixed - : onTertiaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - onTertiaryFixedVariant: freezed == onTertiaryFixedVariant - ? _self.onTertiaryFixedVariant - : onTertiaryFixedVariant // ignore: cast_nullable_to_non_nullable - as String?, - error: null == error - ? _self.error - : error // ignore: cast_nullable_to_non_nullable - as String, - onError: null == onError - ? _self.onError - : onError // ignore: cast_nullable_to_non_nullable - as String, - errorContainer: freezed == errorContainer - ? _self.errorContainer - : errorContainer // ignore: cast_nullable_to_non_nullable - as String?, - onErrorContainer: freezed == onErrorContainer - ? _self.onErrorContainer - : onErrorContainer // ignore: cast_nullable_to_non_nullable - as String?, - surface: null == surface - ? _self.surface - : surface // ignore: cast_nullable_to_non_nullable - as String, - onSurface: null == onSurface - ? _self.onSurface - : onSurface // ignore: cast_nullable_to_non_nullable - as String, - surfaceDim: freezed == surfaceDim - ? _self.surfaceDim - : surfaceDim // ignore: cast_nullable_to_non_nullable - as String?, - surfaceBright: freezed == surfaceBright - ? _self.surfaceBright - : surfaceBright // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainerLowest: freezed == surfaceContainerLowest - ? _self.surfaceContainerLowest - : surfaceContainerLowest // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainerLow: freezed == surfaceContainerLow - ? _self.surfaceContainerLow - : surfaceContainerLow // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainer: freezed == surfaceContainer - ? _self.surfaceContainer - : surfaceContainer // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainerHigh: freezed == surfaceContainerHigh - ? _self.surfaceContainerHigh - : surfaceContainerHigh // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainerHighest: freezed == surfaceContainerHighest - ? _self.surfaceContainerHighest - : surfaceContainerHighest // ignore: cast_nullable_to_non_nullable - as String?, - onSurfaceVariant: freezed == onSurfaceVariant - ? _self.onSurfaceVariant - : onSurfaceVariant // ignore: cast_nullable_to_non_nullable - as String?, - outline: freezed == outline - ? _self.outline - : outline // ignore: cast_nullable_to_non_nullable - as String?, - outlineVariant: freezed == outlineVariant - ? _self.outlineVariant - : outlineVariant // ignore: cast_nullable_to_non_nullable - as String?, - shadow: freezed == shadow - ? _self.shadow - : shadow // ignore: cast_nullable_to_non_nullable - as String?, - scrim: freezed == scrim - ? _self.scrim - : scrim // ignore: cast_nullable_to_non_nullable - as String?, - inverseSurface: freezed == inverseSurface - ? _self.inverseSurface - : inverseSurface // ignore: cast_nullable_to_non_nullable - as String?, - onInverseSurface: freezed == onInverseSurface - ? _self.onInverseSurface - : onInverseSurface // ignore: cast_nullable_to_non_nullable - as String?, - inversePrimary: freezed == inversePrimary - ? _self.inversePrimary - : inversePrimary // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTint: freezed == surfaceTint - ? _self.surfaceTint - : surfaceTint // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacColorScheme]. -extension StacColorSchemePatterns on StacColorScheme { - /// 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(_StacColorScheme value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacColorScheme() 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(_StacColorScheme value) $default, - ) { - final _that = this; - switch (_that) { - case _StacColorScheme(): - 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(_StacColorScheme value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacColorScheme() 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( - Brightness brightness, - String primary, - String onPrimary, - String? primaryContainer, - String? onPrimaryContainer, - String? primaryFixed, - String? primaryFixedDim, - String? onPrimaryFixed, - String? onPrimaryFixedVariant, - String secondary, - String onSecondary, - String? secondaryContainer, - String? onSecondaryContainer, - String? secondaryFixed, - String? secondaryFixedDim, - String? onSecondaryFixed, - String? onSecondaryFixedVariant, - String? tertiary, - String? onTertiary, - String? tertiaryContainer, - String? onTertiaryContainer, - String? tertiaryFixed, - String? tertiaryFixedDim, - String? onTertiaryFixed, - String? onTertiaryFixedVariant, - String error, - String onError, - String? errorContainer, - String? onErrorContainer, - String surface, - String onSurface, - String? surfaceDim, - String? surfaceBright, - String? surfaceContainerLowest, - String? surfaceContainerLow, - String? surfaceContainer, - String? surfaceContainerHigh, - String? surfaceContainerHighest, - String? onSurfaceVariant, - String? outline, - String? outlineVariant, - String? shadow, - String? scrim, - String? inverseSurface, - String? onInverseSurface, - String? inversePrimary, - String? surfaceTint)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacColorScheme() when $default != null: - return $default( - _that.brightness, - _that.primary, - _that.onPrimary, - _that.primaryContainer, - _that.onPrimaryContainer, - _that.primaryFixed, - _that.primaryFixedDim, - _that.onPrimaryFixed, - _that.onPrimaryFixedVariant, - _that.secondary, - _that.onSecondary, - _that.secondaryContainer, - _that.onSecondaryContainer, - _that.secondaryFixed, - _that.secondaryFixedDim, - _that.onSecondaryFixed, - _that.onSecondaryFixedVariant, - _that.tertiary, - _that.onTertiary, - _that.tertiaryContainer, - _that.onTertiaryContainer, - _that.tertiaryFixed, - _that.tertiaryFixedDim, - _that.onTertiaryFixed, - _that.onTertiaryFixedVariant, - _that.error, - _that.onError, - _that.errorContainer, - _that.onErrorContainer, - _that.surface, - _that.onSurface, - _that.surfaceDim, - _that.surfaceBright, - _that.surfaceContainerLowest, - _that.surfaceContainerLow, - _that.surfaceContainer, - _that.surfaceContainerHigh, - _that.surfaceContainerHighest, - _that.onSurfaceVariant, - _that.outline, - _that.outlineVariant, - _that.shadow, - _that.scrim, - _that.inverseSurface, - _that.onInverseSurface, - _that.inversePrimary, - _that.surfaceTint); - 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( - Brightness brightness, - String primary, - String onPrimary, - String? primaryContainer, - String? onPrimaryContainer, - String? primaryFixed, - String? primaryFixedDim, - String? onPrimaryFixed, - String? onPrimaryFixedVariant, - String secondary, - String onSecondary, - String? secondaryContainer, - String? onSecondaryContainer, - String? secondaryFixed, - String? secondaryFixedDim, - String? onSecondaryFixed, - String? onSecondaryFixedVariant, - String? tertiary, - String? onTertiary, - String? tertiaryContainer, - String? onTertiaryContainer, - String? tertiaryFixed, - String? tertiaryFixedDim, - String? onTertiaryFixed, - String? onTertiaryFixedVariant, - String error, - String onError, - String? errorContainer, - String? onErrorContainer, - String surface, - String onSurface, - String? surfaceDim, - String? surfaceBright, - String? surfaceContainerLowest, - String? surfaceContainerLow, - String? surfaceContainer, - String? surfaceContainerHigh, - String? surfaceContainerHighest, - String? onSurfaceVariant, - String? outline, - String? outlineVariant, - String? shadow, - String? scrim, - String? inverseSurface, - String? onInverseSurface, - String? inversePrimary, - String? surfaceTint) - $default, - ) { - final _that = this; - switch (_that) { - case _StacColorScheme(): - return $default( - _that.brightness, - _that.primary, - _that.onPrimary, - _that.primaryContainer, - _that.onPrimaryContainer, - _that.primaryFixed, - _that.primaryFixedDim, - _that.onPrimaryFixed, - _that.onPrimaryFixedVariant, - _that.secondary, - _that.onSecondary, - _that.secondaryContainer, - _that.onSecondaryContainer, - _that.secondaryFixed, - _that.secondaryFixedDim, - _that.onSecondaryFixed, - _that.onSecondaryFixedVariant, - _that.tertiary, - _that.onTertiary, - _that.tertiaryContainer, - _that.onTertiaryContainer, - _that.tertiaryFixed, - _that.tertiaryFixedDim, - _that.onTertiaryFixed, - _that.onTertiaryFixedVariant, - _that.error, - _that.onError, - _that.errorContainer, - _that.onErrorContainer, - _that.surface, - _that.onSurface, - _that.surfaceDim, - _that.surfaceBright, - _that.surfaceContainerLowest, - _that.surfaceContainerLow, - _that.surfaceContainer, - _that.surfaceContainerHigh, - _that.surfaceContainerHighest, - _that.onSurfaceVariant, - _that.outline, - _that.outlineVariant, - _that.shadow, - _that.scrim, - _that.inverseSurface, - _that.onInverseSurface, - _that.inversePrimary, - _that.surfaceTint); - 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( - Brightness brightness, - String primary, - String onPrimary, - String? primaryContainer, - String? onPrimaryContainer, - String? primaryFixed, - String? primaryFixedDim, - String? onPrimaryFixed, - String? onPrimaryFixedVariant, - String secondary, - String onSecondary, - String? secondaryContainer, - String? onSecondaryContainer, - String? secondaryFixed, - String? secondaryFixedDim, - String? onSecondaryFixed, - String? onSecondaryFixedVariant, - String? tertiary, - String? onTertiary, - String? tertiaryContainer, - String? onTertiaryContainer, - String? tertiaryFixed, - String? tertiaryFixedDim, - String? onTertiaryFixed, - String? onTertiaryFixedVariant, - String error, - String onError, - String? errorContainer, - String? onErrorContainer, - String surface, - String onSurface, - String? surfaceDim, - String? surfaceBright, - String? surfaceContainerLowest, - String? surfaceContainerLow, - String? surfaceContainer, - String? surfaceContainerHigh, - String? surfaceContainerHighest, - String? onSurfaceVariant, - String? outline, - String? outlineVariant, - String? shadow, - String? scrim, - String? inverseSurface, - String? onInverseSurface, - String? inversePrimary, - String? surfaceTint)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacColorScheme() when $default != null: - return $default( - _that.brightness, - _that.primary, - _that.onPrimary, - _that.primaryContainer, - _that.onPrimaryContainer, - _that.primaryFixed, - _that.primaryFixedDim, - _that.onPrimaryFixed, - _that.onPrimaryFixedVariant, - _that.secondary, - _that.onSecondary, - _that.secondaryContainer, - _that.onSecondaryContainer, - _that.secondaryFixed, - _that.secondaryFixedDim, - _that.onSecondaryFixed, - _that.onSecondaryFixedVariant, - _that.tertiary, - _that.onTertiary, - _that.tertiaryContainer, - _that.onTertiaryContainer, - _that.tertiaryFixed, - _that.tertiaryFixedDim, - _that.onTertiaryFixed, - _that.onTertiaryFixedVariant, - _that.error, - _that.onError, - _that.errorContainer, - _that.onErrorContainer, - _that.surface, - _that.onSurface, - _that.surfaceDim, - _that.surfaceBright, - _that.surfaceContainerLowest, - _that.surfaceContainerLow, - _that.surfaceContainer, - _that.surfaceContainerHigh, - _that.surfaceContainerHighest, - _that.onSurfaceVariant, - _that.outline, - _that.outlineVariant, - _that.shadow, - _that.scrim, - _that.inverseSurface, - _that.onInverseSurface, - _that.inversePrimary, - _that.surfaceTint); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacColorScheme implements StacColorScheme { - const _StacColorScheme( - {required this.brightness, - required this.primary, - required this.onPrimary, - this.primaryContainer, - this.onPrimaryContainer, - this.primaryFixed, - this.primaryFixedDim, - this.onPrimaryFixed, - this.onPrimaryFixedVariant, - required this.secondary, - required this.onSecondary, - this.secondaryContainer, - this.onSecondaryContainer, - this.secondaryFixed, - this.secondaryFixedDim, - this.onSecondaryFixed, - this.onSecondaryFixedVariant, - this.tertiary, - this.onTertiary, - this.tertiaryContainer, - this.onTertiaryContainer, - this.tertiaryFixed, - this.tertiaryFixedDim, - this.onTertiaryFixed, - this.onTertiaryFixedVariant, - required this.error, - required this.onError, - this.errorContainer, - this.onErrorContainer, - required this.surface, - required this.onSurface, - this.surfaceDim, - this.surfaceBright, - this.surfaceContainerLowest, - this.surfaceContainerLow, - this.surfaceContainer, - this.surfaceContainerHigh, - this.surfaceContainerHighest, - this.onSurfaceVariant, - this.outline, - this.outlineVariant, - this.shadow, - this.scrim, - this.inverseSurface, - this.onInverseSurface, - this.inversePrimary, - this.surfaceTint}); - factory _StacColorScheme.fromJson(Map json) => - _$StacColorSchemeFromJson(json); - - @override - final Brightness brightness; - @override - final String primary; - @override - final String onPrimary; - @override - final String? primaryContainer; - @override - final String? onPrimaryContainer; - @override - final String? primaryFixed; - @override - final String? primaryFixedDim; - @override - final String? onPrimaryFixed; - @override - final String? onPrimaryFixedVariant; - @override - final String secondary; - @override - final String onSecondary; - @override - final String? secondaryContainer; - @override - final String? onSecondaryContainer; - @override - final String? secondaryFixed; - @override - final String? secondaryFixedDim; - @override - final String? onSecondaryFixed; - @override - final String? onSecondaryFixedVariant; - @override - final String? tertiary; - @override - final String? onTertiary; - @override - final String? tertiaryContainer; - @override - final String? onTertiaryContainer; - @override - final String? tertiaryFixed; - @override - final String? tertiaryFixedDim; - @override - final String? onTertiaryFixed; - @override - final String? onTertiaryFixedVariant; - @override - final String error; - @override - final String onError; - @override - final String? errorContainer; - @override - final String? onErrorContainer; - @override - final String surface; - @override - final String onSurface; - @override - final String? surfaceDim; - @override - final String? surfaceBright; - @override - final String? surfaceContainerLowest; - @override - final String? surfaceContainerLow; - @override - final String? surfaceContainer; - @override - final String? surfaceContainerHigh; - @override - final String? surfaceContainerHighest; - @override - final String? onSurfaceVariant; - @override - final String? outline; - @override - final String? outlineVariant; - @override - final String? shadow; - @override - final String? scrim; - @override - final String? inverseSurface; - @override - final String? onInverseSurface; - @override - final String? inversePrimary; - @override - final String? surfaceTint; - - /// Create a copy of StacColorScheme - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacColorSchemeCopyWith<_StacColorScheme> get copyWith => - __$StacColorSchemeCopyWithImpl<_StacColorScheme>(this, _$identity); - - @override - Map toJson() { - return _$StacColorSchemeToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacColorScheme && - (identical(other.brightness, brightness) || - other.brightness == brightness) && - (identical(other.primary, primary) || other.primary == primary) && - (identical(other.onPrimary, onPrimary) || - other.onPrimary == onPrimary) && - (identical(other.primaryContainer, primaryContainer) || - other.primaryContainer == primaryContainer) && - (identical(other.onPrimaryContainer, onPrimaryContainer) || - other.onPrimaryContainer == onPrimaryContainer) && - (identical(other.primaryFixed, primaryFixed) || - other.primaryFixed == primaryFixed) && - (identical(other.primaryFixedDim, primaryFixedDim) || - other.primaryFixedDim == primaryFixedDim) && - (identical(other.onPrimaryFixed, onPrimaryFixed) || - other.onPrimaryFixed == onPrimaryFixed) && - (identical(other.onPrimaryFixedVariant, onPrimaryFixedVariant) || - other.onPrimaryFixedVariant == onPrimaryFixedVariant) && - (identical(other.secondary, secondary) || - other.secondary == secondary) && - (identical(other.onSecondary, onSecondary) || - other.onSecondary == onSecondary) && - (identical(other.secondaryContainer, secondaryContainer) || - other.secondaryContainer == secondaryContainer) && - (identical(other.onSecondaryContainer, onSecondaryContainer) || - other.onSecondaryContainer == onSecondaryContainer) && - (identical(other.secondaryFixed, secondaryFixed) || - other.secondaryFixed == secondaryFixed) && - (identical(other.secondaryFixedDim, secondaryFixedDim) || - other.secondaryFixedDim == secondaryFixedDim) && - (identical(other.onSecondaryFixed, onSecondaryFixed) || - other.onSecondaryFixed == onSecondaryFixed) && - (identical(other.onSecondaryFixedVariant, onSecondaryFixedVariant) || - other.onSecondaryFixedVariant == onSecondaryFixedVariant) && - (identical(other.tertiary, tertiary) || - other.tertiary == tertiary) && - (identical(other.onTertiary, onTertiary) || - other.onTertiary == onTertiary) && - (identical(other.tertiaryContainer, tertiaryContainer) || - other.tertiaryContainer == tertiaryContainer) && - (identical(other.onTertiaryContainer, onTertiaryContainer) || - other.onTertiaryContainer == onTertiaryContainer) && - (identical(other.tertiaryFixed, tertiaryFixed) || - other.tertiaryFixed == tertiaryFixed) && - (identical(other.tertiaryFixedDim, tertiaryFixedDim) || - other.tertiaryFixedDim == tertiaryFixedDim) && - (identical(other.onTertiaryFixed, onTertiaryFixed) || - other.onTertiaryFixed == onTertiaryFixed) && - (identical(other.onTertiaryFixedVariant, onTertiaryFixedVariant) || - other.onTertiaryFixedVariant == onTertiaryFixedVariant) && - (identical(other.error, error) || other.error == error) && - (identical(other.onError, onError) || other.onError == onError) && - (identical(other.errorContainer, errorContainer) || - other.errorContainer == errorContainer) && - (identical(other.onErrorContainer, onErrorContainer) || - other.onErrorContainer == onErrorContainer) && - (identical(other.surface, surface) || other.surface == surface) && - (identical(other.onSurface, onSurface) || - other.onSurface == onSurface) && - (identical(other.surfaceDim, surfaceDim) || - other.surfaceDim == surfaceDim) && - (identical(other.surfaceBright, surfaceBright) || - other.surfaceBright == surfaceBright) && - (identical(other.surfaceContainerLowest, surfaceContainerLowest) || - other.surfaceContainerLowest == surfaceContainerLowest) && - (identical(other.surfaceContainerLow, surfaceContainerLow) || - other.surfaceContainerLow == surfaceContainerLow) && - (identical(other.surfaceContainer, surfaceContainer) || - other.surfaceContainer == surfaceContainer) && - (identical(other.surfaceContainerHigh, surfaceContainerHigh) || - other.surfaceContainerHigh == surfaceContainerHigh) && - (identical(other.surfaceContainerHighest, surfaceContainerHighest) || - other.surfaceContainerHighest == surfaceContainerHighest) && - (identical(other.onSurfaceVariant, onSurfaceVariant) || - other.onSurfaceVariant == onSurfaceVariant) && - (identical(other.outline, outline) || other.outline == outline) && - (identical(other.outlineVariant, outlineVariant) || - other.outlineVariant == outlineVariant) && - (identical(other.shadow, shadow) || other.shadow == shadow) && - (identical(other.scrim, scrim) || other.scrim == scrim) && - (identical(other.inverseSurface, inverseSurface) || - other.inverseSurface == inverseSurface) && - (identical(other.onInverseSurface, onInverseSurface) || other.onInverseSurface == onInverseSurface) && - (identical(other.inversePrimary, inversePrimary) || other.inversePrimary == inversePrimary) && - (identical(other.surfaceTint, surfaceTint) || other.surfaceTint == surfaceTint)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - brightness, - primary, - onPrimary, - primaryContainer, - onPrimaryContainer, - primaryFixed, - primaryFixedDim, - onPrimaryFixed, - onPrimaryFixedVariant, - secondary, - onSecondary, - secondaryContainer, - onSecondaryContainer, - secondaryFixed, - secondaryFixedDim, - onSecondaryFixed, - onSecondaryFixedVariant, - tertiary, - onTertiary, - tertiaryContainer, - onTertiaryContainer, - tertiaryFixed, - tertiaryFixedDim, - onTertiaryFixed, - onTertiaryFixedVariant, - error, - onError, - errorContainer, - onErrorContainer, - surface, - onSurface, - surfaceDim, - surfaceBright, - surfaceContainerLowest, - surfaceContainerLow, - surfaceContainer, - surfaceContainerHigh, - surfaceContainerHighest, - onSurfaceVariant, - outline, - outlineVariant, - shadow, - scrim, - inverseSurface, - onInverseSurface, - inversePrimary, - surfaceTint - ]); - - @override - String toString() { - return 'StacColorScheme(brightness: $brightness, primary: $primary, onPrimary: $onPrimary, primaryContainer: $primaryContainer, onPrimaryContainer: $onPrimaryContainer, primaryFixed: $primaryFixed, primaryFixedDim: $primaryFixedDim, onPrimaryFixed: $onPrimaryFixed, onPrimaryFixedVariant: $onPrimaryFixedVariant, secondary: $secondary, onSecondary: $onSecondary, secondaryContainer: $secondaryContainer, onSecondaryContainer: $onSecondaryContainer, secondaryFixed: $secondaryFixed, secondaryFixedDim: $secondaryFixedDim, onSecondaryFixed: $onSecondaryFixed, onSecondaryFixedVariant: $onSecondaryFixedVariant, tertiary: $tertiary, onTertiary: $onTertiary, tertiaryContainer: $tertiaryContainer, onTertiaryContainer: $onTertiaryContainer, tertiaryFixed: $tertiaryFixed, tertiaryFixedDim: $tertiaryFixedDim, onTertiaryFixed: $onTertiaryFixed, onTertiaryFixedVariant: $onTertiaryFixedVariant, error: $error, onError: $onError, errorContainer: $errorContainer, onErrorContainer: $onErrorContainer, surface: $surface, onSurface: $onSurface, surfaceDim: $surfaceDim, surfaceBright: $surfaceBright, surfaceContainerLowest: $surfaceContainerLowest, surfaceContainerLow: $surfaceContainerLow, surfaceContainer: $surfaceContainer, surfaceContainerHigh: $surfaceContainerHigh, surfaceContainerHighest: $surfaceContainerHighest, onSurfaceVariant: $onSurfaceVariant, outline: $outline, outlineVariant: $outlineVariant, shadow: $shadow, scrim: $scrim, inverseSurface: $inverseSurface, onInverseSurface: $onInverseSurface, inversePrimary: $inversePrimary, surfaceTint: $surfaceTint)'; - } -} - -/// @nodoc -abstract mixin class _$StacColorSchemeCopyWith<$Res> - implements $StacColorSchemeCopyWith<$Res> { - factory _$StacColorSchemeCopyWith( - _StacColorScheme value, $Res Function(_StacColorScheme) _then) = - __$StacColorSchemeCopyWithImpl; - @override - @useResult - $Res call( - {Brightness brightness, - String primary, - String onPrimary, - String? primaryContainer, - String? onPrimaryContainer, - String? primaryFixed, - String? primaryFixedDim, - String? onPrimaryFixed, - String? onPrimaryFixedVariant, - String secondary, - String onSecondary, - String? secondaryContainer, - String? onSecondaryContainer, - String? secondaryFixed, - String? secondaryFixedDim, - String? onSecondaryFixed, - String? onSecondaryFixedVariant, - String? tertiary, - String? onTertiary, - String? tertiaryContainer, - String? onTertiaryContainer, - String? tertiaryFixed, - String? tertiaryFixedDim, - String? onTertiaryFixed, - String? onTertiaryFixedVariant, - String error, - String onError, - String? errorContainer, - String? onErrorContainer, - String surface, - String onSurface, - String? surfaceDim, - String? surfaceBright, - String? surfaceContainerLowest, - String? surfaceContainerLow, - String? surfaceContainer, - String? surfaceContainerHigh, - String? surfaceContainerHighest, - String? onSurfaceVariant, - String? outline, - String? outlineVariant, - String? shadow, - String? scrim, - String? inverseSurface, - String? onInverseSurface, - String? inversePrimary, - String? surfaceTint}); -} - -/// @nodoc -class __$StacColorSchemeCopyWithImpl<$Res> - implements _$StacColorSchemeCopyWith<$Res> { - __$StacColorSchemeCopyWithImpl(this._self, this._then); - - final _StacColorScheme _self; - final $Res Function(_StacColorScheme) _then; - - /// Create a copy of StacColorScheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? brightness = null, - Object? primary = null, - Object? onPrimary = null, - Object? primaryContainer = freezed, - Object? onPrimaryContainer = freezed, - Object? primaryFixed = freezed, - Object? primaryFixedDim = freezed, - Object? onPrimaryFixed = freezed, - Object? onPrimaryFixedVariant = freezed, - Object? secondary = null, - Object? onSecondary = null, - Object? secondaryContainer = freezed, - Object? onSecondaryContainer = freezed, - Object? secondaryFixed = freezed, - Object? secondaryFixedDim = freezed, - Object? onSecondaryFixed = freezed, - Object? onSecondaryFixedVariant = freezed, - Object? tertiary = freezed, - Object? onTertiary = freezed, - Object? tertiaryContainer = freezed, - Object? onTertiaryContainer = freezed, - Object? tertiaryFixed = freezed, - Object? tertiaryFixedDim = freezed, - Object? onTertiaryFixed = freezed, - Object? onTertiaryFixedVariant = freezed, - Object? error = null, - Object? onError = null, - Object? errorContainer = freezed, - Object? onErrorContainer = freezed, - Object? surface = null, - Object? onSurface = null, - Object? surfaceDim = freezed, - Object? surfaceBright = freezed, - Object? surfaceContainerLowest = freezed, - Object? surfaceContainerLow = freezed, - Object? surfaceContainer = freezed, - Object? surfaceContainerHigh = freezed, - Object? surfaceContainerHighest = freezed, - Object? onSurfaceVariant = freezed, - Object? outline = freezed, - Object? outlineVariant = freezed, - Object? shadow = freezed, - Object? scrim = freezed, - Object? inverseSurface = freezed, - Object? onInverseSurface = freezed, - Object? inversePrimary = freezed, - Object? surfaceTint = freezed, - }) { - return _then(_StacColorScheme( - brightness: null == brightness - ? _self.brightness - : brightness // ignore: cast_nullable_to_non_nullable - as Brightness, - primary: null == primary - ? _self.primary - : primary // ignore: cast_nullable_to_non_nullable - as String, - onPrimary: null == onPrimary - ? _self.onPrimary - : onPrimary // ignore: cast_nullable_to_non_nullable - as String, - primaryContainer: freezed == primaryContainer - ? _self.primaryContainer - : primaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - onPrimaryContainer: freezed == onPrimaryContainer - ? _self.onPrimaryContainer - : onPrimaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - primaryFixed: freezed == primaryFixed - ? _self.primaryFixed - : primaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - primaryFixedDim: freezed == primaryFixedDim - ? _self.primaryFixedDim - : primaryFixedDim // ignore: cast_nullable_to_non_nullable - as String?, - onPrimaryFixed: freezed == onPrimaryFixed - ? _self.onPrimaryFixed - : onPrimaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - onPrimaryFixedVariant: freezed == onPrimaryFixedVariant - ? _self.onPrimaryFixedVariant - : onPrimaryFixedVariant // ignore: cast_nullable_to_non_nullable - as String?, - secondary: null == secondary - ? _self.secondary - : secondary // ignore: cast_nullable_to_non_nullable - as String, - onSecondary: null == onSecondary - ? _self.onSecondary - : onSecondary // ignore: cast_nullable_to_non_nullable - as String, - secondaryContainer: freezed == secondaryContainer - ? _self.secondaryContainer - : secondaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - onSecondaryContainer: freezed == onSecondaryContainer - ? _self.onSecondaryContainer - : onSecondaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - secondaryFixed: freezed == secondaryFixed - ? _self.secondaryFixed - : secondaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - secondaryFixedDim: freezed == secondaryFixedDim - ? _self.secondaryFixedDim - : secondaryFixedDim // ignore: cast_nullable_to_non_nullable - as String?, - onSecondaryFixed: freezed == onSecondaryFixed - ? _self.onSecondaryFixed - : onSecondaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - onSecondaryFixedVariant: freezed == onSecondaryFixedVariant - ? _self.onSecondaryFixedVariant - : onSecondaryFixedVariant // ignore: cast_nullable_to_non_nullable - as String?, - tertiary: freezed == tertiary - ? _self.tertiary - : tertiary // ignore: cast_nullable_to_non_nullable - as String?, - onTertiary: freezed == onTertiary - ? _self.onTertiary - : onTertiary // ignore: cast_nullable_to_non_nullable - as String?, - tertiaryContainer: freezed == tertiaryContainer - ? _self.tertiaryContainer - : tertiaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - onTertiaryContainer: freezed == onTertiaryContainer - ? _self.onTertiaryContainer - : onTertiaryContainer // ignore: cast_nullable_to_non_nullable - as String?, - tertiaryFixed: freezed == tertiaryFixed - ? _self.tertiaryFixed - : tertiaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - tertiaryFixedDim: freezed == tertiaryFixedDim - ? _self.tertiaryFixedDim - : tertiaryFixedDim // ignore: cast_nullable_to_non_nullable - as String?, - onTertiaryFixed: freezed == onTertiaryFixed - ? _self.onTertiaryFixed - : onTertiaryFixed // ignore: cast_nullable_to_non_nullable - as String?, - onTertiaryFixedVariant: freezed == onTertiaryFixedVariant - ? _self.onTertiaryFixedVariant - : onTertiaryFixedVariant // ignore: cast_nullable_to_non_nullable - as String?, - error: null == error - ? _self.error - : error // ignore: cast_nullable_to_non_nullable - as String, - onError: null == onError - ? _self.onError - : onError // ignore: cast_nullable_to_non_nullable - as String, - errorContainer: freezed == errorContainer - ? _self.errorContainer - : errorContainer // ignore: cast_nullable_to_non_nullable - as String?, - onErrorContainer: freezed == onErrorContainer - ? _self.onErrorContainer - : onErrorContainer // ignore: cast_nullable_to_non_nullable - as String?, - surface: null == surface - ? _self.surface - : surface // ignore: cast_nullable_to_non_nullable - as String, - onSurface: null == onSurface - ? _self.onSurface - : onSurface // ignore: cast_nullable_to_non_nullable - as String, - surfaceDim: freezed == surfaceDim - ? _self.surfaceDim - : surfaceDim // ignore: cast_nullable_to_non_nullable - as String?, - surfaceBright: freezed == surfaceBright - ? _self.surfaceBright - : surfaceBright // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainerLowest: freezed == surfaceContainerLowest - ? _self.surfaceContainerLowest - : surfaceContainerLowest // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainerLow: freezed == surfaceContainerLow - ? _self.surfaceContainerLow - : surfaceContainerLow // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainer: freezed == surfaceContainer - ? _self.surfaceContainer - : surfaceContainer // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainerHigh: freezed == surfaceContainerHigh - ? _self.surfaceContainerHigh - : surfaceContainerHigh // ignore: cast_nullable_to_non_nullable - as String?, - surfaceContainerHighest: freezed == surfaceContainerHighest - ? _self.surfaceContainerHighest - : surfaceContainerHighest // ignore: cast_nullable_to_non_nullable - as String?, - onSurfaceVariant: freezed == onSurfaceVariant - ? _self.onSurfaceVariant - : onSurfaceVariant // ignore: cast_nullable_to_non_nullable - as String?, - outline: freezed == outline - ? _self.outline - : outline // ignore: cast_nullable_to_non_nullable - as String?, - outlineVariant: freezed == outlineVariant - ? _self.outlineVariant - : outlineVariant // ignore: cast_nullable_to_non_nullable - as String?, - shadow: freezed == shadow - ? _self.shadow - : shadow // ignore: cast_nullable_to_non_nullable - as String?, - scrim: freezed == scrim - ? _self.scrim - : scrim // ignore: cast_nullable_to_non_nullable - as String?, - inverseSurface: freezed == inverseSurface - ? _self.inverseSurface - : inverseSurface // ignore: cast_nullable_to_non_nullable - as String?, - onInverseSurface: freezed == onInverseSurface - ? _self.onInverseSurface - : onInverseSurface // ignore: cast_nullable_to_non_nullable - as String?, - inversePrimary: freezed == inversePrimary - ? _self.inversePrimary - : inversePrimary // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTint: freezed == surfaceTint - ? _self.surfaceTint - : surfaceTint // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_color_scheme_parser.dart b/packages/stac/lib/src/parsers/theme/stac_color_scheme_parser.dart new file mode 100644 index 000000000..059466cc7 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_color_scheme_parser.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/colors/stac_brightness_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacColorScheme]. +/// +/// Converts [StacColorScheme] to Flutter's [ColorScheme]. +extension StacColorSchemeParser on StacColorScheme { + ColorScheme parse(BuildContext context) { + return ColorScheme( + brightness: brightness.parse, + primary: primary.toColor(context)!, + onPrimary: onPrimary.toColor(context)!, + primaryContainer: primaryContainer?.toColor(context), + onPrimaryContainer: onPrimaryContainer?.toColor(context), + primaryFixed: primaryFixed?.toColor(context), + primaryFixedDim: primaryFixedDim?.toColor(context), + onPrimaryFixed: onPrimaryFixed?.toColor(context), + onPrimaryFixedVariant: onPrimaryFixedVariant?.toColor(context), + secondary: secondary.toColor(context)!, + onSecondary: onSecondary.toColor(context)!, + secondaryContainer: secondaryContainer?.toColor(context), + onSecondaryContainer: onSecondaryContainer?.toColor(context), + secondaryFixed: secondaryFixed?.toColor(context), + secondaryFixedDim: secondaryFixedDim?.toColor(context), + onSecondaryFixed: onSecondaryFixed?.toColor(context), + onSecondaryFixedVariant: onSecondaryFixedVariant?.toColor(context), + tertiary: tertiary?.toColor(context), + onTertiary: onTertiary?.toColor(context), + tertiaryContainer: tertiaryContainer?.toColor(context), + onTertiaryContainer: onTertiaryContainer?.toColor(context), + tertiaryFixed: tertiaryFixed?.toColor(context), + tertiaryFixedDim: tertiaryFixedDim?.toColor(context), + onTertiaryFixed: onTertiaryFixed?.toColor(context), + onTertiaryFixedVariant: onTertiaryFixedVariant?.toColor(context), + error: error.toColor(context)!, + onError: onError.toColor(context)!, + errorContainer: errorContainer?.toColor(context), + onErrorContainer: onErrorContainer?.toColor(context), + surface: surface.toColor(context)!, + onSurface: onSurface.toColor(context)!, + surfaceDim: surfaceDim?.toColor(context), + surfaceBright: surfaceBright?.toColor(context), + surfaceContainerLowest: surfaceContainerLowest?.toColor(context), + surfaceContainerLow: surfaceContainerLow?.toColor(context), + surfaceContainer: surfaceContainer?.toColor(context), + surfaceContainerHigh: surfaceContainerHigh?.toColor(context), + surfaceContainerHighest: surfaceContainerHighest?.toColor(context), + onSurfaceVariant: onSurfaceVariant?.toColor(context), + outline: outline?.toColor(context), + outlineVariant: outlineVariant?.toColor(context), + shadow: shadow?.toColor(context), + scrim: scrim?.toColor(context), + inverseSurface: inverseSurface?.toColor(context), + onInverseSurface: onInverseSurface?.toColor(context), + inversePrimary: inversePrimary?.toColor(context), + surfaceTint: surfaceTint?.toColor(context), + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart deleted file mode 100644 index 099af27c0..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_border_side_parser.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_shape_border_parser.dart'; -import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; -import 'package:stac/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_date_picker_theme_data.freezed.dart'; -part 'stac_date_picker_theme_data.g.dart'; - -@freezed -abstract class StacDatePickerThemeData with _$StacDatePickerThemeData { - const factory StacDatePickerThemeData({ - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - String? headerBackgroundColor, - String? headerForegroundColor, - StacTextStyle? headerHeadlineStyle, - StacTextStyle? headerHelpStyle, - StacTextStyle? weekdayStyle, - StacTextStyle? dayStyle, - String? dayForegroundColor, - String? dayBackgroundColor, - String? dayOverlayColor, - StacShapeBorder? dayShape, - String? todayForegroundColor, - String? todayBackgroundColor, - StacBorderSide? todayBorder, - StacTextStyle? yearStyle, - String? yearForegroundColor, - String? yearBackgroundColor, - String? yearOverlayColor, - String? rangePickerBackgroundColor, - double? rangePickerElevation, - String? rangePickerShadowColor, - String? rangePickerSurfaceTintColor, - StacShapeBorder? rangePickerShape, - String? rangePickerHeaderBackgroundColor, - String? rangePickerHeaderForegroundColor, - StacTextStyle? rangePickerHeaderHeadlineStyle, - StacTextStyle? rangePickerHeaderHelpStyle, - String? rangeSelectionBackgroundColor, - String? rangeSelectionOverlayColor, - String? dividerColor, - StacInputDecorationTheme? inputDecorationTheme, - StacButtonStyle? cancelButtonStyle, - StacButtonStyle? confirmButtonStyle, - }) = _StacDatePickerThemeData; - - factory StacDatePickerThemeData.fromJson(Map json) => - _$StacDatePickerThemeDataFromJson(json); -} - -extension StacDatePickerThemeDataParser on StacDatePickerThemeData { - DatePickerThemeData parse(BuildContext context) { - return DatePickerThemeData( - backgroundColor: backgroundColor?.toColor(context), - elevation: elevation, - shadowColor: shadowColor?.toColor(context), - surfaceTintColor: surfaceTintColor?.toColor(context), - shape: shape?.parse(context), - headerBackgroundColor: headerBackgroundColor?.toColor(context), - headerForegroundColor: headerForegroundColor?.toColor(context), - headerHeadlineStyle: headerHeadlineStyle?.parse(context), - headerHelpStyle: headerHelpStyle?.parse(context), - weekdayStyle: weekdayStyle?.parse(context), - dayStyle: dayStyle?.parse(context), - dayForegroundColor: - WidgetStatePropertyAll(dayForegroundColor?.toColor(context)), - dayBackgroundColor: - WidgetStatePropertyAll(dayBackgroundColor?.toColor(context)), - dayOverlayColor: - WidgetStatePropertyAll(dayOverlayColor?.toColor(context)), - dayShape: - WidgetStatePropertyAll(dayShape?.parse(context) as OutlinedBorder), - todayForegroundColor: - WidgetStatePropertyAll(todayForegroundColor?.toColor(context)), - todayBackgroundColor: - WidgetStatePropertyAll(todayBackgroundColor?.toColor(context)), - todayBorder: todayBorder?.parse(context), - yearStyle: yearStyle?.parse(context), - yearForegroundColor: - WidgetStatePropertyAll(yearForegroundColor?.toColor(context)), - yearBackgroundColor: - WidgetStatePropertyAll(yearBackgroundColor?.toColor(context)), - yearOverlayColor: - WidgetStatePropertyAll(yearOverlayColor?.toColor(context)), - rangePickerBackgroundColor: rangePickerBackgroundColor?.toColor(context), - rangePickerElevation: rangePickerElevation, - rangePickerShadowColor: rangePickerShadowColor?.toColor(context), - rangePickerSurfaceTintColor: - rangePickerSurfaceTintColor?.toColor(context), - rangePickerShape: rangePickerShape?.parse(context), - rangePickerHeaderBackgroundColor: - rangePickerHeaderBackgroundColor?.toColor(context), - rangePickerHeaderForegroundColor: - rangePickerHeaderForegroundColor?.toColor(context), - rangePickerHeaderHeadlineStyle: - rangePickerHeaderHeadlineStyle?.parse(context), - rangePickerHeaderHelpStyle: rangePickerHeaderHelpStyle?.parse(context), - rangeSelectionBackgroundColor: - rangeSelectionBackgroundColor?.toColor(context), - rangeSelectionOverlayColor: - WidgetStatePropertyAll(rangeSelectionOverlayColor?.toColor(context)), - dividerColor: dividerColor?.toColor(context), - inputDecorationTheme: inputDecorationTheme?.parse(context), - cancelButtonStyle: cancelButtonStyle?.parseTextButton(context), - confirmButtonStyle: confirmButtonStyle?.parseTextButton(context), - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart deleted file mode 100644 index 91545d5e9..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart +++ /dev/null @@ -1,1355 +0,0 @@ -// 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 - -part of 'stac_date_picker_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacDatePickerThemeData { - String? get backgroundColor; - double? get elevation; - String? get shadowColor; - String? get surfaceTintColor; - StacShapeBorder? get shape; - String? get headerBackgroundColor; - String? get headerForegroundColor; - StacTextStyle? get headerHeadlineStyle; - StacTextStyle? get headerHelpStyle; - StacTextStyle? get weekdayStyle; - StacTextStyle? get dayStyle; - String? get dayForegroundColor; - String? get dayBackgroundColor; - String? get dayOverlayColor; - StacShapeBorder? get dayShape; - String? get todayForegroundColor; - String? get todayBackgroundColor; - StacBorderSide? get todayBorder; - StacTextStyle? get yearStyle; - String? get yearForegroundColor; - String? get yearBackgroundColor; - String? get yearOverlayColor; - String? get rangePickerBackgroundColor; - double? get rangePickerElevation; - String? get rangePickerShadowColor; - String? get rangePickerSurfaceTintColor; - StacShapeBorder? get rangePickerShape; - String? get rangePickerHeaderBackgroundColor; - String? get rangePickerHeaderForegroundColor; - StacTextStyle? get rangePickerHeaderHeadlineStyle; - StacTextStyle? get rangePickerHeaderHelpStyle; - String? get rangeSelectionBackgroundColor; - String? get rangeSelectionOverlayColor; - String? get dividerColor; - StacInputDecorationTheme? get inputDecorationTheme; - StacButtonStyle? get cancelButtonStyle; - StacButtonStyle? get confirmButtonStyle; - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacDatePickerThemeDataCopyWith get copyWith => - _$StacDatePickerThemeDataCopyWithImpl( - this as StacDatePickerThemeData, _$identity); - - /// Serializes this StacDatePickerThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacDatePickerThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.headerBackgroundColor, headerBackgroundColor) || - other.headerBackgroundColor == headerBackgroundColor) && - (identical(other.headerForegroundColor, headerForegroundColor) || - other.headerForegroundColor == headerForegroundColor) && - (identical(other.headerHeadlineStyle, headerHeadlineStyle) || - other.headerHeadlineStyle == headerHeadlineStyle) && - (identical(other.headerHelpStyle, headerHelpStyle) || - other.headerHelpStyle == headerHelpStyle) && - (identical(other.weekdayStyle, weekdayStyle) || - other.weekdayStyle == weekdayStyle) && - (identical(other.dayStyle, dayStyle) || - other.dayStyle == dayStyle) && - (identical(other.dayForegroundColor, dayForegroundColor) || - other.dayForegroundColor == dayForegroundColor) && - (identical(other.dayBackgroundColor, dayBackgroundColor) || - other.dayBackgroundColor == dayBackgroundColor) && - (identical(other.dayOverlayColor, dayOverlayColor) || - other.dayOverlayColor == dayOverlayColor) && - (identical(other.dayShape, dayShape) || - other.dayShape == dayShape) && - (identical(other.todayForegroundColor, todayForegroundColor) || - other.todayForegroundColor == todayForegroundColor) && - (identical(other.todayBackgroundColor, todayBackgroundColor) || - other.todayBackgroundColor == todayBackgroundColor) && - (identical(other.todayBorder, todayBorder) || - other.todayBorder == todayBorder) && - (identical(other.yearStyle, yearStyle) || - other.yearStyle == yearStyle) && - (identical(other.yearForegroundColor, yearForegroundColor) || - other.yearForegroundColor == yearForegroundColor) && - (identical(other.yearBackgroundColor, yearBackgroundColor) || - other.yearBackgroundColor == yearBackgroundColor) && - (identical(other.yearOverlayColor, yearOverlayColor) || - other.yearOverlayColor == yearOverlayColor) && - (identical(other.rangePickerBackgroundColor, rangePickerBackgroundColor) || - other.rangePickerBackgroundColor == - rangePickerBackgroundColor) && - (identical(other.rangePickerElevation, rangePickerElevation) || - other.rangePickerElevation == rangePickerElevation) && - (identical(other.rangePickerShadowColor, rangePickerShadowColor) || - other.rangePickerShadowColor == rangePickerShadowColor) && - (identical(other.rangePickerSurfaceTintColor, rangePickerSurfaceTintColor) || - other.rangePickerSurfaceTintColor == - rangePickerSurfaceTintColor) && - (identical(other.rangePickerShape, rangePickerShape) || - other.rangePickerShape == rangePickerShape) && - (identical(other.rangePickerHeaderBackgroundColor, rangePickerHeaderBackgroundColor) || - other.rangePickerHeaderBackgroundColor == - rangePickerHeaderBackgroundColor) && - (identical(other.rangePickerHeaderForegroundColor, rangePickerHeaderForegroundColor) || - other.rangePickerHeaderForegroundColor == - rangePickerHeaderForegroundColor) && - (identical(other.rangePickerHeaderHeadlineStyle, rangePickerHeaderHeadlineStyle) || - other.rangePickerHeaderHeadlineStyle == - rangePickerHeaderHeadlineStyle) && - (identical(other.rangePickerHeaderHelpStyle, rangePickerHeaderHelpStyle) || - other.rangePickerHeaderHelpStyle == - rangePickerHeaderHelpStyle) && - (identical(other.rangeSelectionBackgroundColor, rangeSelectionBackgroundColor) || - other.rangeSelectionBackgroundColor == - rangeSelectionBackgroundColor) && - (identical(other.rangeSelectionOverlayColor, rangeSelectionOverlayColor) || - other.rangeSelectionOverlayColor == - rangeSelectionOverlayColor) && - (identical(other.dividerColor, dividerColor) || other.dividerColor == dividerColor) && - (identical(other.inputDecorationTheme, inputDecorationTheme) || other.inputDecorationTheme == inputDecorationTheme) && - (identical(other.cancelButtonStyle, cancelButtonStyle) || other.cancelButtonStyle == cancelButtonStyle) && - (identical(other.confirmButtonStyle, confirmButtonStyle) || other.confirmButtonStyle == confirmButtonStyle)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - backgroundColor, - elevation, - shadowColor, - surfaceTintColor, - shape, - headerBackgroundColor, - headerForegroundColor, - headerHeadlineStyle, - headerHelpStyle, - weekdayStyle, - dayStyle, - dayForegroundColor, - dayBackgroundColor, - dayOverlayColor, - dayShape, - todayForegroundColor, - todayBackgroundColor, - todayBorder, - yearStyle, - yearForegroundColor, - yearBackgroundColor, - yearOverlayColor, - rangePickerBackgroundColor, - rangePickerElevation, - rangePickerShadowColor, - rangePickerSurfaceTintColor, - rangePickerShape, - rangePickerHeaderBackgroundColor, - rangePickerHeaderForegroundColor, - rangePickerHeaderHeadlineStyle, - rangePickerHeaderHelpStyle, - rangeSelectionBackgroundColor, - rangeSelectionOverlayColor, - dividerColor, - inputDecorationTheme, - cancelButtonStyle, - confirmButtonStyle - ]); - - @override - String toString() { - return 'StacDatePickerThemeData(backgroundColor: $backgroundColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, shape: $shape, headerBackgroundColor: $headerBackgroundColor, headerForegroundColor: $headerForegroundColor, headerHeadlineStyle: $headerHeadlineStyle, headerHelpStyle: $headerHelpStyle, weekdayStyle: $weekdayStyle, dayStyle: $dayStyle, dayForegroundColor: $dayForegroundColor, dayBackgroundColor: $dayBackgroundColor, dayOverlayColor: $dayOverlayColor, dayShape: $dayShape, todayForegroundColor: $todayForegroundColor, todayBackgroundColor: $todayBackgroundColor, todayBorder: $todayBorder, yearStyle: $yearStyle, yearForegroundColor: $yearForegroundColor, yearBackgroundColor: $yearBackgroundColor, yearOverlayColor: $yearOverlayColor, rangePickerBackgroundColor: $rangePickerBackgroundColor, rangePickerElevation: $rangePickerElevation, rangePickerShadowColor: $rangePickerShadowColor, rangePickerSurfaceTintColor: $rangePickerSurfaceTintColor, rangePickerShape: $rangePickerShape, rangePickerHeaderBackgroundColor: $rangePickerHeaderBackgroundColor, rangePickerHeaderForegroundColor: $rangePickerHeaderForegroundColor, rangePickerHeaderHeadlineStyle: $rangePickerHeaderHeadlineStyle, rangePickerHeaderHelpStyle: $rangePickerHeaderHelpStyle, rangeSelectionBackgroundColor: $rangeSelectionBackgroundColor, rangeSelectionOverlayColor: $rangeSelectionOverlayColor, dividerColor: $dividerColor, inputDecorationTheme: $inputDecorationTheme, cancelButtonStyle: $cancelButtonStyle, confirmButtonStyle: $confirmButtonStyle)'; - } -} - -/// @nodoc -abstract mixin class $StacDatePickerThemeDataCopyWith<$Res> { - factory $StacDatePickerThemeDataCopyWith(StacDatePickerThemeData value, - $Res Function(StacDatePickerThemeData) _then) = - _$StacDatePickerThemeDataCopyWithImpl; - @useResult - $Res call( - {String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - String? headerBackgroundColor, - String? headerForegroundColor, - StacTextStyle? headerHeadlineStyle, - StacTextStyle? headerHelpStyle, - StacTextStyle? weekdayStyle, - StacTextStyle? dayStyle, - String? dayForegroundColor, - String? dayBackgroundColor, - String? dayOverlayColor, - StacShapeBorder? dayShape, - String? todayForegroundColor, - String? todayBackgroundColor, - StacBorderSide? todayBorder, - StacTextStyle? yearStyle, - String? yearForegroundColor, - String? yearBackgroundColor, - String? yearOverlayColor, - String? rangePickerBackgroundColor, - double? rangePickerElevation, - String? rangePickerShadowColor, - String? rangePickerSurfaceTintColor, - StacShapeBorder? rangePickerShape, - String? rangePickerHeaderBackgroundColor, - String? rangePickerHeaderForegroundColor, - StacTextStyle? rangePickerHeaderHeadlineStyle, - StacTextStyle? rangePickerHeaderHelpStyle, - String? rangeSelectionBackgroundColor, - String? rangeSelectionOverlayColor, - String? dividerColor, - StacInputDecorationTheme? inputDecorationTheme, - StacButtonStyle? cancelButtonStyle, - StacButtonStyle? confirmButtonStyle}); -} - -/// @nodoc -class _$StacDatePickerThemeDataCopyWithImpl<$Res> - implements $StacDatePickerThemeDataCopyWith<$Res> { - _$StacDatePickerThemeDataCopyWithImpl(this._self, this._then); - - final StacDatePickerThemeData _self; - final $Res Function(StacDatePickerThemeData) _then; - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? shape = freezed, - Object? headerBackgroundColor = freezed, - Object? headerForegroundColor = freezed, - Object? headerHeadlineStyle = freezed, - Object? headerHelpStyle = freezed, - Object? weekdayStyle = freezed, - Object? dayStyle = freezed, - Object? dayForegroundColor = freezed, - Object? dayBackgroundColor = freezed, - Object? dayOverlayColor = freezed, - Object? dayShape = freezed, - Object? todayForegroundColor = freezed, - Object? todayBackgroundColor = freezed, - Object? todayBorder = freezed, - Object? yearStyle = freezed, - Object? yearForegroundColor = freezed, - Object? yearBackgroundColor = freezed, - Object? yearOverlayColor = freezed, - Object? rangePickerBackgroundColor = freezed, - Object? rangePickerElevation = freezed, - Object? rangePickerShadowColor = freezed, - Object? rangePickerSurfaceTintColor = freezed, - Object? rangePickerShape = freezed, - Object? rangePickerHeaderBackgroundColor = freezed, - Object? rangePickerHeaderForegroundColor = freezed, - Object? rangePickerHeaderHeadlineStyle = freezed, - Object? rangePickerHeaderHelpStyle = freezed, - Object? rangeSelectionBackgroundColor = freezed, - Object? rangeSelectionOverlayColor = freezed, - Object? dividerColor = freezed, - Object? inputDecorationTheme = freezed, - Object? cancelButtonStyle = freezed, - Object? confirmButtonStyle = freezed, - }) { - return _then(_self.copyWith( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - headerBackgroundColor: freezed == headerBackgroundColor - ? _self.headerBackgroundColor - : headerBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - headerForegroundColor: freezed == headerForegroundColor - ? _self.headerForegroundColor - : headerForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - headerHeadlineStyle: freezed == headerHeadlineStyle - ? _self.headerHeadlineStyle - : headerHeadlineStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - headerHelpStyle: freezed == headerHelpStyle - ? _self.headerHelpStyle - : headerHelpStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - weekdayStyle: freezed == weekdayStyle - ? _self.weekdayStyle - : weekdayStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - dayStyle: freezed == dayStyle - ? _self.dayStyle - : dayStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - dayForegroundColor: freezed == dayForegroundColor - ? _self.dayForegroundColor - : dayForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - dayBackgroundColor: freezed == dayBackgroundColor - ? _self.dayBackgroundColor - : dayBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - dayOverlayColor: freezed == dayOverlayColor - ? _self.dayOverlayColor - : dayOverlayColor // ignore: cast_nullable_to_non_nullable - as String?, - dayShape: freezed == dayShape - ? _self.dayShape - : dayShape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - todayForegroundColor: freezed == todayForegroundColor - ? _self.todayForegroundColor - : todayForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - todayBackgroundColor: freezed == todayBackgroundColor - ? _self.todayBackgroundColor - : todayBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - todayBorder: freezed == todayBorder - ? _self.todayBorder - : todayBorder // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - yearStyle: freezed == yearStyle - ? _self.yearStyle - : yearStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - yearForegroundColor: freezed == yearForegroundColor - ? _self.yearForegroundColor - : yearForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - yearBackgroundColor: freezed == yearBackgroundColor - ? _self.yearBackgroundColor - : yearBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - yearOverlayColor: freezed == yearOverlayColor - ? _self.yearOverlayColor - : yearOverlayColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerBackgroundColor: freezed == rangePickerBackgroundColor - ? _self.rangePickerBackgroundColor - : rangePickerBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerElevation: freezed == rangePickerElevation - ? _self.rangePickerElevation - : rangePickerElevation // ignore: cast_nullable_to_non_nullable - as double?, - rangePickerShadowColor: freezed == rangePickerShadowColor - ? _self.rangePickerShadowColor - : rangePickerShadowColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerSurfaceTintColor: freezed == rangePickerSurfaceTintColor - ? _self.rangePickerSurfaceTintColor - : rangePickerSurfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerShape: freezed == rangePickerShape - ? _self.rangePickerShape - : rangePickerShape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - rangePickerHeaderBackgroundColor: freezed == - rangePickerHeaderBackgroundColor - ? _self.rangePickerHeaderBackgroundColor - : rangePickerHeaderBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerHeaderForegroundColor: freezed == - rangePickerHeaderForegroundColor - ? _self.rangePickerHeaderForegroundColor - : rangePickerHeaderForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerHeaderHeadlineStyle: freezed == rangePickerHeaderHeadlineStyle - ? _self.rangePickerHeaderHeadlineStyle - : rangePickerHeaderHeadlineStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - rangePickerHeaderHelpStyle: freezed == rangePickerHeaderHelpStyle - ? _self.rangePickerHeaderHelpStyle - : rangePickerHeaderHelpStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - rangeSelectionBackgroundColor: freezed == rangeSelectionBackgroundColor - ? _self.rangeSelectionBackgroundColor - : rangeSelectionBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - rangeSelectionOverlayColor: freezed == rangeSelectionOverlayColor - ? _self.rangeSelectionOverlayColor - : rangeSelectionOverlayColor // ignore: cast_nullable_to_non_nullable - as String?, - dividerColor: freezed == dividerColor - ? _self.dividerColor - : dividerColor // ignore: cast_nullable_to_non_nullable - as String?, - inputDecorationTheme: freezed == inputDecorationTheme - ? _self.inputDecorationTheme - : inputDecorationTheme // ignore: cast_nullable_to_non_nullable - as StacInputDecorationTheme?, - cancelButtonStyle: freezed == cancelButtonStyle - ? _self.cancelButtonStyle - : cancelButtonStyle // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - confirmButtonStyle: freezed == confirmButtonStyle - ? _self.confirmButtonStyle - : confirmButtonStyle // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacDatePickerThemeData]. -extension StacDatePickerThemeDataPatterns on StacDatePickerThemeData { - /// 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(_StacDatePickerThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacDatePickerThemeData() 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(_StacDatePickerThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacDatePickerThemeData(): - 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(_StacDatePickerThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacDatePickerThemeData() 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? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - String? headerBackgroundColor, - String? headerForegroundColor, - StacTextStyle? headerHeadlineStyle, - StacTextStyle? headerHelpStyle, - StacTextStyle? weekdayStyle, - StacTextStyle? dayStyle, - String? dayForegroundColor, - String? dayBackgroundColor, - String? dayOverlayColor, - StacShapeBorder? dayShape, - String? todayForegroundColor, - String? todayBackgroundColor, - StacBorderSide? todayBorder, - StacTextStyle? yearStyle, - String? yearForegroundColor, - String? yearBackgroundColor, - String? yearOverlayColor, - String? rangePickerBackgroundColor, - double? rangePickerElevation, - String? rangePickerShadowColor, - String? rangePickerSurfaceTintColor, - StacShapeBorder? rangePickerShape, - String? rangePickerHeaderBackgroundColor, - String? rangePickerHeaderForegroundColor, - StacTextStyle? rangePickerHeaderHeadlineStyle, - StacTextStyle? rangePickerHeaderHelpStyle, - String? rangeSelectionBackgroundColor, - String? rangeSelectionOverlayColor, - String? dividerColor, - StacInputDecorationTheme? inputDecorationTheme, - StacButtonStyle? cancelButtonStyle, - StacButtonStyle? confirmButtonStyle)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacDatePickerThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.headerBackgroundColor, - _that.headerForegroundColor, - _that.headerHeadlineStyle, - _that.headerHelpStyle, - _that.weekdayStyle, - _that.dayStyle, - _that.dayForegroundColor, - _that.dayBackgroundColor, - _that.dayOverlayColor, - _that.dayShape, - _that.todayForegroundColor, - _that.todayBackgroundColor, - _that.todayBorder, - _that.yearStyle, - _that.yearForegroundColor, - _that.yearBackgroundColor, - _that.yearOverlayColor, - _that.rangePickerBackgroundColor, - _that.rangePickerElevation, - _that.rangePickerShadowColor, - _that.rangePickerSurfaceTintColor, - _that.rangePickerShape, - _that.rangePickerHeaderBackgroundColor, - _that.rangePickerHeaderForegroundColor, - _that.rangePickerHeaderHeadlineStyle, - _that.rangePickerHeaderHelpStyle, - _that.rangeSelectionBackgroundColor, - _that.rangeSelectionOverlayColor, - _that.dividerColor, - _that.inputDecorationTheme, - _that.cancelButtonStyle, - _that.confirmButtonStyle); - 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? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - String? headerBackgroundColor, - String? headerForegroundColor, - StacTextStyle? headerHeadlineStyle, - StacTextStyle? headerHelpStyle, - StacTextStyle? weekdayStyle, - StacTextStyle? dayStyle, - String? dayForegroundColor, - String? dayBackgroundColor, - String? dayOverlayColor, - StacShapeBorder? dayShape, - String? todayForegroundColor, - String? todayBackgroundColor, - StacBorderSide? todayBorder, - StacTextStyle? yearStyle, - String? yearForegroundColor, - String? yearBackgroundColor, - String? yearOverlayColor, - String? rangePickerBackgroundColor, - double? rangePickerElevation, - String? rangePickerShadowColor, - String? rangePickerSurfaceTintColor, - StacShapeBorder? rangePickerShape, - String? rangePickerHeaderBackgroundColor, - String? rangePickerHeaderForegroundColor, - StacTextStyle? rangePickerHeaderHeadlineStyle, - StacTextStyle? rangePickerHeaderHelpStyle, - String? rangeSelectionBackgroundColor, - String? rangeSelectionOverlayColor, - String? dividerColor, - StacInputDecorationTheme? inputDecorationTheme, - StacButtonStyle? cancelButtonStyle, - StacButtonStyle? confirmButtonStyle) - $default, - ) { - final _that = this; - switch (_that) { - case _StacDatePickerThemeData(): - return $default( - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.headerBackgroundColor, - _that.headerForegroundColor, - _that.headerHeadlineStyle, - _that.headerHelpStyle, - _that.weekdayStyle, - _that.dayStyle, - _that.dayForegroundColor, - _that.dayBackgroundColor, - _that.dayOverlayColor, - _that.dayShape, - _that.todayForegroundColor, - _that.todayBackgroundColor, - _that.todayBorder, - _that.yearStyle, - _that.yearForegroundColor, - _that.yearBackgroundColor, - _that.yearOverlayColor, - _that.rangePickerBackgroundColor, - _that.rangePickerElevation, - _that.rangePickerShadowColor, - _that.rangePickerSurfaceTintColor, - _that.rangePickerShape, - _that.rangePickerHeaderBackgroundColor, - _that.rangePickerHeaderForegroundColor, - _that.rangePickerHeaderHeadlineStyle, - _that.rangePickerHeaderHelpStyle, - _that.rangeSelectionBackgroundColor, - _that.rangeSelectionOverlayColor, - _that.dividerColor, - _that.inputDecorationTheme, - _that.cancelButtonStyle, - _that.confirmButtonStyle); - 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? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - String? headerBackgroundColor, - String? headerForegroundColor, - StacTextStyle? headerHeadlineStyle, - StacTextStyle? headerHelpStyle, - StacTextStyle? weekdayStyle, - StacTextStyle? dayStyle, - String? dayForegroundColor, - String? dayBackgroundColor, - String? dayOverlayColor, - StacShapeBorder? dayShape, - String? todayForegroundColor, - String? todayBackgroundColor, - StacBorderSide? todayBorder, - StacTextStyle? yearStyle, - String? yearForegroundColor, - String? yearBackgroundColor, - String? yearOverlayColor, - String? rangePickerBackgroundColor, - double? rangePickerElevation, - String? rangePickerShadowColor, - String? rangePickerSurfaceTintColor, - StacShapeBorder? rangePickerShape, - String? rangePickerHeaderBackgroundColor, - String? rangePickerHeaderForegroundColor, - StacTextStyle? rangePickerHeaderHeadlineStyle, - StacTextStyle? rangePickerHeaderHelpStyle, - String? rangeSelectionBackgroundColor, - String? rangeSelectionOverlayColor, - String? dividerColor, - StacInputDecorationTheme? inputDecorationTheme, - StacButtonStyle? cancelButtonStyle, - StacButtonStyle? confirmButtonStyle)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacDatePickerThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.headerBackgroundColor, - _that.headerForegroundColor, - _that.headerHeadlineStyle, - _that.headerHelpStyle, - _that.weekdayStyle, - _that.dayStyle, - _that.dayForegroundColor, - _that.dayBackgroundColor, - _that.dayOverlayColor, - _that.dayShape, - _that.todayForegroundColor, - _that.todayBackgroundColor, - _that.todayBorder, - _that.yearStyle, - _that.yearForegroundColor, - _that.yearBackgroundColor, - _that.yearOverlayColor, - _that.rangePickerBackgroundColor, - _that.rangePickerElevation, - _that.rangePickerShadowColor, - _that.rangePickerSurfaceTintColor, - _that.rangePickerShape, - _that.rangePickerHeaderBackgroundColor, - _that.rangePickerHeaderForegroundColor, - _that.rangePickerHeaderHeadlineStyle, - _that.rangePickerHeaderHelpStyle, - _that.rangeSelectionBackgroundColor, - _that.rangeSelectionOverlayColor, - _that.dividerColor, - _that.inputDecorationTheme, - _that.cancelButtonStyle, - _that.confirmButtonStyle); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacDatePickerThemeData implements StacDatePickerThemeData { - const _StacDatePickerThemeData( - {this.backgroundColor, - this.elevation, - this.shadowColor, - this.surfaceTintColor, - this.shape, - this.headerBackgroundColor, - this.headerForegroundColor, - this.headerHeadlineStyle, - this.headerHelpStyle, - this.weekdayStyle, - this.dayStyle, - this.dayForegroundColor, - this.dayBackgroundColor, - this.dayOverlayColor, - this.dayShape, - this.todayForegroundColor, - this.todayBackgroundColor, - this.todayBorder, - this.yearStyle, - this.yearForegroundColor, - this.yearBackgroundColor, - this.yearOverlayColor, - this.rangePickerBackgroundColor, - this.rangePickerElevation, - this.rangePickerShadowColor, - this.rangePickerSurfaceTintColor, - this.rangePickerShape, - this.rangePickerHeaderBackgroundColor, - this.rangePickerHeaderForegroundColor, - this.rangePickerHeaderHeadlineStyle, - this.rangePickerHeaderHelpStyle, - this.rangeSelectionBackgroundColor, - this.rangeSelectionOverlayColor, - this.dividerColor, - this.inputDecorationTheme, - this.cancelButtonStyle, - this.confirmButtonStyle}); - factory _StacDatePickerThemeData.fromJson(Map json) => - _$StacDatePickerThemeDataFromJson(json); - - @override - final String? backgroundColor; - @override - final double? elevation; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final StacShapeBorder? shape; - @override - final String? headerBackgroundColor; - @override - final String? headerForegroundColor; - @override - final StacTextStyle? headerHeadlineStyle; - @override - final StacTextStyle? headerHelpStyle; - @override - final StacTextStyle? weekdayStyle; - @override - final StacTextStyle? dayStyle; - @override - final String? dayForegroundColor; - @override - final String? dayBackgroundColor; - @override - final String? dayOverlayColor; - @override - final StacShapeBorder? dayShape; - @override - final String? todayForegroundColor; - @override - final String? todayBackgroundColor; - @override - final StacBorderSide? todayBorder; - @override - final StacTextStyle? yearStyle; - @override - final String? yearForegroundColor; - @override - final String? yearBackgroundColor; - @override - final String? yearOverlayColor; - @override - final String? rangePickerBackgroundColor; - @override - final double? rangePickerElevation; - @override - final String? rangePickerShadowColor; - @override - final String? rangePickerSurfaceTintColor; - @override - final StacShapeBorder? rangePickerShape; - @override - final String? rangePickerHeaderBackgroundColor; - @override - final String? rangePickerHeaderForegroundColor; - @override - final StacTextStyle? rangePickerHeaderHeadlineStyle; - @override - final StacTextStyle? rangePickerHeaderHelpStyle; - @override - final String? rangeSelectionBackgroundColor; - @override - final String? rangeSelectionOverlayColor; - @override - final String? dividerColor; - @override - final StacInputDecorationTheme? inputDecorationTheme; - @override - final StacButtonStyle? cancelButtonStyle; - @override - final StacButtonStyle? confirmButtonStyle; - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacDatePickerThemeDataCopyWith<_StacDatePickerThemeData> get copyWith => - __$StacDatePickerThemeDataCopyWithImpl<_StacDatePickerThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacDatePickerThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacDatePickerThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.headerBackgroundColor, headerBackgroundColor) || - other.headerBackgroundColor == headerBackgroundColor) && - (identical(other.headerForegroundColor, headerForegroundColor) || - other.headerForegroundColor == headerForegroundColor) && - (identical(other.headerHeadlineStyle, headerHeadlineStyle) || - other.headerHeadlineStyle == headerHeadlineStyle) && - (identical(other.headerHelpStyle, headerHelpStyle) || - other.headerHelpStyle == headerHelpStyle) && - (identical(other.weekdayStyle, weekdayStyle) || - other.weekdayStyle == weekdayStyle) && - (identical(other.dayStyle, dayStyle) || - other.dayStyle == dayStyle) && - (identical(other.dayForegroundColor, dayForegroundColor) || - other.dayForegroundColor == dayForegroundColor) && - (identical(other.dayBackgroundColor, dayBackgroundColor) || - other.dayBackgroundColor == dayBackgroundColor) && - (identical(other.dayOverlayColor, dayOverlayColor) || - other.dayOverlayColor == dayOverlayColor) && - (identical(other.dayShape, dayShape) || - other.dayShape == dayShape) && - (identical(other.todayForegroundColor, todayForegroundColor) || - other.todayForegroundColor == todayForegroundColor) && - (identical(other.todayBackgroundColor, todayBackgroundColor) || - other.todayBackgroundColor == todayBackgroundColor) && - (identical(other.todayBorder, todayBorder) || - other.todayBorder == todayBorder) && - (identical(other.yearStyle, yearStyle) || - other.yearStyle == yearStyle) && - (identical(other.yearForegroundColor, yearForegroundColor) || - other.yearForegroundColor == yearForegroundColor) && - (identical(other.yearBackgroundColor, yearBackgroundColor) || - other.yearBackgroundColor == yearBackgroundColor) && - (identical(other.yearOverlayColor, yearOverlayColor) || - other.yearOverlayColor == yearOverlayColor) && - (identical(other.rangePickerBackgroundColor, rangePickerBackgroundColor) || - other.rangePickerBackgroundColor == - rangePickerBackgroundColor) && - (identical(other.rangePickerElevation, rangePickerElevation) || - other.rangePickerElevation == rangePickerElevation) && - (identical(other.rangePickerShadowColor, rangePickerShadowColor) || - other.rangePickerShadowColor == rangePickerShadowColor) && - (identical(other.rangePickerSurfaceTintColor, rangePickerSurfaceTintColor) || - other.rangePickerSurfaceTintColor == - rangePickerSurfaceTintColor) && - (identical(other.rangePickerShape, rangePickerShape) || - other.rangePickerShape == rangePickerShape) && - (identical(other.rangePickerHeaderBackgroundColor, rangePickerHeaderBackgroundColor) || - other.rangePickerHeaderBackgroundColor == - rangePickerHeaderBackgroundColor) && - (identical(other.rangePickerHeaderForegroundColor, rangePickerHeaderForegroundColor) || - other.rangePickerHeaderForegroundColor == - rangePickerHeaderForegroundColor) && - (identical(other.rangePickerHeaderHeadlineStyle, rangePickerHeaderHeadlineStyle) || - other.rangePickerHeaderHeadlineStyle == - rangePickerHeaderHeadlineStyle) && - (identical(other.rangePickerHeaderHelpStyle, rangePickerHeaderHelpStyle) || - other.rangePickerHeaderHelpStyle == - rangePickerHeaderHelpStyle) && - (identical(other.rangeSelectionBackgroundColor, rangeSelectionBackgroundColor) || - other.rangeSelectionBackgroundColor == - rangeSelectionBackgroundColor) && - (identical(other.rangeSelectionOverlayColor, rangeSelectionOverlayColor) || - other.rangeSelectionOverlayColor == - rangeSelectionOverlayColor) && - (identical(other.dividerColor, dividerColor) || other.dividerColor == dividerColor) && - (identical(other.inputDecorationTheme, inputDecorationTheme) || other.inputDecorationTheme == inputDecorationTheme) && - (identical(other.cancelButtonStyle, cancelButtonStyle) || other.cancelButtonStyle == cancelButtonStyle) && - (identical(other.confirmButtonStyle, confirmButtonStyle) || other.confirmButtonStyle == confirmButtonStyle)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - backgroundColor, - elevation, - shadowColor, - surfaceTintColor, - shape, - headerBackgroundColor, - headerForegroundColor, - headerHeadlineStyle, - headerHelpStyle, - weekdayStyle, - dayStyle, - dayForegroundColor, - dayBackgroundColor, - dayOverlayColor, - dayShape, - todayForegroundColor, - todayBackgroundColor, - todayBorder, - yearStyle, - yearForegroundColor, - yearBackgroundColor, - yearOverlayColor, - rangePickerBackgroundColor, - rangePickerElevation, - rangePickerShadowColor, - rangePickerSurfaceTintColor, - rangePickerShape, - rangePickerHeaderBackgroundColor, - rangePickerHeaderForegroundColor, - rangePickerHeaderHeadlineStyle, - rangePickerHeaderHelpStyle, - rangeSelectionBackgroundColor, - rangeSelectionOverlayColor, - dividerColor, - inputDecorationTheme, - cancelButtonStyle, - confirmButtonStyle - ]); - - @override - String toString() { - return 'StacDatePickerThemeData(backgroundColor: $backgroundColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, shape: $shape, headerBackgroundColor: $headerBackgroundColor, headerForegroundColor: $headerForegroundColor, headerHeadlineStyle: $headerHeadlineStyle, headerHelpStyle: $headerHelpStyle, weekdayStyle: $weekdayStyle, dayStyle: $dayStyle, dayForegroundColor: $dayForegroundColor, dayBackgroundColor: $dayBackgroundColor, dayOverlayColor: $dayOverlayColor, dayShape: $dayShape, todayForegroundColor: $todayForegroundColor, todayBackgroundColor: $todayBackgroundColor, todayBorder: $todayBorder, yearStyle: $yearStyle, yearForegroundColor: $yearForegroundColor, yearBackgroundColor: $yearBackgroundColor, yearOverlayColor: $yearOverlayColor, rangePickerBackgroundColor: $rangePickerBackgroundColor, rangePickerElevation: $rangePickerElevation, rangePickerShadowColor: $rangePickerShadowColor, rangePickerSurfaceTintColor: $rangePickerSurfaceTintColor, rangePickerShape: $rangePickerShape, rangePickerHeaderBackgroundColor: $rangePickerHeaderBackgroundColor, rangePickerHeaderForegroundColor: $rangePickerHeaderForegroundColor, rangePickerHeaderHeadlineStyle: $rangePickerHeaderHeadlineStyle, rangePickerHeaderHelpStyle: $rangePickerHeaderHelpStyle, rangeSelectionBackgroundColor: $rangeSelectionBackgroundColor, rangeSelectionOverlayColor: $rangeSelectionOverlayColor, dividerColor: $dividerColor, inputDecorationTheme: $inputDecorationTheme, cancelButtonStyle: $cancelButtonStyle, confirmButtonStyle: $confirmButtonStyle)'; - } -} - -/// @nodoc -abstract mixin class _$StacDatePickerThemeDataCopyWith<$Res> - implements $StacDatePickerThemeDataCopyWith<$Res> { - factory _$StacDatePickerThemeDataCopyWith(_StacDatePickerThemeData value, - $Res Function(_StacDatePickerThemeData) _then) = - __$StacDatePickerThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - String? headerBackgroundColor, - String? headerForegroundColor, - StacTextStyle? headerHeadlineStyle, - StacTextStyle? headerHelpStyle, - StacTextStyle? weekdayStyle, - StacTextStyle? dayStyle, - String? dayForegroundColor, - String? dayBackgroundColor, - String? dayOverlayColor, - StacShapeBorder? dayShape, - String? todayForegroundColor, - String? todayBackgroundColor, - StacBorderSide? todayBorder, - StacTextStyle? yearStyle, - String? yearForegroundColor, - String? yearBackgroundColor, - String? yearOverlayColor, - String? rangePickerBackgroundColor, - double? rangePickerElevation, - String? rangePickerShadowColor, - String? rangePickerSurfaceTintColor, - StacShapeBorder? rangePickerShape, - String? rangePickerHeaderBackgroundColor, - String? rangePickerHeaderForegroundColor, - StacTextStyle? rangePickerHeaderHeadlineStyle, - StacTextStyle? rangePickerHeaderHelpStyle, - String? rangeSelectionBackgroundColor, - String? rangeSelectionOverlayColor, - String? dividerColor, - StacInputDecorationTheme? inputDecorationTheme, - StacButtonStyle? cancelButtonStyle, - StacButtonStyle? confirmButtonStyle}); -} - -/// @nodoc -class __$StacDatePickerThemeDataCopyWithImpl<$Res> - implements _$StacDatePickerThemeDataCopyWith<$Res> { - __$StacDatePickerThemeDataCopyWithImpl(this._self, this._then); - - final _StacDatePickerThemeData _self; - final $Res Function(_StacDatePickerThemeData) _then; - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? shape = freezed, - Object? headerBackgroundColor = freezed, - Object? headerForegroundColor = freezed, - Object? headerHeadlineStyle = freezed, - Object? headerHelpStyle = freezed, - Object? weekdayStyle = freezed, - Object? dayStyle = freezed, - Object? dayForegroundColor = freezed, - Object? dayBackgroundColor = freezed, - Object? dayOverlayColor = freezed, - Object? dayShape = freezed, - Object? todayForegroundColor = freezed, - Object? todayBackgroundColor = freezed, - Object? todayBorder = freezed, - Object? yearStyle = freezed, - Object? yearForegroundColor = freezed, - Object? yearBackgroundColor = freezed, - Object? yearOverlayColor = freezed, - Object? rangePickerBackgroundColor = freezed, - Object? rangePickerElevation = freezed, - Object? rangePickerShadowColor = freezed, - Object? rangePickerSurfaceTintColor = freezed, - Object? rangePickerShape = freezed, - Object? rangePickerHeaderBackgroundColor = freezed, - Object? rangePickerHeaderForegroundColor = freezed, - Object? rangePickerHeaderHeadlineStyle = freezed, - Object? rangePickerHeaderHelpStyle = freezed, - Object? rangeSelectionBackgroundColor = freezed, - Object? rangeSelectionOverlayColor = freezed, - Object? dividerColor = freezed, - Object? inputDecorationTheme = freezed, - Object? cancelButtonStyle = freezed, - Object? confirmButtonStyle = freezed, - }) { - return _then(_StacDatePickerThemeData( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - headerBackgroundColor: freezed == headerBackgroundColor - ? _self.headerBackgroundColor - : headerBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - headerForegroundColor: freezed == headerForegroundColor - ? _self.headerForegroundColor - : headerForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - headerHeadlineStyle: freezed == headerHeadlineStyle - ? _self.headerHeadlineStyle - : headerHeadlineStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - headerHelpStyle: freezed == headerHelpStyle - ? _self.headerHelpStyle - : headerHelpStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - weekdayStyle: freezed == weekdayStyle - ? _self.weekdayStyle - : weekdayStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - dayStyle: freezed == dayStyle - ? _self.dayStyle - : dayStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - dayForegroundColor: freezed == dayForegroundColor - ? _self.dayForegroundColor - : dayForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - dayBackgroundColor: freezed == dayBackgroundColor - ? _self.dayBackgroundColor - : dayBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - dayOverlayColor: freezed == dayOverlayColor - ? _self.dayOverlayColor - : dayOverlayColor // ignore: cast_nullable_to_non_nullable - as String?, - dayShape: freezed == dayShape - ? _self.dayShape - : dayShape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - todayForegroundColor: freezed == todayForegroundColor - ? _self.todayForegroundColor - : todayForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - todayBackgroundColor: freezed == todayBackgroundColor - ? _self.todayBackgroundColor - : todayBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - todayBorder: freezed == todayBorder - ? _self.todayBorder - : todayBorder // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - yearStyle: freezed == yearStyle - ? _self.yearStyle - : yearStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - yearForegroundColor: freezed == yearForegroundColor - ? _self.yearForegroundColor - : yearForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - yearBackgroundColor: freezed == yearBackgroundColor - ? _self.yearBackgroundColor - : yearBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - yearOverlayColor: freezed == yearOverlayColor - ? _self.yearOverlayColor - : yearOverlayColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerBackgroundColor: freezed == rangePickerBackgroundColor - ? _self.rangePickerBackgroundColor - : rangePickerBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerElevation: freezed == rangePickerElevation - ? _self.rangePickerElevation - : rangePickerElevation // ignore: cast_nullable_to_non_nullable - as double?, - rangePickerShadowColor: freezed == rangePickerShadowColor - ? _self.rangePickerShadowColor - : rangePickerShadowColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerSurfaceTintColor: freezed == rangePickerSurfaceTintColor - ? _self.rangePickerSurfaceTintColor - : rangePickerSurfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerShape: freezed == rangePickerShape - ? _self.rangePickerShape - : rangePickerShape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - rangePickerHeaderBackgroundColor: freezed == - rangePickerHeaderBackgroundColor - ? _self.rangePickerHeaderBackgroundColor - : rangePickerHeaderBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerHeaderForegroundColor: freezed == - rangePickerHeaderForegroundColor - ? _self.rangePickerHeaderForegroundColor - : rangePickerHeaderForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - rangePickerHeaderHeadlineStyle: freezed == rangePickerHeaderHeadlineStyle - ? _self.rangePickerHeaderHeadlineStyle - : rangePickerHeaderHeadlineStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - rangePickerHeaderHelpStyle: freezed == rangePickerHeaderHelpStyle - ? _self.rangePickerHeaderHelpStyle - : rangePickerHeaderHelpStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - rangeSelectionBackgroundColor: freezed == rangeSelectionBackgroundColor - ? _self.rangeSelectionBackgroundColor - : rangeSelectionBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - rangeSelectionOverlayColor: freezed == rangeSelectionOverlayColor - ? _self.rangeSelectionOverlayColor - : rangeSelectionOverlayColor // ignore: cast_nullable_to_non_nullable - as String?, - dividerColor: freezed == dividerColor - ? _self.dividerColor - : dividerColor // ignore: cast_nullable_to_non_nullable - as String?, - inputDecorationTheme: freezed == inputDecorationTheme - ? _self.inputDecorationTheme - : inputDecorationTheme // ignore: cast_nullable_to_non_nullable - as StacInputDecorationTheme?, - cancelButtonStyle: freezed == cancelButtonStyle - ? _self.cancelButtonStyle - : cancelButtonStyle // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - confirmButtonStyle: freezed == confirmButtonStyle - ? _self.confirmButtonStyle - : confirmButtonStyle // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.g.dart deleted file mode 100644 index 8306a11b3..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.g.dart +++ /dev/null @@ -1,131 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_date_picker_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacDatePickerThemeData _$StacDatePickerThemeDataFromJson( - Map json) => - _StacDatePickerThemeData( - backgroundColor: json['backgroundColor'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - shadowColor: json['shadowColor'] as String?, - surfaceTintColor: json['surfaceTintColor'] as String?, - shape: json['shape'] == null - ? null - : StacShapeBorder.fromJson(json['shape'] as Map), - headerBackgroundColor: json['headerBackgroundColor'] as String?, - headerForegroundColor: json['headerForegroundColor'] as String?, - headerHeadlineStyle: json['headerHeadlineStyle'] == null - ? null - : StacTextStyle.fromJson(json['headerHeadlineStyle']), - headerHelpStyle: json['headerHelpStyle'] == null - ? null - : StacTextStyle.fromJson(json['headerHelpStyle']), - weekdayStyle: json['weekdayStyle'] == null - ? null - : StacTextStyle.fromJson(json['weekdayStyle']), - dayStyle: json['dayStyle'] == null - ? null - : StacTextStyle.fromJson(json['dayStyle']), - dayForegroundColor: json['dayForegroundColor'] as String?, - dayBackgroundColor: json['dayBackgroundColor'] as String?, - dayOverlayColor: json['dayOverlayColor'] as String?, - dayShape: json['dayShape'] == null - ? null - : StacShapeBorder.fromJson(json['dayShape'] as Map), - todayForegroundColor: json['todayForegroundColor'] as String?, - todayBackgroundColor: json['todayBackgroundColor'] as String?, - todayBorder: json['todayBorder'] == null - ? null - : StacBorderSide.fromJson( - json['todayBorder'] as Map), - yearStyle: json['yearStyle'] == null - ? null - : StacTextStyle.fromJson(json['yearStyle']), - yearForegroundColor: json['yearForegroundColor'] as String?, - yearBackgroundColor: json['yearBackgroundColor'] as String?, - yearOverlayColor: json['yearOverlayColor'] as String?, - rangePickerBackgroundColor: json['rangePickerBackgroundColor'] as String?, - rangePickerElevation: (json['rangePickerElevation'] as num?)?.toDouble(), - rangePickerShadowColor: json['rangePickerShadowColor'] as String?, - rangePickerSurfaceTintColor: - json['rangePickerSurfaceTintColor'] as String?, - rangePickerShape: json['rangePickerShape'] == null - ? null - : StacShapeBorder.fromJson( - json['rangePickerShape'] as Map), - rangePickerHeaderBackgroundColor: - json['rangePickerHeaderBackgroundColor'] as String?, - rangePickerHeaderForegroundColor: - json['rangePickerHeaderForegroundColor'] as String?, - rangePickerHeaderHeadlineStyle: - json['rangePickerHeaderHeadlineStyle'] == null - ? null - : StacTextStyle.fromJson(json['rangePickerHeaderHeadlineStyle']), - rangePickerHeaderHelpStyle: json['rangePickerHeaderHelpStyle'] == null - ? null - : StacTextStyle.fromJson(json['rangePickerHeaderHelpStyle']), - rangeSelectionBackgroundColor: - json['rangeSelectionBackgroundColor'] as String?, - rangeSelectionOverlayColor: json['rangeSelectionOverlayColor'] as String?, - dividerColor: json['dividerColor'] as String?, - inputDecorationTheme: json['inputDecorationTheme'] == null - ? null - : StacInputDecorationTheme.fromJson( - json['inputDecorationTheme'] as Map), - cancelButtonStyle: json['cancelButtonStyle'] == null - ? null - : StacButtonStyle.fromJson( - json['cancelButtonStyle'] as Map), - confirmButtonStyle: json['confirmButtonStyle'] == null - ? null - : StacButtonStyle.fromJson( - json['confirmButtonStyle'] as Map), - ); - -Map _$StacDatePickerThemeDataToJson( - _StacDatePickerThemeData instance) => - { - 'backgroundColor': instance.backgroundColor, - 'elevation': instance.elevation, - 'shadowColor': instance.shadowColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'shape': instance.shape, - 'headerBackgroundColor': instance.headerBackgroundColor, - 'headerForegroundColor': instance.headerForegroundColor, - 'headerHeadlineStyle': instance.headerHeadlineStyle, - 'headerHelpStyle': instance.headerHelpStyle, - 'weekdayStyle': instance.weekdayStyle, - 'dayStyle': instance.dayStyle, - 'dayForegroundColor': instance.dayForegroundColor, - 'dayBackgroundColor': instance.dayBackgroundColor, - 'dayOverlayColor': instance.dayOverlayColor, - 'dayShape': instance.dayShape, - 'todayForegroundColor': instance.todayForegroundColor, - 'todayBackgroundColor': instance.todayBackgroundColor, - 'todayBorder': instance.todayBorder, - 'yearStyle': instance.yearStyle, - 'yearForegroundColor': instance.yearForegroundColor, - 'yearBackgroundColor': instance.yearBackgroundColor, - 'yearOverlayColor': instance.yearOverlayColor, - 'rangePickerBackgroundColor': instance.rangePickerBackgroundColor, - 'rangePickerElevation': instance.rangePickerElevation, - 'rangePickerShadowColor': instance.rangePickerShadowColor, - 'rangePickerSurfaceTintColor': instance.rangePickerSurfaceTintColor, - 'rangePickerShape': instance.rangePickerShape, - 'rangePickerHeaderBackgroundColor': - instance.rangePickerHeaderBackgroundColor, - 'rangePickerHeaderForegroundColor': - instance.rangePickerHeaderForegroundColor, - 'rangePickerHeaderHeadlineStyle': instance.rangePickerHeaderHeadlineStyle, - 'rangePickerHeaderHelpStyle': instance.rangePickerHeaderHelpStyle, - 'rangeSelectionBackgroundColor': instance.rangeSelectionBackgroundColor, - 'rangeSelectionOverlayColor': instance.rangeSelectionOverlayColor, - 'dividerColor': instance.dividerColor, - 'inputDecorationTheme': instance.inputDecorationTheme, - 'cancelButtonStyle': instance.cancelButtonStyle, - 'confirmButtonStyle': instance.confirmButtonStyle, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data_parser.dart new file mode 100644 index 000000000..052f28ea6 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data_parser.dart @@ -0,0 +1,83 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_border_side_parser.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_shape_border_parser.dart'; +import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; +import 'package:stac/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart'; +import 'package:stac/src/parsers/theme/stac_button_style_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacDatePickerThemeData]. +/// +/// Converts [StacDatePickerThemeData] to Flutter's [DatePickerThemeData]. +extension StacDatePickerThemeDataParser on StacDatePickerThemeData { + DatePickerThemeData parse(BuildContext context) { + return DatePickerThemeData( + backgroundColor: backgroundColor?.toColor(context), + elevation: elevation, + shadowColor: shadowColor?.toColor(context), + surfaceTintColor: surfaceTintColor?.toColor(context), + shape: shape?.parse(context), + headerBackgroundColor: headerBackgroundColor?.toColor(context), + headerForegroundColor: headerForegroundColor?.toColor(context), + headerHeadlineStyle: headerHeadlineStyle?.parse(context), + headerHelpStyle: headerHelpStyle?.parse(context), + weekdayStyle: weekdayStyle?.parse(context), + dayStyle: dayStyle?.parse(context), + dayForegroundColor: WidgetStatePropertyAll( + dayForegroundColor?.toColor(context), + ), + dayBackgroundColor: WidgetStatePropertyAll( + dayBackgroundColor?.toColor(context), + ), + dayOverlayColor: WidgetStatePropertyAll( + dayOverlayColor?.toColor(context), + ), + dayShape: WidgetStatePropertyAll( + dayShape?.parse(context) as OutlinedBorder, + ), + todayForegroundColor: WidgetStatePropertyAll( + todayForegroundColor?.toColor(context), + ), + todayBackgroundColor: WidgetStatePropertyAll( + todayBackgroundColor?.toColor(context), + ), + todayBorder: todayBorder?.parse(context), + yearStyle: yearStyle?.parse(context), + yearForegroundColor: WidgetStatePropertyAll( + yearForegroundColor?.toColor(context), + ), + yearBackgroundColor: WidgetStatePropertyAll( + yearBackgroundColor?.toColor(context), + ), + yearOverlayColor: WidgetStatePropertyAll( + yearOverlayColor?.toColor(context), + ), + rangePickerBackgroundColor: rangePickerBackgroundColor?.toColor(context), + rangePickerElevation: rangePickerElevation, + rangePickerShadowColor: rangePickerShadowColor?.toColor(context), + rangePickerSurfaceTintColor: rangePickerSurfaceTintColor?.toColor( + context, + ), + rangePickerShape: rangePickerShape?.parse(context), + rangePickerHeaderBackgroundColor: rangePickerHeaderBackgroundColor + ?.toColor(context), + rangePickerHeaderForegroundColor: rangePickerHeaderForegroundColor + ?.toColor(context), + rangePickerHeaderHeadlineStyle: rangePickerHeaderHeadlineStyle?.parse( + context, + ), + rangePickerHeaderHelpStyle: rangePickerHeaderHelpStyle?.parse(context), + rangeSelectionBackgroundColor: rangeSelectionBackgroundColor?.toColor( + context, + ), + rangeSelectionOverlayColor: WidgetStatePropertyAll( + rangeSelectionOverlayColor?.toColor(context), + ), + dividerColor: dividerColor?.toColor(context), + inputDecorationTheme: inputDecorationTheme?.parse(context), + cancelButtonStyle: cancelButtonStyle?.parseTextButton(context), + confirmButtonStyle: confirmButtonStyle?.parseTextButton(context), + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart b/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart deleted file mode 100644 index d25c2323d..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/alignment/stac_alignment_geometry_parser.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_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'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_dialog_theme.freezed.dart'; -part 'stac_dialog_theme.g.dart'; - -@freezed -abstract class StacDialogTheme with _$StacDialogTheme { - const factory StacDialogTheme({ - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacBorder? shape, - StacAlignmentGeometry? alignment, - StacTextStyle? titleTextStyle, - StacTextStyle? contentTextStyle, - StacEdgeInsets? actionsPadding, - String? iconColor, - }) = _StacDialogTheme; - - factory StacDialogTheme.fromJson(Map json) => - _$StacDialogThemeFromJson(json); -} - -extension StacDialogThemeParser on StacDialogTheme { - DialogTheme? parse(BuildContext context) { - return DialogTheme( - backgroundColor: backgroundColor.toColor(context), - elevation: elevation, - shadowColor: shadowColor.toColor(context), - surfaceTintColor: surfaceTintColor.toColor(context), - shape: shape?.parse(context), - alignment: alignment?.parse, - titleTextStyle: titleTextStyle?.parse(context), - contentTextStyle: contentTextStyle?.parse(context), - actionsPadding: actionsPadding?.parse, - iconColor: iconColor.toColor(context), - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.freezed.dart deleted file mode 100644 index b86cb41f8..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.freezed.dart +++ /dev/null @@ -1,584 +0,0 @@ -// 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 - -part of 'stac_dialog_theme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacDialogTheme { - String? get backgroundColor; - double? get elevation; - String? get shadowColor; - String? get surfaceTintColor; - StacBorder? get shape; - StacAlignmentGeometry? get alignment; - StacTextStyle? get titleTextStyle; - StacTextStyle? get contentTextStyle; - StacEdgeInsets? get actionsPadding; - String? get iconColor; - - /// Create a copy of StacDialogTheme - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacDialogThemeCopyWith get copyWith => - _$StacDialogThemeCopyWithImpl( - this as StacDialogTheme, _$identity); - - /// Serializes this StacDialogTheme to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacDialogTheme && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.alignment, alignment) || - other.alignment == alignment) && - (identical(other.titleTextStyle, titleTextStyle) || - other.titleTextStyle == titleTextStyle) && - (identical(other.contentTextStyle, contentTextStyle) || - other.contentTextStyle == contentTextStyle) && - (identical(other.actionsPadding, actionsPadding) || - other.actionsPadding == actionsPadding) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - elevation, - shadowColor, - surfaceTintColor, - shape, - alignment, - titleTextStyle, - contentTextStyle, - actionsPadding, - iconColor); - - @override - String toString() { - return 'StacDialogTheme(backgroundColor: $backgroundColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, shape: $shape, alignment: $alignment, titleTextStyle: $titleTextStyle, contentTextStyle: $contentTextStyle, actionsPadding: $actionsPadding, iconColor: $iconColor)'; - } -} - -/// @nodoc -abstract mixin class $StacDialogThemeCopyWith<$Res> { - factory $StacDialogThemeCopyWith( - StacDialogTheme value, $Res Function(StacDialogTheme) _then) = - _$StacDialogThemeCopyWithImpl; - @useResult - $Res call( - {String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacBorder? shape, - StacAlignmentGeometry? alignment, - StacTextStyle? titleTextStyle, - StacTextStyle? contentTextStyle, - StacEdgeInsets? actionsPadding, - String? iconColor}); -} - -/// @nodoc -class _$StacDialogThemeCopyWithImpl<$Res> - implements $StacDialogThemeCopyWith<$Res> { - _$StacDialogThemeCopyWithImpl(this._self, this._then); - - final StacDialogTheme _self; - final $Res Function(StacDialogTheme) _then; - - /// Create a copy of StacDialogTheme - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? shape = freezed, - Object? alignment = freezed, - Object? titleTextStyle = freezed, - Object? contentTextStyle = freezed, - Object? actionsPadding = freezed, - Object? iconColor = freezed, - }) { - return _then(_self.copyWith( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - alignment: freezed == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignmentGeometry?, - titleTextStyle: freezed == titleTextStyle - ? _self.titleTextStyle - : titleTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - contentTextStyle: freezed == contentTextStyle - ? _self.contentTextStyle - : contentTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - actionsPadding: freezed == actionsPadding - ? _self.actionsPadding - : actionsPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacDialogTheme]. -extension StacDialogThemePatterns on StacDialogTheme { - /// 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(_StacDialogTheme value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacDialogTheme() 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(_StacDialogTheme value) $default, - ) { - final _that = this; - switch (_that) { - case _StacDialogTheme(): - 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(_StacDialogTheme value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacDialogTheme() 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? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacBorder? shape, - StacAlignmentGeometry? alignment, - StacTextStyle? titleTextStyle, - StacTextStyle? contentTextStyle, - StacEdgeInsets? actionsPadding, - String? iconColor)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacDialogTheme() when $default != null: - return $default( - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.alignment, - _that.titleTextStyle, - _that.contentTextStyle, - _that.actionsPadding, - _that.iconColor); - 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? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacBorder? shape, - StacAlignmentGeometry? alignment, - StacTextStyle? titleTextStyle, - StacTextStyle? contentTextStyle, - StacEdgeInsets? actionsPadding, - String? iconColor) - $default, - ) { - final _that = this; - switch (_that) { - case _StacDialogTheme(): - return $default( - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.alignment, - _that.titleTextStyle, - _that.contentTextStyle, - _that.actionsPadding, - _that.iconColor); - 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? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacBorder? shape, - StacAlignmentGeometry? alignment, - StacTextStyle? titleTextStyle, - StacTextStyle? contentTextStyle, - StacEdgeInsets? actionsPadding, - String? iconColor)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacDialogTheme() when $default != null: - return $default( - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.alignment, - _that.titleTextStyle, - _that.contentTextStyle, - _that.actionsPadding, - _that.iconColor); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacDialogTheme implements StacDialogTheme { - const _StacDialogTheme( - {this.backgroundColor, - this.elevation, - this.shadowColor, - this.surfaceTintColor, - this.shape, - this.alignment, - this.titleTextStyle, - this.contentTextStyle, - this.actionsPadding, - this.iconColor}); - factory _StacDialogTheme.fromJson(Map json) => - _$StacDialogThemeFromJson(json); - - @override - final String? backgroundColor; - @override - final double? elevation; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final StacBorder? shape; - @override - final StacAlignmentGeometry? alignment; - @override - final StacTextStyle? titleTextStyle; - @override - final StacTextStyle? contentTextStyle; - @override - final StacEdgeInsets? actionsPadding; - @override - final String? iconColor; - - /// Create a copy of StacDialogTheme - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacDialogThemeCopyWith<_StacDialogTheme> get copyWith => - __$StacDialogThemeCopyWithImpl<_StacDialogTheme>(this, _$identity); - - @override - Map toJson() { - return _$StacDialogThemeToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacDialogTheme && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.alignment, alignment) || - other.alignment == alignment) && - (identical(other.titleTextStyle, titleTextStyle) || - other.titleTextStyle == titleTextStyle) && - (identical(other.contentTextStyle, contentTextStyle) || - other.contentTextStyle == contentTextStyle) && - (identical(other.actionsPadding, actionsPadding) || - other.actionsPadding == actionsPadding) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - elevation, - shadowColor, - surfaceTintColor, - shape, - alignment, - titleTextStyle, - contentTextStyle, - actionsPadding, - iconColor); - - @override - String toString() { - return 'StacDialogTheme(backgroundColor: $backgroundColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, shape: $shape, alignment: $alignment, titleTextStyle: $titleTextStyle, contentTextStyle: $contentTextStyle, actionsPadding: $actionsPadding, iconColor: $iconColor)'; - } -} - -/// @nodoc -abstract mixin class _$StacDialogThemeCopyWith<$Res> - implements $StacDialogThemeCopyWith<$Res> { - factory _$StacDialogThemeCopyWith( - _StacDialogTheme value, $Res Function(_StacDialogTheme) _then) = - __$StacDialogThemeCopyWithImpl; - @override - @useResult - $Res call( - {String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacBorder? shape, - StacAlignmentGeometry? alignment, - StacTextStyle? titleTextStyle, - StacTextStyle? contentTextStyle, - StacEdgeInsets? actionsPadding, - String? iconColor}); -} - -/// @nodoc -class __$StacDialogThemeCopyWithImpl<$Res> - implements _$StacDialogThemeCopyWith<$Res> { - __$StacDialogThemeCopyWithImpl(this._self, this._then); - - final _StacDialogTheme _self; - final $Res Function(_StacDialogTheme) _then; - - /// Create a copy of StacDialogTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? shape = freezed, - Object? alignment = freezed, - Object? titleTextStyle = freezed, - Object? contentTextStyle = freezed, - Object? actionsPadding = freezed, - Object? iconColor = freezed, - }) { - return _then(_StacDialogTheme( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - alignment: freezed == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignmentGeometry?, - titleTextStyle: freezed == titleTextStyle - ? _self.titleTextStyle - : titleTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - contentTextStyle: freezed == contentTextStyle - ? _self.contentTextStyle - : contentTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - actionsPadding: freezed == actionsPadding - ? _self.actionsPadding - : actionsPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_dialog_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_dialog_theme_data_parser.dart new file mode 100644 index 000000000..12dda014b --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_dialog_theme_data_parser.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/alignment/stac_alignment_geometry_parser.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_border_parser.dart'; +import 'package:stac/src/parsers/foundation/geometry/stac_box_constraints_parser.dart'; +import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; +import 'package:stac/src/parsers/foundation/layout/stac_clip_parser.dart'; +import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacDialogThemeData]. +/// +/// Converts [StacDialogThemeData] to Flutter's [DialogThemeData]. +extension StacDialogThemeDataParser on StacDialogThemeData { + DialogThemeData parse(BuildContext context) { + return DialogThemeData( + backgroundColor: backgroundColor?.toColor(context), + elevation: elevation, + shadowColor: shadowColor?.toColor(context), + surfaceTintColor: surfaceTintColor?.toColor(context), + shape: shape?.parse(context), + alignment: alignment?.parse, + iconColor: iconColor?.toColor(context), + titleTextStyle: titleTextStyle?.parse(context), + contentTextStyle: contentTextStyle?.parse(context), + actionsPadding: actionsPadding?.parse, + barrierColor: barrierColor?.toColor(context), + insetPadding: insetPadding?.parse, + clipBehavior: clipBehavior?.parse, + constraints: constraints?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_dialog_theme_parser.dart b/packages/stac/lib/src/parsers/theme/stac_dialog_theme_parser.dart new file mode 100644 index 000000000..aaf0eb25b --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_dialog_theme_parser.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/alignment/stac_alignment_geometry_parser.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_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'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacDialogTheme]. +/// +/// Converts [StacDialogTheme] to Flutter's [DialogTheme]. +extension StacDialogThemeParser on StacDialogTheme { + DialogTheme? parse(BuildContext context) { + return DialogTheme( + backgroundColor: backgroundColor?.toColor(context), + elevation: elevation, + shadowColor: shadowColor?.toColor(context), + surfaceTintColor: surfaceTintColor?.toColor(context), + shape: shape?.parse(context), + alignment: alignment?.parse, + titleTextStyle: titleTextStyle?.parse(context), + contentTextStyle: contentTextStyle?.parse(context), + actionsPadding: actionsPadding?.parse, + iconColor: iconColor?.toColor(context), + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.dart deleted file mode 100644 index b1188ed7e..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/utils/color_utils.dart'; - -part 'stac_divider_theme_data.freezed.dart'; -part 'stac_divider_theme_data.g.dart'; - -@freezed -abstract class StacDividerThemeData with _$StacDividerThemeData { - const factory StacDividerThemeData({ - String? color, - double? space, - double? thickness, - double? indent, - double? endIndent, - }) = _StacDividerThemeData; - - factory StacDividerThemeData.fromJson(Map json) => - _$StacDividerThemeDataFromJson(json); -} - -extension StacDividerThemeDataParser on StacDividerThemeData { - DividerThemeData parse(BuildContext context) { - return DividerThemeData( - color: color?.toColor(context), - space: space, - thickness: thickness, - indent: indent, - endIndent: endIndent, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart deleted file mode 100644 index 80bc0bcd7..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart +++ /dev/null @@ -1,403 +0,0 @@ -// 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 - -part of 'stac_divider_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacDividerThemeData { - String? get color; - double? get space; - double? get thickness; - double? get indent; - double? get endIndent; - - /// Create a copy of StacDividerThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacDividerThemeDataCopyWith get copyWith => - _$StacDividerThemeDataCopyWithImpl( - this as StacDividerThemeData, _$identity); - - /// Serializes this StacDividerThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacDividerThemeData && - (identical(other.color, color) || other.color == color) && - (identical(other.space, space) || other.space == space) && - (identical(other.thickness, thickness) || - other.thickness == thickness) && - (identical(other.indent, indent) || other.indent == indent) && - (identical(other.endIndent, endIndent) || - other.endIndent == endIndent)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, color, space, thickness, indent, endIndent); - - @override - String toString() { - return 'StacDividerThemeData(color: $color, space: $space, thickness: $thickness, indent: $indent, endIndent: $endIndent)'; - } -} - -/// @nodoc -abstract mixin class $StacDividerThemeDataCopyWith<$Res> { - factory $StacDividerThemeDataCopyWith(StacDividerThemeData value, - $Res Function(StacDividerThemeData) _then) = - _$StacDividerThemeDataCopyWithImpl; - @useResult - $Res call( - {String? color, - double? space, - double? thickness, - double? indent, - double? endIndent}); -} - -/// @nodoc -class _$StacDividerThemeDataCopyWithImpl<$Res> - implements $StacDividerThemeDataCopyWith<$Res> { - _$StacDividerThemeDataCopyWithImpl(this._self, this._then); - - final StacDividerThemeData _self; - final $Res Function(StacDividerThemeData) _then; - - /// Create a copy of StacDividerThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? color = freezed, - Object? space = freezed, - Object? thickness = freezed, - Object? indent = freezed, - Object? endIndent = freezed, - }) { - return _then(_self.copyWith( - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - space: freezed == space - ? _self.space - : space // ignore: cast_nullable_to_non_nullable - as double?, - thickness: freezed == thickness - ? _self.thickness - : thickness // ignore: cast_nullable_to_non_nullable - as double?, - indent: freezed == indent - ? _self.indent - : indent // ignore: cast_nullable_to_non_nullable - as double?, - endIndent: freezed == endIndent - ? _self.endIndent - : endIndent // ignore: cast_nullable_to_non_nullable - as double?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacDividerThemeData]. -extension StacDividerThemeDataPatterns on StacDividerThemeData { - /// 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(_StacDividerThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacDividerThemeData() 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(_StacDividerThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacDividerThemeData(): - 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(_StacDividerThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacDividerThemeData() 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? color, double? space, double? thickness, - double? indent, double? endIndent)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacDividerThemeData() when $default != null: - return $default(_that.color, _that.space, _that.thickness, _that.indent, - _that.endIndent); - 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? color, double? space, double? thickness, - double? indent, double? endIndent) - $default, - ) { - final _that = this; - switch (_that) { - case _StacDividerThemeData(): - return $default(_that.color, _that.space, _that.thickness, _that.indent, - _that.endIndent); - 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? color, double? space, double? thickness, - double? indent, double? endIndent)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacDividerThemeData() when $default != null: - return $default(_that.color, _that.space, _that.thickness, _that.indent, - _that.endIndent); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacDividerThemeData implements StacDividerThemeData { - const _StacDividerThemeData( - {this.color, this.space, this.thickness, this.indent, this.endIndent}); - factory _StacDividerThemeData.fromJson(Map json) => - _$StacDividerThemeDataFromJson(json); - - @override - final String? color; - @override - final double? space; - @override - final double? thickness; - @override - final double? indent; - @override - final double? endIndent; - - /// Create a copy of StacDividerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacDividerThemeDataCopyWith<_StacDividerThemeData> get copyWith => - __$StacDividerThemeDataCopyWithImpl<_StacDividerThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacDividerThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacDividerThemeData && - (identical(other.color, color) || other.color == color) && - (identical(other.space, space) || other.space == space) && - (identical(other.thickness, thickness) || - other.thickness == thickness) && - (identical(other.indent, indent) || other.indent == indent) && - (identical(other.endIndent, endIndent) || - other.endIndent == endIndent)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, color, space, thickness, indent, endIndent); - - @override - String toString() { - return 'StacDividerThemeData(color: $color, space: $space, thickness: $thickness, indent: $indent, endIndent: $endIndent)'; - } -} - -/// @nodoc -abstract mixin class _$StacDividerThemeDataCopyWith<$Res> - implements $StacDividerThemeDataCopyWith<$Res> { - factory _$StacDividerThemeDataCopyWith(_StacDividerThemeData value, - $Res Function(_StacDividerThemeData) _then) = - __$StacDividerThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? color, - double? space, - double? thickness, - double? indent, - double? endIndent}); -} - -/// @nodoc -class __$StacDividerThemeDataCopyWithImpl<$Res> - implements _$StacDividerThemeDataCopyWith<$Res> { - __$StacDividerThemeDataCopyWithImpl(this._self, this._then); - - final _StacDividerThemeData _self; - final $Res Function(_StacDividerThemeData) _then; - - /// Create a copy of StacDividerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? color = freezed, - Object? space = freezed, - Object? thickness = freezed, - Object? indent = freezed, - Object? endIndent = freezed, - }) { - return _then(_StacDividerThemeData( - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - space: freezed == space - ? _self.space - : space // ignore: cast_nullable_to_non_nullable - as double?, - thickness: freezed == thickness - ? _self.thickness - : thickness // ignore: cast_nullable_to_non_nullable - as double?, - indent: freezed == indent - ? _self.indent - : indent // ignore: cast_nullable_to_non_nullable - as double?, - endIndent: freezed == endIndent - ? _self.endIndent - : endIndent // ignore: cast_nullable_to_non_nullable - as double?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.g.dart deleted file mode 100644 index 40232c3fd..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.g.dart +++ /dev/null @@ -1,27 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_divider_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacDividerThemeData _$StacDividerThemeDataFromJson( - Map json) => - _StacDividerThemeData( - color: json['color'] as String?, - space: (json['space'] as num?)?.toDouble(), - thickness: (json['thickness'] as num?)?.toDouble(), - indent: (json['indent'] as num?)?.toDouble(), - endIndent: (json['endIndent'] as num?)?.toDouble(), - ); - -Map _$StacDividerThemeDataToJson( - _StacDividerThemeData instance) => - { - 'color': instance.color, - 'space': instance.space, - 'thickness': instance.thickness, - 'indent': instance.indent, - 'endIndent': instance.endIndent, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_divider_theme_data_parser.dart new file mode 100644 index 000000000..232584007 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_divider_theme_data_parser.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacDividerThemeData]. +/// +/// Converts [StacDividerThemeData] to Flutter's [DividerThemeData]. +extension StacDividerThemeDataParser on StacDividerThemeData { + DividerThemeData parse(BuildContext context) { + return DividerThemeData( + color: color?.toColor(context), + space: space, + thickness: thickness, + indent: indent, + endIndent: endIndent, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart deleted file mode 100644 index a86536664..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_shape_border_parser.dart'; -import 'package:stac/stac.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_drawer_theme_data.freezed.dart'; -part 'stac_drawer_theme_data.g.dart'; - -@freezed -abstract class StacDrawerThemeData with _$StacDrawerThemeData { - const factory StacDrawerThemeData({ - String? backgroundColor, - String? scrimColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacShapeBorder? endShape, - double? width, - Clip? clipBehavior, - }) = _StacDrawerThemeData; - - factory StacDrawerThemeData.fromJson(Map json) => - _$StacDrawerThemeDataFromJson(json); -} - -extension StacDrawerThemeDataParser on StacDrawerThemeData { - DrawerThemeData parse(BuildContext context) { - return DrawerThemeData( - backgroundColor: backgroundColor?.toColor(context), - scrimColor: scrimColor?.toColor(context), - elevation: elevation, - shadowColor: shadowColor?.toColor(context), - surfaceTintColor: surfaceTintColor?.toColor(context), - shape: shape?.parse(context), - endShape: endShape?.parse(context), - width: width, - clipBehavior: clipBehavior, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.freezed.dart deleted file mode 100644 index 7ae58b87f..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.freezed.dart +++ /dev/null @@ -1,555 +0,0 @@ -// 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 - -part of 'stac_drawer_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacDrawerThemeData { - String? get backgroundColor; - String? get scrimColor; - double? get elevation; - String? get shadowColor; - String? get surfaceTintColor; - StacShapeBorder? get shape; - StacShapeBorder? get endShape; - double? get width; - Clip? get clipBehavior; - - /// Create a copy of StacDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacDrawerThemeDataCopyWith get copyWith => - _$StacDrawerThemeDataCopyWithImpl( - this as StacDrawerThemeData, _$identity); - - /// Serializes this StacDrawerThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacDrawerThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.scrimColor, scrimColor) || - other.scrimColor == scrimColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.endShape, endShape) || - other.endShape == endShape) && - (identical(other.width, width) || other.width == width) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - scrimColor, - elevation, - shadowColor, - surfaceTintColor, - shape, - endShape, - width, - clipBehavior); - - @override - String toString() { - return 'StacDrawerThemeData(backgroundColor: $backgroundColor, scrimColor: $scrimColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, shape: $shape, endShape: $endShape, width: $width, clipBehavior: $clipBehavior)'; - } -} - -/// @nodoc -abstract mixin class $StacDrawerThemeDataCopyWith<$Res> { - factory $StacDrawerThemeDataCopyWith( - StacDrawerThemeData value, $Res Function(StacDrawerThemeData) _then) = - _$StacDrawerThemeDataCopyWithImpl; - @useResult - $Res call( - {String? backgroundColor, - String? scrimColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacShapeBorder? endShape, - double? width, - Clip? clipBehavior}); -} - -/// @nodoc -class _$StacDrawerThemeDataCopyWithImpl<$Res> - implements $StacDrawerThemeDataCopyWith<$Res> { - _$StacDrawerThemeDataCopyWithImpl(this._self, this._then); - - final StacDrawerThemeData _self; - final $Res Function(StacDrawerThemeData) _then; - - /// Create a copy of StacDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? backgroundColor = freezed, - Object? scrimColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? shape = freezed, - Object? endShape = freezed, - Object? width = freezed, - Object? clipBehavior = freezed, - }) { - return _then(_self.copyWith( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - scrimColor: freezed == scrimColor - ? _self.scrimColor - : scrimColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - endShape: freezed == endShape - ? _self.endShape - : endShape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - width: freezed == width - ? _self.width - : width // ignore: cast_nullable_to_non_nullable - as double?, - clipBehavior: freezed == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacDrawerThemeData]. -extension StacDrawerThemeDataPatterns on StacDrawerThemeData { - /// 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(_StacDrawerThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacDrawerThemeData() 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(_StacDrawerThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacDrawerThemeData(): - 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(_StacDrawerThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacDrawerThemeData() 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? backgroundColor, - String? scrimColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacShapeBorder? endShape, - double? width, - Clip? clipBehavior)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacDrawerThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.scrimColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.endShape, - _that.width, - _that.clipBehavior); - 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? backgroundColor, - String? scrimColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacShapeBorder? endShape, - double? width, - Clip? clipBehavior) - $default, - ) { - final _that = this; - switch (_that) { - case _StacDrawerThemeData(): - return $default( - _that.backgroundColor, - _that.scrimColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.endShape, - _that.width, - _that.clipBehavior); - 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? backgroundColor, - String? scrimColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacShapeBorder? endShape, - double? width, - Clip? clipBehavior)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacDrawerThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.scrimColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.shape, - _that.endShape, - _that.width, - _that.clipBehavior); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacDrawerThemeData implements StacDrawerThemeData { - const _StacDrawerThemeData( - {this.backgroundColor, - this.scrimColor, - this.elevation, - this.shadowColor, - this.surfaceTintColor, - this.shape, - this.endShape, - this.width, - this.clipBehavior}); - factory _StacDrawerThemeData.fromJson(Map json) => - _$StacDrawerThemeDataFromJson(json); - - @override - final String? backgroundColor; - @override - final String? scrimColor; - @override - final double? elevation; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final StacShapeBorder? shape; - @override - final StacShapeBorder? endShape; - @override - final double? width; - @override - final Clip? clipBehavior; - - /// Create a copy of StacDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacDrawerThemeDataCopyWith<_StacDrawerThemeData> get copyWith => - __$StacDrawerThemeDataCopyWithImpl<_StacDrawerThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacDrawerThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacDrawerThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.scrimColor, scrimColor) || - other.scrimColor == scrimColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.endShape, endShape) || - other.endShape == endShape) && - (identical(other.width, width) || other.width == width) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - scrimColor, - elevation, - shadowColor, - surfaceTintColor, - shape, - endShape, - width, - clipBehavior); - - @override - String toString() { - return 'StacDrawerThemeData(backgroundColor: $backgroundColor, scrimColor: $scrimColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, shape: $shape, endShape: $endShape, width: $width, clipBehavior: $clipBehavior)'; - } -} - -/// @nodoc -abstract mixin class _$StacDrawerThemeDataCopyWith<$Res> - implements $StacDrawerThemeDataCopyWith<$Res> { - factory _$StacDrawerThemeDataCopyWith(_StacDrawerThemeData value, - $Res Function(_StacDrawerThemeData) _then) = - __$StacDrawerThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? backgroundColor, - String? scrimColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - StacShapeBorder? shape, - StacShapeBorder? endShape, - double? width, - Clip? clipBehavior}); -} - -/// @nodoc -class __$StacDrawerThemeDataCopyWithImpl<$Res> - implements _$StacDrawerThemeDataCopyWith<$Res> { - __$StacDrawerThemeDataCopyWithImpl(this._self, this._then); - - final _StacDrawerThemeData _self; - final $Res Function(_StacDrawerThemeData) _then; - - /// Create a copy of StacDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? backgroundColor = freezed, - Object? scrimColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? shape = freezed, - Object? endShape = freezed, - Object? width = freezed, - Object? clipBehavior = freezed, - }) { - return _then(_StacDrawerThemeData( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - scrimColor: freezed == scrimColor - ? _self.scrimColor - : scrimColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - endShape: freezed == endShape - ? _self.endShape - : endShape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - width: freezed == width - ? _self.width - : width // ignore: cast_nullable_to_non_nullable - as double?, - clipBehavior: freezed == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data_parser.dart new file mode 100644 index 000000000..02484bcae --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data_parser.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/borders/stac_shape_border_parser.dart'; +import 'package:stac/src/parsers/foundation/layout/stac_clip_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacDrawerThemeData]. +/// +/// Converts [StacDrawerThemeData] to Flutter's [DrawerThemeData]. +extension StacDrawerThemeDataParser on StacDrawerThemeData { + DrawerThemeData parse(BuildContext context) { + return DrawerThemeData( + backgroundColor: backgroundColor?.toColor(context), + scrimColor: scrimColor?.toColor(context), + elevation: elevation, + shadowColor: shadowColor?.toColor(context), + surfaceTintColor: surfaceTintColor?.toColor(context), + shape: shape?.parse(context), + endShape: endShape?.parse(context), + width: width, + clipBehavior: clipBehavior?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart deleted file mode 100644 index be625706e..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.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'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_floating_action_button_theme_data.freezed.dart'; -part 'stac_floating_action_button_theme_data.g.dart'; - -@freezed -abstract class StacFloatingActionButtonThemeData - with _$StacFloatingActionButtonThemeData { - const factory StacFloatingActionButtonThemeData({ - String? foregroundColor, - String? backgroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - double? elevation, - double? focusElevation, - double? hoverElevation, - double? disabledElevation, - double? highlightElevation, - bool? enableFeedback, - double? iconSize, - double? extendedIconLabelSpacing, - StacEdgeInsets? extendedPadding, - StacTextStyle? extendedTextStyle, - }) = _StacFloatingActionButtonThemeData; - - factory StacFloatingActionButtonThemeData.fromJson( - Map json) => - _$StacFloatingActionButtonThemeDataFromJson(json); -} - -extension StacFloatingActionThemeParser on StacFloatingActionButtonThemeData { - FloatingActionButtonThemeData parse(BuildContext context) { - return FloatingActionButtonThemeData( - foregroundColor: foregroundColor.toColor(context), - backgroundColor: backgroundColor.toColor(context), - focusColor: focusColor.toColor(context), - hoverColor: hoverColor.toColor(context), - splashColor: splashColor.toColor(context), - elevation: elevation, - focusElevation: focusElevation, - hoverElevation: hoverElevation, - disabledElevation: disabledElevation, - highlightElevation: highlightElevation, - enableFeedback: enableFeedback, - iconSize: iconSize, - extendedIconLabelSpacing: extendedIconLabelSpacing, - extendedPadding: extendedPadding?.parse, - extendedTextStyle: extendedTextStyle?.parse(context), - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.freezed.dart deleted file mode 100644 index 0b2ecaf7f..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.freezed.dart +++ /dev/null @@ -1,736 +0,0 @@ -// 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 - -part of 'stac_floating_action_button_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacFloatingActionButtonThemeData { - String? get foregroundColor; - String? get backgroundColor; - String? get focusColor; - String? get hoverColor; - String? get splashColor; - double? get elevation; - double? get focusElevation; - double? get hoverElevation; - double? get disabledElevation; - double? get highlightElevation; - bool? get enableFeedback; - double? get iconSize; - double? get extendedIconLabelSpacing; - StacEdgeInsets? get extendedPadding; - StacTextStyle? get extendedTextStyle; - - /// Create a copy of StacFloatingActionButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacFloatingActionButtonThemeDataCopyWith - get copyWith => _$StacFloatingActionButtonThemeDataCopyWithImpl< - StacFloatingActionButtonThemeData>( - this as StacFloatingActionButtonThemeData, _$identity); - - /// Serializes this StacFloatingActionButtonThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacFloatingActionButtonThemeData && - (identical(other.foregroundColor, foregroundColor) || - other.foregroundColor == foregroundColor) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.focusElevation, focusElevation) || - other.focusElevation == focusElevation) && - (identical(other.hoverElevation, hoverElevation) || - other.hoverElevation == hoverElevation) && - (identical(other.disabledElevation, disabledElevation) || - other.disabledElevation == disabledElevation) && - (identical(other.highlightElevation, highlightElevation) || - other.highlightElevation == highlightElevation) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.iconSize, iconSize) || - other.iconSize == iconSize) && - (identical( - other.extendedIconLabelSpacing, extendedIconLabelSpacing) || - other.extendedIconLabelSpacing == extendedIconLabelSpacing) && - (identical(other.extendedPadding, extendedPadding) || - other.extendedPadding == extendedPadding) && - (identical(other.extendedTextStyle, extendedTextStyle) || - other.extendedTextStyle == extendedTextStyle)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - foregroundColor, - backgroundColor, - focusColor, - hoverColor, - splashColor, - elevation, - focusElevation, - hoverElevation, - disabledElevation, - highlightElevation, - enableFeedback, - iconSize, - extendedIconLabelSpacing, - extendedPadding, - extendedTextStyle); - - @override - String toString() { - return 'StacFloatingActionButtonThemeData(foregroundColor: $foregroundColor, backgroundColor: $backgroundColor, focusColor: $focusColor, hoverColor: $hoverColor, splashColor: $splashColor, elevation: $elevation, focusElevation: $focusElevation, hoverElevation: $hoverElevation, disabledElevation: $disabledElevation, highlightElevation: $highlightElevation, enableFeedback: $enableFeedback, iconSize: $iconSize, extendedIconLabelSpacing: $extendedIconLabelSpacing, extendedPadding: $extendedPadding, extendedTextStyle: $extendedTextStyle)'; - } -} - -/// @nodoc -abstract mixin class $StacFloatingActionButtonThemeDataCopyWith<$Res> { - factory $StacFloatingActionButtonThemeDataCopyWith( - StacFloatingActionButtonThemeData value, - $Res Function(StacFloatingActionButtonThemeData) _then) = - _$StacFloatingActionButtonThemeDataCopyWithImpl; - @useResult - $Res call( - {String? foregroundColor, - String? backgroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - double? elevation, - double? focusElevation, - double? hoverElevation, - double? disabledElevation, - double? highlightElevation, - bool? enableFeedback, - double? iconSize, - double? extendedIconLabelSpacing, - StacEdgeInsets? extendedPadding, - StacTextStyle? extendedTextStyle}); -} - -/// @nodoc -class _$StacFloatingActionButtonThemeDataCopyWithImpl<$Res> - implements $StacFloatingActionButtonThemeDataCopyWith<$Res> { - _$StacFloatingActionButtonThemeDataCopyWithImpl(this._self, this._then); - - final StacFloatingActionButtonThemeData _self; - final $Res Function(StacFloatingActionButtonThemeData) _then; - - /// Create a copy of StacFloatingActionButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? foregroundColor = freezed, - Object? backgroundColor = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? splashColor = freezed, - Object? elevation = freezed, - Object? focusElevation = freezed, - Object? hoverElevation = freezed, - Object? disabledElevation = freezed, - Object? highlightElevation = freezed, - Object? enableFeedback = freezed, - Object? iconSize = freezed, - Object? extendedIconLabelSpacing = freezed, - Object? extendedPadding = freezed, - Object? extendedTextStyle = freezed, - }) { - return _then(_self.copyWith( - foregroundColor: freezed == foregroundColor - ? _self.foregroundColor - : foregroundColor // ignore: cast_nullable_to_non_nullable - as String?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - focusElevation: freezed == focusElevation - ? _self.focusElevation - : focusElevation // ignore: cast_nullable_to_non_nullable - as double?, - hoverElevation: freezed == hoverElevation - ? _self.hoverElevation - : hoverElevation // ignore: cast_nullable_to_non_nullable - as double?, - disabledElevation: freezed == disabledElevation - ? _self.disabledElevation - : disabledElevation // ignore: cast_nullable_to_non_nullable - as double?, - highlightElevation: freezed == highlightElevation - ? _self.highlightElevation - : highlightElevation // ignore: cast_nullable_to_non_nullable - as double?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - iconSize: freezed == iconSize - ? _self.iconSize - : iconSize // ignore: cast_nullable_to_non_nullable - as double?, - extendedIconLabelSpacing: freezed == extendedIconLabelSpacing - ? _self.extendedIconLabelSpacing - : extendedIconLabelSpacing // ignore: cast_nullable_to_non_nullable - as double?, - extendedPadding: freezed == extendedPadding - ? _self.extendedPadding - : extendedPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - extendedTextStyle: freezed == extendedTextStyle - ? _self.extendedTextStyle - : extendedTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacFloatingActionButtonThemeData]. -extension StacFloatingActionButtonThemeDataPatterns - on StacFloatingActionButtonThemeData { - /// 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(_StacFloatingActionButtonThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacFloatingActionButtonThemeData() 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(_StacFloatingActionButtonThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacFloatingActionButtonThemeData(): - 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(_StacFloatingActionButtonThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacFloatingActionButtonThemeData() 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? foregroundColor, - String? backgroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - double? elevation, - double? focusElevation, - double? hoverElevation, - double? disabledElevation, - double? highlightElevation, - bool? enableFeedback, - double? iconSize, - double? extendedIconLabelSpacing, - StacEdgeInsets? extendedPadding, - StacTextStyle? extendedTextStyle)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacFloatingActionButtonThemeData() when $default != null: - return $default( - _that.foregroundColor, - _that.backgroundColor, - _that.focusColor, - _that.hoverColor, - _that.splashColor, - _that.elevation, - _that.focusElevation, - _that.hoverElevation, - _that.disabledElevation, - _that.highlightElevation, - _that.enableFeedback, - _that.iconSize, - _that.extendedIconLabelSpacing, - _that.extendedPadding, - _that.extendedTextStyle); - 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? foregroundColor, - String? backgroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - double? elevation, - double? focusElevation, - double? hoverElevation, - double? disabledElevation, - double? highlightElevation, - bool? enableFeedback, - double? iconSize, - double? extendedIconLabelSpacing, - StacEdgeInsets? extendedPadding, - StacTextStyle? extendedTextStyle) - $default, - ) { - final _that = this; - switch (_that) { - case _StacFloatingActionButtonThemeData(): - return $default( - _that.foregroundColor, - _that.backgroundColor, - _that.focusColor, - _that.hoverColor, - _that.splashColor, - _that.elevation, - _that.focusElevation, - _that.hoverElevation, - _that.disabledElevation, - _that.highlightElevation, - _that.enableFeedback, - _that.iconSize, - _that.extendedIconLabelSpacing, - _that.extendedPadding, - _that.extendedTextStyle); - 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? foregroundColor, - String? backgroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - double? elevation, - double? focusElevation, - double? hoverElevation, - double? disabledElevation, - double? highlightElevation, - bool? enableFeedback, - double? iconSize, - double? extendedIconLabelSpacing, - StacEdgeInsets? extendedPadding, - StacTextStyle? extendedTextStyle)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacFloatingActionButtonThemeData() when $default != null: - return $default( - _that.foregroundColor, - _that.backgroundColor, - _that.focusColor, - _that.hoverColor, - _that.splashColor, - _that.elevation, - _that.focusElevation, - _that.hoverElevation, - _that.disabledElevation, - _that.highlightElevation, - _that.enableFeedback, - _that.iconSize, - _that.extendedIconLabelSpacing, - _that.extendedPadding, - _that.extendedTextStyle); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacFloatingActionButtonThemeData - implements StacFloatingActionButtonThemeData { - const _StacFloatingActionButtonThemeData( - {this.foregroundColor, - this.backgroundColor, - this.focusColor, - this.hoverColor, - this.splashColor, - this.elevation, - this.focusElevation, - this.hoverElevation, - this.disabledElevation, - this.highlightElevation, - this.enableFeedback, - this.iconSize, - this.extendedIconLabelSpacing, - this.extendedPadding, - this.extendedTextStyle}); - factory _StacFloatingActionButtonThemeData.fromJson( - Map json) => - _$StacFloatingActionButtonThemeDataFromJson(json); - - @override - final String? foregroundColor; - @override - final String? backgroundColor; - @override - final String? focusColor; - @override - final String? hoverColor; - @override - final String? splashColor; - @override - final double? elevation; - @override - final double? focusElevation; - @override - final double? hoverElevation; - @override - final double? disabledElevation; - @override - final double? highlightElevation; - @override - final bool? enableFeedback; - @override - final double? iconSize; - @override - final double? extendedIconLabelSpacing; - @override - final StacEdgeInsets? extendedPadding; - @override - final StacTextStyle? extendedTextStyle; - - /// Create a copy of StacFloatingActionButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacFloatingActionButtonThemeDataCopyWith< - _StacFloatingActionButtonThemeData> - get copyWith => __$StacFloatingActionButtonThemeDataCopyWithImpl< - _StacFloatingActionButtonThemeData>(this, _$identity); - - @override - Map toJson() { - return _$StacFloatingActionButtonThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacFloatingActionButtonThemeData && - (identical(other.foregroundColor, foregroundColor) || - other.foregroundColor == foregroundColor) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.focusElevation, focusElevation) || - other.focusElevation == focusElevation) && - (identical(other.hoverElevation, hoverElevation) || - other.hoverElevation == hoverElevation) && - (identical(other.disabledElevation, disabledElevation) || - other.disabledElevation == disabledElevation) && - (identical(other.highlightElevation, highlightElevation) || - other.highlightElevation == highlightElevation) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.iconSize, iconSize) || - other.iconSize == iconSize) && - (identical( - other.extendedIconLabelSpacing, extendedIconLabelSpacing) || - other.extendedIconLabelSpacing == extendedIconLabelSpacing) && - (identical(other.extendedPadding, extendedPadding) || - other.extendedPadding == extendedPadding) && - (identical(other.extendedTextStyle, extendedTextStyle) || - other.extendedTextStyle == extendedTextStyle)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - foregroundColor, - backgroundColor, - focusColor, - hoverColor, - splashColor, - elevation, - focusElevation, - hoverElevation, - disabledElevation, - highlightElevation, - enableFeedback, - iconSize, - extendedIconLabelSpacing, - extendedPadding, - extendedTextStyle); - - @override - String toString() { - return 'StacFloatingActionButtonThemeData(foregroundColor: $foregroundColor, backgroundColor: $backgroundColor, focusColor: $focusColor, hoverColor: $hoverColor, splashColor: $splashColor, elevation: $elevation, focusElevation: $focusElevation, hoverElevation: $hoverElevation, disabledElevation: $disabledElevation, highlightElevation: $highlightElevation, enableFeedback: $enableFeedback, iconSize: $iconSize, extendedIconLabelSpacing: $extendedIconLabelSpacing, extendedPadding: $extendedPadding, extendedTextStyle: $extendedTextStyle)'; - } -} - -/// @nodoc -abstract mixin class _$StacFloatingActionButtonThemeDataCopyWith<$Res> - implements $StacFloatingActionButtonThemeDataCopyWith<$Res> { - factory _$StacFloatingActionButtonThemeDataCopyWith( - _StacFloatingActionButtonThemeData value, - $Res Function(_StacFloatingActionButtonThemeData) _then) = - __$StacFloatingActionButtonThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? foregroundColor, - String? backgroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - double? elevation, - double? focusElevation, - double? hoverElevation, - double? disabledElevation, - double? highlightElevation, - bool? enableFeedback, - double? iconSize, - double? extendedIconLabelSpacing, - StacEdgeInsets? extendedPadding, - StacTextStyle? extendedTextStyle}); -} - -/// @nodoc -class __$StacFloatingActionButtonThemeDataCopyWithImpl<$Res> - implements _$StacFloatingActionButtonThemeDataCopyWith<$Res> { - __$StacFloatingActionButtonThemeDataCopyWithImpl(this._self, this._then); - - final _StacFloatingActionButtonThemeData _self; - final $Res Function(_StacFloatingActionButtonThemeData) _then; - - /// Create a copy of StacFloatingActionButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? foregroundColor = freezed, - Object? backgroundColor = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? splashColor = freezed, - Object? elevation = freezed, - Object? focusElevation = freezed, - Object? hoverElevation = freezed, - Object? disabledElevation = freezed, - Object? highlightElevation = freezed, - Object? enableFeedback = freezed, - Object? iconSize = freezed, - Object? extendedIconLabelSpacing = freezed, - Object? extendedPadding = freezed, - Object? extendedTextStyle = freezed, - }) { - return _then(_StacFloatingActionButtonThemeData( - foregroundColor: freezed == foregroundColor - ? _self.foregroundColor - : foregroundColor // ignore: cast_nullable_to_non_nullable - as String?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - focusElevation: freezed == focusElevation - ? _self.focusElevation - : focusElevation // ignore: cast_nullable_to_non_nullable - as double?, - hoverElevation: freezed == hoverElevation - ? _self.hoverElevation - : hoverElevation // ignore: cast_nullable_to_non_nullable - as double?, - disabledElevation: freezed == disabledElevation - ? _self.disabledElevation - : disabledElevation // ignore: cast_nullable_to_non_nullable - as double?, - highlightElevation: freezed == highlightElevation - ? _self.highlightElevation - : highlightElevation // ignore: cast_nullable_to_non_nullable - as double?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - iconSize: freezed == iconSize - ? _self.iconSize - : iconSize // ignore: cast_nullable_to_non_nullable - as double?, - extendedIconLabelSpacing: freezed == extendedIconLabelSpacing - ? _self.extendedIconLabelSpacing - : extendedIconLabelSpacing // ignore: cast_nullable_to_non_nullable - as double?, - extendedPadding: freezed == extendedPadding - ? _self.extendedPadding - : extendedPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - extendedTextStyle: freezed == extendedTextStyle - ? _self.extendedTextStyle - : extendedTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.g.dart deleted file mode 100644 index 16bbee493..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.g.dart +++ /dev/null @@ -1,52 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_floating_action_button_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacFloatingActionButtonThemeData _$StacFloatingActionButtonThemeDataFromJson( - Map json) => - _StacFloatingActionButtonThemeData( - foregroundColor: json['foregroundColor'] as String?, - backgroundColor: json['backgroundColor'] as String?, - focusColor: json['focusColor'] as String?, - hoverColor: json['hoverColor'] as String?, - splashColor: json['splashColor'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - focusElevation: (json['focusElevation'] as num?)?.toDouble(), - hoverElevation: (json['hoverElevation'] as num?)?.toDouble(), - disabledElevation: (json['disabledElevation'] as num?)?.toDouble(), - highlightElevation: (json['highlightElevation'] as num?)?.toDouble(), - enableFeedback: json['enableFeedback'] as bool?, - iconSize: (json['iconSize'] as num?)?.toDouble(), - extendedIconLabelSpacing: - (json['extendedIconLabelSpacing'] as num?)?.toDouble(), - extendedPadding: json['extendedPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['extendedPadding']), - extendedTextStyle: json['extendedTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['extendedTextStyle']), - ); - -Map _$StacFloatingActionButtonThemeDataToJson( - _StacFloatingActionButtonThemeData instance) => - { - 'foregroundColor': instance.foregroundColor, - 'backgroundColor': instance.backgroundColor, - 'focusColor': instance.focusColor, - 'hoverColor': instance.hoverColor, - 'splashColor': instance.splashColor, - 'elevation': instance.elevation, - 'focusElevation': instance.focusElevation, - 'hoverElevation': instance.hoverElevation, - 'disabledElevation': instance.disabledElevation, - 'highlightElevation': instance.highlightElevation, - 'enableFeedback': instance.enableFeedback, - 'iconSize': instance.iconSize, - 'extendedIconLabelSpacing': instance.extendedIconLabelSpacing, - 'extendedPadding': instance.extendedPadding, - 'extendedTextStyle': instance.extendedTextStyle, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data_parser.dart new file mode 100644 index 000000000..d45fcd753 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data_parser.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.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'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacFloatingActionButtonThemeData]. +/// +/// Converts [StacFloatingActionButtonThemeData] to Flutter's [FloatingActionButtonThemeData]. +extension StacFloatingActionThemeParser on StacFloatingActionButtonThemeData { + FloatingActionButtonThemeData parse(BuildContext context) { + return FloatingActionButtonThemeData( + foregroundColor: foregroundColor?.toColor(context), + backgroundColor: backgroundColor?.toColor(context), + focusColor: focusColor?.toColor(context), + hoverColor: hoverColor?.toColor(context), + splashColor: splashColor?.toColor(context), + elevation: elevation, + focusElevation: focusElevation, + hoverElevation: hoverElevation, + disabledElevation: disabledElevation, + highlightElevation: highlightElevation, + enableFeedback: enableFeedback, + iconSize: iconSize, + extendedIconLabelSpacing: extendedIconLabelSpacing, + extendedPadding: extendedPadding?.parse, + extendedTextStyle: extendedTextStyle?.parse(context), + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart deleted file mode 100644 index f273dcd83..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/effects/stac_shadow_parser.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_icon_theme_data.freezed.dart'; -part 'stac_icon_theme_data.g.dart'; - -@freezed -abstract class StacIconThemeData with _$StacIconThemeData { - const factory StacIconThemeData({ - double? size, - double? fill, - double? weight, - double? grade, - double? opticalSize, - String? color, - double? opacity, - List? shadows, - }) = _StacIconThemeData; - - factory StacIconThemeData.fromJson(Map json) => - _$StacIconThemeDataFromJson(json); -} - -extension StacIconThemeDataParser on StacIconThemeData { - IconThemeData? parse(BuildContext context) { - return IconThemeData( - size: size, - fill: fill, - weight: weight, - grade: grade, - opticalSize: opticalSize, - color: color.toColor(context), - opacity: opacity, - shadows: shadows?.map((shadow) => shadow.parse(context)).toList(), - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.freezed.dart deleted file mode 100644 index a04913159..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.freezed.dart +++ /dev/null @@ -1,503 +0,0 @@ -// 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 - -part of 'stac_icon_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacIconThemeData { - double? get size; - double? get fill; - double? get weight; - double? get grade; - double? get opticalSize; - String? get color; - double? get opacity; - List? get shadows; - - /// Create a copy of StacIconThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith get copyWith => - _$StacIconThemeDataCopyWithImpl( - this as StacIconThemeData, _$identity); - - /// Serializes this StacIconThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacIconThemeData && - (identical(other.size, size) || other.size == size) && - (identical(other.fill, fill) || other.fill == fill) && - (identical(other.weight, weight) || other.weight == weight) && - (identical(other.grade, grade) || other.grade == grade) && - (identical(other.opticalSize, opticalSize) || - other.opticalSize == opticalSize) && - (identical(other.color, color) || other.color == color) && - (identical(other.opacity, opacity) || other.opacity == opacity) && - const DeepCollectionEquality().equals(other.shadows, shadows)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - size, - fill, - weight, - grade, - opticalSize, - color, - opacity, - const DeepCollectionEquality().hash(shadows)); - - @override - String toString() { - return 'StacIconThemeData(size: $size, fill: $fill, weight: $weight, grade: $grade, opticalSize: $opticalSize, color: $color, opacity: $opacity, shadows: $shadows)'; - } -} - -/// @nodoc -abstract mixin class $StacIconThemeDataCopyWith<$Res> { - factory $StacIconThemeDataCopyWith( - StacIconThemeData value, $Res Function(StacIconThemeData) _then) = - _$StacIconThemeDataCopyWithImpl; - @useResult - $Res call( - {double? size, - double? fill, - double? weight, - double? grade, - double? opticalSize, - String? color, - double? opacity, - List? shadows}); -} - -/// @nodoc -class _$StacIconThemeDataCopyWithImpl<$Res> - implements $StacIconThemeDataCopyWith<$Res> { - _$StacIconThemeDataCopyWithImpl(this._self, this._then); - - final StacIconThemeData _self; - final $Res Function(StacIconThemeData) _then; - - /// Create a copy of StacIconThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? size = freezed, - Object? fill = freezed, - Object? weight = freezed, - Object? grade = freezed, - Object? opticalSize = freezed, - Object? color = freezed, - Object? opacity = freezed, - Object? shadows = freezed, - }) { - return _then(_self.copyWith( - size: freezed == size - ? _self.size - : size // ignore: cast_nullable_to_non_nullable - as double?, - fill: freezed == fill - ? _self.fill - : fill // ignore: cast_nullable_to_non_nullable - as double?, - weight: freezed == weight - ? _self.weight - : weight // ignore: cast_nullable_to_non_nullable - as double?, - grade: freezed == grade - ? _self.grade - : grade // ignore: cast_nullable_to_non_nullable - as double?, - opticalSize: freezed == opticalSize - ? _self.opticalSize - : opticalSize // ignore: cast_nullable_to_non_nullable - as double?, - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - opacity: freezed == opacity - ? _self.opacity - : opacity // ignore: cast_nullable_to_non_nullable - as double?, - shadows: freezed == shadows - ? _self.shadows - : shadows // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacIconThemeData]. -extension StacIconThemeDataPatterns on StacIconThemeData { - /// 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(_StacIconThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacIconThemeData() 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(_StacIconThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacIconThemeData(): - 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(_StacIconThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacIconThemeData() 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( - double? size, - double? fill, - double? weight, - double? grade, - double? opticalSize, - String? color, - double? opacity, - List? shadows)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacIconThemeData() when $default != null: - return $default(_that.size, _that.fill, _that.weight, _that.grade, - _that.opticalSize, _that.color, _that.opacity, _that.shadows); - 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( - double? size, - double? fill, - double? weight, - double? grade, - double? opticalSize, - String? color, - double? opacity, - List? shadows) - $default, - ) { - final _that = this; - switch (_that) { - case _StacIconThemeData(): - return $default(_that.size, _that.fill, _that.weight, _that.grade, - _that.opticalSize, _that.color, _that.opacity, _that.shadows); - 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( - double? size, - double? fill, - double? weight, - double? grade, - double? opticalSize, - String? color, - double? opacity, - List? shadows)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacIconThemeData() when $default != null: - return $default(_that.size, _that.fill, _that.weight, _that.grade, - _that.opticalSize, _that.color, _that.opacity, _that.shadows); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacIconThemeData implements StacIconThemeData { - const _StacIconThemeData( - {this.size, - this.fill, - this.weight, - this.grade, - this.opticalSize, - this.color, - this.opacity, - final List? shadows}) - : _shadows = shadows; - factory _StacIconThemeData.fromJson(Map json) => - _$StacIconThemeDataFromJson(json); - - @override - final double? size; - @override - final double? fill; - @override - final double? weight; - @override - final double? grade; - @override - final double? opticalSize; - @override - final String? color; - @override - final double? opacity; - final List? _shadows; - @override - List? get shadows { - final value = _shadows; - if (value == null) return null; - if (_shadows is EqualUnmodifiableListView) return _shadows; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - /// Create a copy of StacIconThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacIconThemeDataCopyWith<_StacIconThemeData> get copyWith => - __$StacIconThemeDataCopyWithImpl<_StacIconThemeData>(this, _$identity); - - @override - Map toJson() { - return _$StacIconThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacIconThemeData && - (identical(other.size, size) || other.size == size) && - (identical(other.fill, fill) || other.fill == fill) && - (identical(other.weight, weight) || other.weight == weight) && - (identical(other.grade, grade) || other.grade == grade) && - (identical(other.opticalSize, opticalSize) || - other.opticalSize == opticalSize) && - (identical(other.color, color) || other.color == color) && - (identical(other.opacity, opacity) || other.opacity == opacity) && - const DeepCollectionEquality().equals(other._shadows, _shadows)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - size, - fill, - weight, - grade, - opticalSize, - color, - opacity, - const DeepCollectionEquality().hash(_shadows)); - - @override - String toString() { - return 'StacIconThemeData(size: $size, fill: $fill, weight: $weight, grade: $grade, opticalSize: $opticalSize, color: $color, opacity: $opacity, shadows: $shadows)'; - } -} - -/// @nodoc -abstract mixin class _$StacIconThemeDataCopyWith<$Res> - implements $StacIconThemeDataCopyWith<$Res> { - factory _$StacIconThemeDataCopyWith( - _StacIconThemeData value, $Res Function(_StacIconThemeData) _then) = - __$StacIconThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {double? size, - double? fill, - double? weight, - double? grade, - double? opticalSize, - String? color, - double? opacity, - List? shadows}); -} - -/// @nodoc -class __$StacIconThemeDataCopyWithImpl<$Res> - implements _$StacIconThemeDataCopyWith<$Res> { - __$StacIconThemeDataCopyWithImpl(this._self, this._then); - - final _StacIconThemeData _self; - final $Res Function(_StacIconThemeData) _then; - - /// Create a copy of StacIconThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? size = freezed, - Object? fill = freezed, - Object? weight = freezed, - Object? grade = freezed, - Object? opticalSize = freezed, - Object? color = freezed, - Object? opacity = freezed, - Object? shadows = freezed, - }) { - return _then(_StacIconThemeData( - size: freezed == size - ? _self.size - : size // ignore: cast_nullable_to_non_nullable - as double?, - fill: freezed == fill - ? _self.fill - : fill // ignore: cast_nullable_to_non_nullable - as double?, - weight: freezed == weight - ? _self.weight - : weight // ignore: cast_nullable_to_non_nullable - as double?, - grade: freezed == grade - ? _self.grade - : grade // ignore: cast_nullable_to_non_nullable - as double?, - opticalSize: freezed == opticalSize - ? _self.opticalSize - : opticalSize // ignore: cast_nullable_to_non_nullable - as double?, - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - opacity: freezed == opacity - ? _self.opacity - : opacity // ignore: cast_nullable_to_non_nullable - as double?, - shadows: freezed == shadows - ? _self._shadows - : shadows // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_icon_theme_data_parser.dart new file mode 100644 index 000000000..61fee2235 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_icon_theme_data_parser.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/effects/stac_shadow_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacIconThemeData]. +/// +/// Converts [StacIconThemeData] to Flutter's [IconThemeData]. +extension StacIconThemeDataParser on StacIconThemeData { + IconThemeData? parse(BuildContext context) { + return IconThemeData( + size: size, + fill: fill, + weight: weight, + grade: grade, + opticalSize: opticalSize, + color: color?.toColor(context), + opacity: opacity, + shadows: shadows?.map((shadow) => shadow.parse(context)).toList(), + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart deleted file mode 100644 index fb09f46ef..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_border_parser.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; -import 'package:stac/src/parsers/foundation/geometry/stac_visual_density_parser.dart'; -import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_list_tile_theme_data.freezed.dart'; -part 'stac_list_tile_theme_data.g.dart'; - -@freezed -abstract class StacListTileThemeData with _$StacListTileThemeData { - const factory StacListTileThemeData({ - bool? dense, - StacBorder? shape, - ListTileStyle? style, - String? selectedColor, - String? iconColor, - String? textColor, - StacTextStyle? titleTextStyle, - StacTextStyle? subtitleTextStyle, - StacTextStyle? leadingAndTrailingTextStyle, - StacEdgeInsets? contentPadding, - String? tileColor, - String? selectedTileColor, - double? horizontalTitleGap, - double? minVerticalPadding, - double? minLeadingWidth, - bool? enableFeedback, - StacVisualDensity? visualDensity, - ListTileTitleAlignment? titleAlignment, - List? shadows, - }) = _StacListTileThemeData; - - factory StacListTileThemeData.fromJson(Map json) => - _$StacListTileThemeDataFromJson(json); -} - -extension StacListTileThemeDataParser on StacListTileThemeData { - ListTileThemeData parse(BuildContext context) { - return ListTileThemeData( - dense: dense, - shape: shape?.parse(context), - style: style, - selectedColor: selectedColor.toColor(context), - iconColor: iconColor.toColor(context), - textColor: textColor.toColor(context), - titleTextStyle: titleTextStyle?.parse(context), - subtitleTextStyle: subtitleTextStyle?.parse(context), - leadingAndTrailingTextStyle: leadingAndTrailingTextStyle?.parse(context), - contentPadding: contentPadding?.parse, - tileColor: tileColor.toColor(context), - selectedTileColor: selectedTileColor.toColor(context), - horizontalTitleGap: horizontalTitleGap, - minVerticalPadding: minVerticalPadding, - minLeadingWidth: minLeadingWidth, - enableFeedback: enableFeedback, - visualDensity: visualDensity?.parse, - titleAlignment: titleAlignment, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart deleted file mode 100644 index 1f5df04b2..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart +++ /dev/null @@ -1,845 +0,0 @@ -// 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 - -part of 'stac_list_tile_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacListTileThemeData { - bool? get dense; - StacBorder? get shape; - ListTileStyle? get style; - String? get selectedColor; - String? get iconColor; - String? get textColor; - StacTextStyle? get titleTextStyle; - StacTextStyle? get subtitleTextStyle; - StacTextStyle? get leadingAndTrailingTextStyle; - StacEdgeInsets? get contentPadding; - String? get tileColor; - String? get selectedTileColor; - double? get horizontalTitleGap; - double? get minVerticalPadding; - double? get minLeadingWidth; - bool? get enableFeedback; - StacVisualDensity? get visualDensity; - ListTileTitleAlignment? get titleAlignment; - List? get shadows; - - /// Create a copy of StacListTileThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacListTileThemeDataCopyWith get copyWith => - _$StacListTileThemeDataCopyWithImpl( - this as StacListTileThemeData, _$identity); - - /// Serializes this StacListTileThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacListTileThemeData && - (identical(other.dense, dense) || other.dense == dense) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.style, style) || other.style == style) && - (identical(other.selectedColor, selectedColor) || - other.selectedColor == selectedColor) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor) && - (identical(other.textColor, textColor) || - other.textColor == textColor) && - (identical(other.titleTextStyle, titleTextStyle) || - other.titleTextStyle == titleTextStyle) && - (identical(other.subtitleTextStyle, subtitleTextStyle) || - other.subtitleTextStyle == subtitleTextStyle) && - (identical(other.leadingAndTrailingTextStyle, - leadingAndTrailingTextStyle) || - other.leadingAndTrailingTextStyle == - leadingAndTrailingTextStyle) && - (identical(other.contentPadding, contentPadding) || - other.contentPadding == contentPadding) && - (identical(other.tileColor, tileColor) || - other.tileColor == tileColor) && - (identical(other.selectedTileColor, selectedTileColor) || - other.selectedTileColor == selectedTileColor) && - (identical(other.horizontalTitleGap, horizontalTitleGap) || - other.horizontalTitleGap == horizontalTitleGap) && - (identical(other.minVerticalPadding, minVerticalPadding) || - other.minVerticalPadding == minVerticalPadding) && - (identical(other.minLeadingWidth, minLeadingWidth) || - other.minLeadingWidth == minLeadingWidth) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.visualDensity, visualDensity) || - other.visualDensity == visualDensity) && - (identical(other.titleAlignment, titleAlignment) || - other.titleAlignment == titleAlignment) && - const DeepCollectionEquality().equals(other.shadows, shadows)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - dense, - shape, - style, - selectedColor, - iconColor, - textColor, - titleTextStyle, - subtitleTextStyle, - leadingAndTrailingTextStyle, - contentPadding, - tileColor, - selectedTileColor, - horizontalTitleGap, - minVerticalPadding, - minLeadingWidth, - enableFeedback, - visualDensity, - titleAlignment, - const DeepCollectionEquality().hash(shadows) - ]); - - @override - String toString() { - return 'StacListTileThemeData(dense: $dense, shape: $shape, style: $style, selectedColor: $selectedColor, iconColor: $iconColor, textColor: $textColor, titleTextStyle: $titleTextStyle, subtitleTextStyle: $subtitleTextStyle, leadingAndTrailingTextStyle: $leadingAndTrailingTextStyle, contentPadding: $contentPadding, tileColor: $tileColor, selectedTileColor: $selectedTileColor, horizontalTitleGap: $horizontalTitleGap, minVerticalPadding: $minVerticalPadding, minLeadingWidth: $minLeadingWidth, enableFeedback: $enableFeedback, visualDensity: $visualDensity, titleAlignment: $titleAlignment, shadows: $shadows)'; - } -} - -/// @nodoc -abstract mixin class $StacListTileThemeDataCopyWith<$Res> { - factory $StacListTileThemeDataCopyWith(StacListTileThemeData value, - $Res Function(StacListTileThemeData) _then) = - _$StacListTileThemeDataCopyWithImpl; - @useResult - $Res call( - {bool? dense, - StacBorder? shape, - ListTileStyle? style, - String? selectedColor, - String? iconColor, - String? textColor, - StacTextStyle? titleTextStyle, - StacTextStyle? subtitleTextStyle, - StacTextStyle? leadingAndTrailingTextStyle, - StacEdgeInsets? contentPadding, - String? tileColor, - String? selectedTileColor, - double? horizontalTitleGap, - double? minVerticalPadding, - double? minLeadingWidth, - bool? enableFeedback, - StacVisualDensity? visualDensity, - ListTileTitleAlignment? titleAlignment, - List? shadows}); -} - -/// @nodoc -class _$StacListTileThemeDataCopyWithImpl<$Res> - implements $StacListTileThemeDataCopyWith<$Res> { - _$StacListTileThemeDataCopyWithImpl(this._self, this._then); - - final StacListTileThemeData _self; - final $Res Function(StacListTileThemeData) _then; - - /// Create a copy of StacListTileThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? dense = freezed, - Object? shape = freezed, - Object? style = freezed, - Object? selectedColor = freezed, - Object? iconColor = freezed, - Object? textColor = freezed, - Object? titleTextStyle = freezed, - Object? subtitleTextStyle = freezed, - Object? leadingAndTrailingTextStyle = freezed, - Object? contentPadding = freezed, - Object? tileColor = freezed, - Object? selectedTileColor = freezed, - Object? horizontalTitleGap = freezed, - Object? minVerticalPadding = freezed, - Object? minLeadingWidth = freezed, - Object? enableFeedback = freezed, - Object? visualDensity = freezed, - Object? titleAlignment = freezed, - Object? shadows = freezed, - }) { - return _then(_self.copyWith( - dense: freezed == dense - ? _self.dense - : dense // ignore: cast_nullable_to_non_nullable - as bool?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as ListTileStyle?, - selectedColor: freezed == selectedColor - ? _self.selectedColor - : selectedColor // ignore: cast_nullable_to_non_nullable - as String?, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - textColor: freezed == textColor - ? _self.textColor - : textColor // ignore: cast_nullable_to_non_nullable - as String?, - titleTextStyle: freezed == titleTextStyle - ? _self.titleTextStyle - : titleTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - subtitleTextStyle: freezed == subtitleTextStyle - ? _self.subtitleTextStyle - : subtitleTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - leadingAndTrailingTextStyle: freezed == leadingAndTrailingTextStyle - ? _self.leadingAndTrailingTextStyle - : leadingAndTrailingTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - contentPadding: freezed == contentPadding - ? _self.contentPadding - : contentPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - tileColor: freezed == tileColor - ? _self.tileColor - : tileColor // ignore: cast_nullable_to_non_nullable - as String?, - selectedTileColor: freezed == selectedTileColor - ? _self.selectedTileColor - : selectedTileColor // ignore: cast_nullable_to_non_nullable - as String?, - horizontalTitleGap: freezed == horizontalTitleGap - ? _self.horizontalTitleGap - : horizontalTitleGap // ignore: cast_nullable_to_non_nullable - as double?, - minVerticalPadding: freezed == minVerticalPadding - ? _self.minVerticalPadding - : minVerticalPadding // ignore: cast_nullable_to_non_nullable - as double?, - minLeadingWidth: freezed == minLeadingWidth - ? _self.minLeadingWidth - : minLeadingWidth // ignore: cast_nullable_to_non_nullable - as double?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - visualDensity: freezed == visualDensity - ? _self.visualDensity - : visualDensity // ignore: cast_nullable_to_non_nullable - as StacVisualDensity?, - titleAlignment: freezed == titleAlignment - ? _self.titleAlignment - : titleAlignment // ignore: cast_nullable_to_non_nullable - as ListTileTitleAlignment?, - shadows: freezed == shadows - ? _self.shadows - : shadows // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacListTileThemeData]. -extension StacListTileThemeDataPatterns on StacListTileThemeData { - /// 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(_StacListTileThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacListTileThemeData() 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(_StacListTileThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacListTileThemeData(): - 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(_StacListTileThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacListTileThemeData() 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( - bool? dense, - StacBorder? shape, - ListTileStyle? style, - String? selectedColor, - String? iconColor, - String? textColor, - StacTextStyle? titleTextStyle, - StacTextStyle? subtitleTextStyle, - StacTextStyle? leadingAndTrailingTextStyle, - StacEdgeInsets? contentPadding, - String? tileColor, - String? selectedTileColor, - double? horizontalTitleGap, - double? minVerticalPadding, - double? minLeadingWidth, - bool? enableFeedback, - StacVisualDensity? visualDensity, - ListTileTitleAlignment? titleAlignment, - List? shadows)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacListTileThemeData() when $default != null: - return $default( - _that.dense, - _that.shape, - _that.style, - _that.selectedColor, - _that.iconColor, - _that.textColor, - _that.titleTextStyle, - _that.subtitleTextStyle, - _that.leadingAndTrailingTextStyle, - _that.contentPadding, - _that.tileColor, - _that.selectedTileColor, - _that.horizontalTitleGap, - _that.minVerticalPadding, - _that.minLeadingWidth, - _that.enableFeedback, - _that.visualDensity, - _that.titleAlignment, - _that.shadows); - 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( - bool? dense, - StacBorder? shape, - ListTileStyle? style, - String? selectedColor, - String? iconColor, - String? textColor, - StacTextStyle? titleTextStyle, - StacTextStyle? subtitleTextStyle, - StacTextStyle? leadingAndTrailingTextStyle, - StacEdgeInsets? contentPadding, - String? tileColor, - String? selectedTileColor, - double? horizontalTitleGap, - double? minVerticalPadding, - double? minLeadingWidth, - bool? enableFeedback, - StacVisualDensity? visualDensity, - ListTileTitleAlignment? titleAlignment, - List? shadows) - $default, - ) { - final _that = this; - switch (_that) { - case _StacListTileThemeData(): - return $default( - _that.dense, - _that.shape, - _that.style, - _that.selectedColor, - _that.iconColor, - _that.textColor, - _that.titleTextStyle, - _that.subtitleTextStyle, - _that.leadingAndTrailingTextStyle, - _that.contentPadding, - _that.tileColor, - _that.selectedTileColor, - _that.horizontalTitleGap, - _that.minVerticalPadding, - _that.minLeadingWidth, - _that.enableFeedback, - _that.visualDensity, - _that.titleAlignment, - _that.shadows); - 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( - bool? dense, - StacBorder? shape, - ListTileStyle? style, - String? selectedColor, - String? iconColor, - String? textColor, - StacTextStyle? titleTextStyle, - StacTextStyle? subtitleTextStyle, - StacTextStyle? leadingAndTrailingTextStyle, - StacEdgeInsets? contentPadding, - String? tileColor, - String? selectedTileColor, - double? horizontalTitleGap, - double? minVerticalPadding, - double? minLeadingWidth, - bool? enableFeedback, - StacVisualDensity? visualDensity, - ListTileTitleAlignment? titleAlignment, - List? shadows)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacListTileThemeData() when $default != null: - return $default( - _that.dense, - _that.shape, - _that.style, - _that.selectedColor, - _that.iconColor, - _that.textColor, - _that.titleTextStyle, - _that.subtitleTextStyle, - _that.leadingAndTrailingTextStyle, - _that.contentPadding, - _that.tileColor, - _that.selectedTileColor, - _that.horizontalTitleGap, - _that.minVerticalPadding, - _that.minLeadingWidth, - _that.enableFeedback, - _that.visualDensity, - _that.titleAlignment, - _that.shadows); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacListTileThemeData implements StacListTileThemeData { - const _StacListTileThemeData( - {this.dense, - this.shape, - this.style, - this.selectedColor, - this.iconColor, - this.textColor, - this.titleTextStyle, - this.subtitleTextStyle, - this.leadingAndTrailingTextStyle, - this.contentPadding, - this.tileColor, - this.selectedTileColor, - this.horizontalTitleGap, - this.minVerticalPadding, - this.minLeadingWidth, - this.enableFeedback, - this.visualDensity, - this.titleAlignment, - final List? shadows}) - : _shadows = shadows; - factory _StacListTileThemeData.fromJson(Map json) => - _$StacListTileThemeDataFromJson(json); - - @override - final bool? dense; - @override - final StacBorder? shape; - @override - final ListTileStyle? style; - @override - final String? selectedColor; - @override - final String? iconColor; - @override - final String? textColor; - @override - final StacTextStyle? titleTextStyle; - @override - final StacTextStyle? subtitleTextStyle; - @override - final StacTextStyle? leadingAndTrailingTextStyle; - @override - final StacEdgeInsets? contentPadding; - @override - final String? tileColor; - @override - final String? selectedTileColor; - @override - final double? horizontalTitleGap; - @override - final double? minVerticalPadding; - @override - final double? minLeadingWidth; - @override - final bool? enableFeedback; - @override - final StacVisualDensity? visualDensity; - @override - final ListTileTitleAlignment? titleAlignment; - final List? _shadows; - @override - List? get shadows { - final value = _shadows; - if (value == null) return null; - if (_shadows is EqualUnmodifiableListView) return _shadows; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - /// Create a copy of StacListTileThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacListTileThemeDataCopyWith<_StacListTileThemeData> get copyWith => - __$StacListTileThemeDataCopyWithImpl<_StacListTileThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacListTileThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacListTileThemeData && - (identical(other.dense, dense) || other.dense == dense) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.style, style) || other.style == style) && - (identical(other.selectedColor, selectedColor) || - other.selectedColor == selectedColor) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor) && - (identical(other.textColor, textColor) || - other.textColor == textColor) && - (identical(other.titleTextStyle, titleTextStyle) || - other.titleTextStyle == titleTextStyle) && - (identical(other.subtitleTextStyle, subtitleTextStyle) || - other.subtitleTextStyle == subtitleTextStyle) && - (identical(other.leadingAndTrailingTextStyle, - leadingAndTrailingTextStyle) || - other.leadingAndTrailingTextStyle == - leadingAndTrailingTextStyle) && - (identical(other.contentPadding, contentPadding) || - other.contentPadding == contentPadding) && - (identical(other.tileColor, tileColor) || - other.tileColor == tileColor) && - (identical(other.selectedTileColor, selectedTileColor) || - other.selectedTileColor == selectedTileColor) && - (identical(other.horizontalTitleGap, horizontalTitleGap) || - other.horizontalTitleGap == horizontalTitleGap) && - (identical(other.minVerticalPadding, minVerticalPadding) || - other.minVerticalPadding == minVerticalPadding) && - (identical(other.minLeadingWidth, minLeadingWidth) || - other.minLeadingWidth == minLeadingWidth) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.visualDensity, visualDensity) || - other.visualDensity == visualDensity) && - (identical(other.titleAlignment, titleAlignment) || - other.titleAlignment == titleAlignment) && - const DeepCollectionEquality().equals(other._shadows, _shadows)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - dense, - shape, - style, - selectedColor, - iconColor, - textColor, - titleTextStyle, - subtitleTextStyle, - leadingAndTrailingTextStyle, - contentPadding, - tileColor, - selectedTileColor, - horizontalTitleGap, - minVerticalPadding, - minLeadingWidth, - enableFeedback, - visualDensity, - titleAlignment, - const DeepCollectionEquality().hash(_shadows) - ]); - - @override - String toString() { - return 'StacListTileThemeData(dense: $dense, shape: $shape, style: $style, selectedColor: $selectedColor, iconColor: $iconColor, textColor: $textColor, titleTextStyle: $titleTextStyle, subtitleTextStyle: $subtitleTextStyle, leadingAndTrailingTextStyle: $leadingAndTrailingTextStyle, contentPadding: $contentPadding, tileColor: $tileColor, selectedTileColor: $selectedTileColor, horizontalTitleGap: $horizontalTitleGap, minVerticalPadding: $minVerticalPadding, minLeadingWidth: $minLeadingWidth, enableFeedback: $enableFeedback, visualDensity: $visualDensity, titleAlignment: $titleAlignment, shadows: $shadows)'; - } -} - -/// @nodoc -abstract mixin class _$StacListTileThemeDataCopyWith<$Res> - implements $StacListTileThemeDataCopyWith<$Res> { - factory _$StacListTileThemeDataCopyWith(_StacListTileThemeData value, - $Res Function(_StacListTileThemeData) _then) = - __$StacListTileThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {bool? dense, - StacBorder? shape, - ListTileStyle? style, - String? selectedColor, - String? iconColor, - String? textColor, - StacTextStyle? titleTextStyle, - StacTextStyle? subtitleTextStyle, - StacTextStyle? leadingAndTrailingTextStyle, - StacEdgeInsets? contentPadding, - String? tileColor, - String? selectedTileColor, - double? horizontalTitleGap, - double? minVerticalPadding, - double? minLeadingWidth, - bool? enableFeedback, - StacVisualDensity? visualDensity, - ListTileTitleAlignment? titleAlignment, - List? shadows}); -} - -/// @nodoc -class __$StacListTileThemeDataCopyWithImpl<$Res> - implements _$StacListTileThemeDataCopyWith<$Res> { - __$StacListTileThemeDataCopyWithImpl(this._self, this._then); - - final _StacListTileThemeData _self; - final $Res Function(_StacListTileThemeData) _then; - - /// Create a copy of StacListTileThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? dense = freezed, - Object? shape = freezed, - Object? style = freezed, - Object? selectedColor = freezed, - Object? iconColor = freezed, - Object? textColor = freezed, - Object? titleTextStyle = freezed, - Object? subtitleTextStyle = freezed, - Object? leadingAndTrailingTextStyle = freezed, - Object? contentPadding = freezed, - Object? tileColor = freezed, - Object? selectedTileColor = freezed, - Object? horizontalTitleGap = freezed, - Object? minVerticalPadding = freezed, - Object? minLeadingWidth = freezed, - Object? enableFeedback = freezed, - Object? visualDensity = freezed, - Object? titleAlignment = freezed, - Object? shadows = freezed, - }) { - return _then(_StacListTileThemeData( - dense: freezed == dense - ? _self.dense - : dense // ignore: cast_nullable_to_non_nullable - as bool?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as ListTileStyle?, - selectedColor: freezed == selectedColor - ? _self.selectedColor - : selectedColor // ignore: cast_nullable_to_non_nullable - as String?, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - textColor: freezed == textColor - ? _self.textColor - : textColor // ignore: cast_nullable_to_non_nullable - as String?, - titleTextStyle: freezed == titleTextStyle - ? _self.titleTextStyle - : titleTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - subtitleTextStyle: freezed == subtitleTextStyle - ? _self.subtitleTextStyle - : subtitleTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - leadingAndTrailingTextStyle: freezed == leadingAndTrailingTextStyle - ? _self.leadingAndTrailingTextStyle - : leadingAndTrailingTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - contentPadding: freezed == contentPadding - ? _self.contentPadding - : contentPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - tileColor: freezed == tileColor - ? _self.tileColor - : tileColor // ignore: cast_nullable_to_non_nullable - as String?, - selectedTileColor: freezed == selectedTileColor - ? _self.selectedTileColor - : selectedTileColor // ignore: cast_nullable_to_non_nullable - as String?, - horizontalTitleGap: freezed == horizontalTitleGap - ? _self.horizontalTitleGap - : horizontalTitleGap // ignore: cast_nullable_to_non_nullable - as double?, - minVerticalPadding: freezed == minVerticalPadding - ? _self.minVerticalPadding - : minVerticalPadding // ignore: cast_nullable_to_non_nullable - as double?, - minLeadingWidth: freezed == minLeadingWidth - ? _self.minLeadingWidth - : minLeadingWidth // ignore: cast_nullable_to_non_nullable - as double?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - visualDensity: freezed == visualDensity - ? _self.visualDensity - : visualDensity // ignore: cast_nullable_to_non_nullable - as StacVisualDensity?, - titleAlignment: freezed == titleAlignment - ? _self.titleAlignment - : titleAlignment // ignore: cast_nullable_to_non_nullable - as ListTileTitleAlignment?, - shadows: freezed == shadows - ? _self._shadows - : shadows // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.g.dart deleted file mode 100644 index b09a1f016..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.g.dart +++ /dev/null @@ -1,85 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_list_tile_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacListTileThemeData _$StacListTileThemeDataFromJson( - Map json) => - _StacListTileThemeData( - dense: json['dense'] as bool?, - shape: json['shape'] == null - ? null - : StacBorder.fromJson(json['shape'] as Map), - style: $enumDecodeNullable(_$ListTileStyleEnumMap, json['style']), - selectedColor: json['selectedColor'] as String?, - iconColor: json['iconColor'] as String?, - textColor: json['textColor'] as String?, - titleTextStyle: json['titleTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['titleTextStyle']), - subtitleTextStyle: json['subtitleTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['subtitleTextStyle']), - leadingAndTrailingTextStyle: json['leadingAndTrailingTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['leadingAndTrailingTextStyle']), - contentPadding: json['contentPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['contentPadding']), - tileColor: json['tileColor'] as String?, - selectedTileColor: json['selectedTileColor'] as String?, - horizontalTitleGap: (json['horizontalTitleGap'] as num?)?.toDouble(), - minVerticalPadding: (json['minVerticalPadding'] as num?)?.toDouble(), - minLeadingWidth: (json['minLeadingWidth'] as num?)?.toDouble(), - enableFeedback: json['enableFeedback'] as bool?, - visualDensity: json['visualDensity'] == null - ? null - : StacVisualDensity.fromJson( - json['visualDensity'] as Map), - titleAlignment: $enumDecodeNullable( - _$ListTileTitleAlignmentEnumMap, json['titleAlignment']), - shadows: (json['shadows'] as List?) - ?.map((e) => StacShadow.fromJson(e as Map)) - .toList(), - ); - -Map _$StacListTileThemeDataToJson( - _StacListTileThemeData instance) => - { - 'dense': instance.dense, - 'shape': instance.shape, - 'style': _$ListTileStyleEnumMap[instance.style], - 'selectedColor': instance.selectedColor, - 'iconColor': instance.iconColor, - 'textColor': instance.textColor, - 'titleTextStyle': instance.titleTextStyle, - 'subtitleTextStyle': instance.subtitleTextStyle, - 'leadingAndTrailingTextStyle': instance.leadingAndTrailingTextStyle, - 'contentPadding': instance.contentPadding, - 'tileColor': instance.tileColor, - 'selectedTileColor': instance.selectedTileColor, - 'horizontalTitleGap': instance.horizontalTitleGap, - 'minVerticalPadding': instance.minVerticalPadding, - 'minLeadingWidth': instance.minLeadingWidth, - 'enableFeedback': instance.enableFeedback, - 'visualDensity': instance.visualDensity, - 'titleAlignment': - _$ListTileTitleAlignmentEnumMap[instance.titleAlignment], - 'shadows': instance.shadows, - }; - -const _$ListTileStyleEnumMap = { - ListTileStyle.list: 'list', - ListTileStyle.drawer: 'drawer', -}; - -const _$ListTileTitleAlignmentEnumMap = { - ListTileTitleAlignment.threeLine: 'threeLine', - ListTileTitleAlignment.titleHeight: 'titleHeight', - ListTileTitleAlignment.top: 'top', - ListTileTitleAlignment.center: 'center', - ListTileTitleAlignment.bottom: 'bottom', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data_parser.dart new file mode 100644 index 000000000..46058dee5 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data_parser.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/foundation.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacListTileThemeData]. +/// +/// Converts [StacListTileThemeData] to Flutter's [ListTileThemeData]. +extension StacListTileThemeDataParser on StacListTileThemeData { + ListTileThemeData parse(BuildContext context) { + return ListTileThemeData( + dense: dense, + shape: shape?.parse(context), + style: style?.parse, + selectedColor: selectedColor?.toColor(context), + iconColor: iconColor?.toColor(context), + textColor: textColor?.toColor(context), + titleTextStyle: titleTextStyle?.parse(context), + subtitleTextStyle: subtitleTextStyle?.parse(context), + leadingAndTrailingTextStyle: leadingAndTrailingTextStyle?.parse(context), + contentPadding: contentPadding?.parse, + tileColor: tileColor?.toColor(context), + selectedTileColor: selectedTileColor?.toColor(context), + horizontalTitleGap: horizontalTitleGap, + minVerticalPadding: minVerticalPadding, + minLeadingWidth: minLeadingWidth, + enableFeedback: enableFeedback, + visualDensity: visualDensity?.parse, + titleAlignment: titleAlignment?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.freezed.dart deleted file mode 100644 index c3277330a..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.freezed.dart +++ /dev/null @@ -1,532 +0,0 @@ -// 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 - -part of 'stac_material_banner_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacMaterialBannerThemeData { - String? get backgroundColor; - String? get surfaceTintColor; - String? get shadowColor; - String? get dividerColor; - StacTextStyle? get contentTextStyle; - double? get elevation; - StacEdgeInsets? get padding; - StacEdgeInsets? get leadingPadding; - - /// Create a copy of StacMaterialBannerThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacMaterialBannerThemeDataCopyWith - get copyWith => _$StacMaterialBannerThemeDataCopyWithImpl< - StacMaterialBannerThemeData>( - this as StacMaterialBannerThemeData, _$identity); - - /// Serializes this StacMaterialBannerThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacMaterialBannerThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.dividerColor, dividerColor) || - other.dividerColor == dividerColor) && - (identical(other.contentTextStyle, contentTextStyle) || - other.contentTextStyle == contentTextStyle) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.leadingPadding, leadingPadding) || - other.leadingPadding == leadingPadding)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - surfaceTintColor, - shadowColor, - dividerColor, - contentTextStyle, - elevation, - padding, - leadingPadding); - - @override - String toString() { - return 'StacMaterialBannerThemeData(backgroundColor: $backgroundColor, surfaceTintColor: $surfaceTintColor, shadowColor: $shadowColor, dividerColor: $dividerColor, contentTextStyle: $contentTextStyle, elevation: $elevation, padding: $padding, leadingPadding: $leadingPadding)'; - } -} - -/// @nodoc -abstract mixin class $StacMaterialBannerThemeDataCopyWith<$Res> { - factory $StacMaterialBannerThemeDataCopyWith( - StacMaterialBannerThemeData value, - $Res Function(StacMaterialBannerThemeData) _then) = - _$StacMaterialBannerThemeDataCopyWithImpl; - @useResult - $Res call( - {String? backgroundColor, - String? surfaceTintColor, - String? shadowColor, - String? dividerColor, - StacTextStyle? contentTextStyle, - double? elevation, - StacEdgeInsets? padding, - StacEdgeInsets? leadingPadding}); -} - -/// @nodoc -class _$StacMaterialBannerThemeDataCopyWithImpl<$Res> - implements $StacMaterialBannerThemeDataCopyWith<$Res> { - _$StacMaterialBannerThemeDataCopyWithImpl(this._self, this._then); - - final StacMaterialBannerThemeData _self; - final $Res Function(StacMaterialBannerThemeData) _then; - - /// Create a copy of StacMaterialBannerThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? backgroundColor = freezed, - Object? surfaceTintColor = freezed, - Object? shadowColor = freezed, - Object? dividerColor = freezed, - Object? contentTextStyle = freezed, - Object? elevation = freezed, - Object? padding = freezed, - Object? leadingPadding = freezed, - }) { - return _then(_self.copyWith( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - dividerColor: freezed == dividerColor - ? _self.dividerColor - : dividerColor // ignore: cast_nullable_to_non_nullable - as String?, - contentTextStyle: freezed == contentTextStyle - ? _self.contentTextStyle - : contentTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - leadingPadding: freezed == leadingPadding - ? _self.leadingPadding - : leadingPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacMaterialBannerThemeData]. -extension StacMaterialBannerThemeDataPatterns on StacMaterialBannerThemeData { - /// 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(_StacMaterialBannerThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacMaterialBannerThemeData() 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(_StacMaterialBannerThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacMaterialBannerThemeData(): - 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(_StacMaterialBannerThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacMaterialBannerThemeData() 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? backgroundColor, - String? surfaceTintColor, - String? shadowColor, - String? dividerColor, - StacTextStyle? contentTextStyle, - double? elevation, - StacEdgeInsets? padding, - StacEdgeInsets? leadingPadding)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacMaterialBannerThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.surfaceTintColor, - _that.shadowColor, - _that.dividerColor, - _that.contentTextStyle, - _that.elevation, - _that.padding, - _that.leadingPadding); - 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? backgroundColor, - String? surfaceTintColor, - String? shadowColor, - String? dividerColor, - StacTextStyle? contentTextStyle, - double? elevation, - StacEdgeInsets? padding, - StacEdgeInsets? leadingPadding) - $default, - ) { - final _that = this; - switch (_that) { - case _StacMaterialBannerThemeData(): - return $default( - _that.backgroundColor, - _that.surfaceTintColor, - _that.shadowColor, - _that.dividerColor, - _that.contentTextStyle, - _that.elevation, - _that.padding, - _that.leadingPadding); - 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? backgroundColor, - String? surfaceTintColor, - String? shadowColor, - String? dividerColor, - StacTextStyle? contentTextStyle, - double? elevation, - StacEdgeInsets? padding, - StacEdgeInsets? leadingPadding)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacMaterialBannerThemeData() when $default != null: - return $default( - _that.backgroundColor, - _that.surfaceTintColor, - _that.shadowColor, - _that.dividerColor, - _that.contentTextStyle, - _that.elevation, - _that.padding, - _that.leadingPadding); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacMaterialBannerThemeData implements StacMaterialBannerThemeData { - const _StacMaterialBannerThemeData( - {this.backgroundColor, - this.surfaceTintColor, - this.shadowColor, - this.dividerColor, - this.contentTextStyle, - this.elevation, - this.padding, - this.leadingPadding}); - factory _StacMaterialBannerThemeData.fromJson(Map json) => - _$StacMaterialBannerThemeDataFromJson(json); - - @override - final String? backgroundColor; - @override - final String? surfaceTintColor; - @override - final String? shadowColor; - @override - final String? dividerColor; - @override - final StacTextStyle? contentTextStyle; - @override - final double? elevation; - @override - final StacEdgeInsets? padding; - @override - final StacEdgeInsets? leadingPadding; - - /// Create a copy of StacMaterialBannerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacMaterialBannerThemeDataCopyWith<_StacMaterialBannerThemeData> - get copyWith => __$StacMaterialBannerThemeDataCopyWithImpl< - _StacMaterialBannerThemeData>(this, _$identity); - - @override - Map toJson() { - return _$StacMaterialBannerThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacMaterialBannerThemeData && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.dividerColor, dividerColor) || - other.dividerColor == dividerColor) && - (identical(other.contentTextStyle, contentTextStyle) || - other.contentTextStyle == contentTextStyle) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.leadingPadding, leadingPadding) || - other.leadingPadding == leadingPadding)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - backgroundColor, - surfaceTintColor, - shadowColor, - dividerColor, - contentTextStyle, - elevation, - padding, - leadingPadding); - - @override - String toString() { - return 'StacMaterialBannerThemeData(backgroundColor: $backgroundColor, surfaceTintColor: $surfaceTintColor, shadowColor: $shadowColor, dividerColor: $dividerColor, contentTextStyle: $contentTextStyle, elevation: $elevation, padding: $padding, leadingPadding: $leadingPadding)'; - } -} - -/// @nodoc -abstract mixin class _$StacMaterialBannerThemeDataCopyWith<$Res> - implements $StacMaterialBannerThemeDataCopyWith<$Res> { - factory _$StacMaterialBannerThemeDataCopyWith( - _StacMaterialBannerThemeData value, - $Res Function(_StacMaterialBannerThemeData) _then) = - __$StacMaterialBannerThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {String? backgroundColor, - String? surfaceTintColor, - String? shadowColor, - String? dividerColor, - StacTextStyle? contentTextStyle, - double? elevation, - StacEdgeInsets? padding, - StacEdgeInsets? leadingPadding}); -} - -/// @nodoc -class __$StacMaterialBannerThemeDataCopyWithImpl<$Res> - implements _$StacMaterialBannerThemeDataCopyWith<$Res> { - __$StacMaterialBannerThemeDataCopyWithImpl(this._self, this._then); - - final _StacMaterialBannerThemeData _self; - final $Res Function(_StacMaterialBannerThemeData) _then; - - /// Create a copy of StacMaterialBannerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? backgroundColor = freezed, - Object? surfaceTintColor = freezed, - Object? shadowColor = freezed, - Object? dividerColor = freezed, - Object? contentTextStyle = freezed, - Object? elevation = freezed, - Object? padding = freezed, - Object? leadingPadding = freezed, - }) { - return _then(_StacMaterialBannerThemeData( - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - dividerColor: freezed == dividerColor - ? _self.dividerColor - : dividerColor // ignore: cast_nullable_to_non_nullable - as String?, - contentTextStyle: freezed == contentTextStyle - ? _self.contentTextStyle - : contentTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - leadingPadding: freezed == leadingPadding - ? _self.leadingPadding - : leadingPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.g.dart deleted file mode 100644 index f014531c0..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.g.dart +++ /dev/null @@ -1,39 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_material_banner_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacMaterialBannerThemeData _$StacMaterialBannerThemeDataFromJson( - Map json) => - _StacMaterialBannerThemeData( - backgroundColor: json['backgroundColor'] as String?, - surfaceTintColor: json['surfaceTintColor'] as String?, - shadowColor: json['shadowColor'] as String?, - dividerColor: json['dividerColor'] as String?, - contentTextStyle: json['contentTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['contentTextStyle']), - elevation: (json['elevation'] as num?)?.toDouble(), - padding: json['padding'] == null - ? null - : StacEdgeInsets.fromJson(json['padding']), - leadingPadding: json['leadingPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['leadingPadding']), - ); - -Map _$StacMaterialBannerThemeDataToJson( - _StacMaterialBannerThemeData instance) => - { - 'backgroundColor': instance.backgroundColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'shadowColor': instance.shadowColor, - 'dividerColor': instance.dividerColor, - 'contentTextStyle': instance.contentTextStyle, - 'elevation': instance.elevation, - 'padding': instance.padding, - 'leadingPadding': instance.leadingPadding, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data_parser.dart similarity index 55% rename from packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart rename to packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data_parser.dart index c254de387..2b67034a0 100644 --- a/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data_parser.dart @@ -1,30 +1,12 @@ import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.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'; import 'package:stac_core/stac_core.dart'; -part 'stac_material_banner_theme_data.freezed.dart'; -part 'stac_material_banner_theme_data.g.dart'; - -@freezed -abstract class StacMaterialBannerThemeData with _$StacMaterialBannerThemeData { - const factory StacMaterialBannerThemeData({ - String? backgroundColor, - String? surfaceTintColor, - String? shadowColor, - String? dividerColor, - StacTextStyle? contentTextStyle, - double? elevation, - StacEdgeInsets? padding, - StacEdgeInsets? leadingPadding, - }) = _StacMaterialBannerThemeData; - - factory StacMaterialBannerThemeData.fromJson(Map json) => - _$StacMaterialBannerThemeDataFromJson(json); -} - +/// Parser extension for [StacMaterialBannerThemeData]. +/// +/// Converts [StacMaterialBannerThemeData] to Flutter's [MaterialBannerThemeData]. extension StacMaterialBannerThemeDataParser on StacMaterialBannerThemeData { MaterialBannerThemeData parse(BuildContext context) { return MaterialBannerThemeData( diff --git a/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart deleted file mode 100644 index 23cbf098f..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart +++ /dev/null @@ -1,610 +0,0 @@ -// 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 - -part of 'stac_material_color.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacMaterialColor { - String get primary; - String get shade50; - String get shade100; - String get shade200; - String get shade300; - String get shade400; - String get shade500; - String get shade600; - String get shade700; - String get shade800; - String get shade900; - - /// Create a copy of StacMaterialColor - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacMaterialColorCopyWith get copyWith => - _$StacMaterialColorCopyWithImpl( - this as StacMaterialColor, _$identity); - - /// Serializes this StacMaterialColor to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacMaterialColor && - (identical(other.primary, primary) || other.primary == primary) && - (identical(other.shade50, shade50) || other.shade50 == shade50) && - (identical(other.shade100, shade100) || - other.shade100 == shade100) && - (identical(other.shade200, shade200) || - other.shade200 == shade200) && - (identical(other.shade300, shade300) || - other.shade300 == shade300) && - (identical(other.shade400, shade400) || - other.shade400 == shade400) && - (identical(other.shade500, shade500) || - other.shade500 == shade500) && - (identical(other.shade600, shade600) || - other.shade600 == shade600) && - (identical(other.shade700, shade700) || - other.shade700 == shade700) && - (identical(other.shade800, shade800) || - other.shade800 == shade800) && - (identical(other.shade900, shade900) || - other.shade900 == shade900)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - primary, - shade50, - shade100, - shade200, - shade300, - shade400, - shade500, - shade600, - shade700, - shade800, - shade900); - - @override - String toString() { - return 'StacMaterialColor(primary: $primary, shade50: $shade50, shade100: $shade100, shade200: $shade200, shade300: $shade300, shade400: $shade400, shade500: $shade500, shade600: $shade600, shade700: $shade700, shade800: $shade800, shade900: $shade900)'; - } -} - -/// @nodoc -abstract mixin class $StacMaterialColorCopyWith<$Res> { - factory $StacMaterialColorCopyWith( - StacMaterialColor value, $Res Function(StacMaterialColor) _then) = - _$StacMaterialColorCopyWithImpl; - @useResult - $Res call( - {String primary, - String shade50, - String shade100, - String shade200, - String shade300, - String shade400, - String shade500, - String shade600, - String shade700, - String shade800, - String shade900}); -} - -/// @nodoc -class _$StacMaterialColorCopyWithImpl<$Res> - implements $StacMaterialColorCopyWith<$Res> { - _$StacMaterialColorCopyWithImpl(this._self, this._then); - - final StacMaterialColor _self; - final $Res Function(StacMaterialColor) _then; - - /// Create a copy of StacMaterialColor - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? primary = null, - Object? shade50 = null, - Object? shade100 = null, - Object? shade200 = null, - Object? shade300 = null, - Object? shade400 = null, - Object? shade500 = null, - Object? shade600 = null, - Object? shade700 = null, - Object? shade800 = null, - Object? shade900 = null, - }) { - return _then(_self.copyWith( - primary: null == primary - ? _self.primary - : primary // ignore: cast_nullable_to_non_nullable - as String, - shade50: null == shade50 - ? _self.shade50 - : shade50 // ignore: cast_nullable_to_non_nullable - as String, - shade100: null == shade100 - ? _self.shade100 - : shade100 // ignore: cast_nullable_to_non_nullable - as String, - shade200: null == shade200 - ? _self.shade200 - : shade200 // ignore: cast_nullable_to_non_nullable - as String, - shade300: null == shade300 - ? _self.shade300 - : shade300 // ignore: cast_nullable_to_non_nullable - as String, - shade400: null == shade400 - ? _self.shade400 - : shade400 // ignore: cast_nullable_to_non_nullable - as String, - shade500: null == shade500 - ? _self.shade500 - : shade500 // ignore: cast_nullable_to_non_nullable - as String, - shade600: null == shade600 - ? _self.shade600 - : shade600 // ignore: cast_nullable_to_non_nullable - as String, - shade700: null == shade700 - ? _self.shade700 - : shade700 // ignore: cast_nullable_to_non_nullable - as String, - shade800: null == shade800 - ? _self.shade800 - : shade800 // ignore: cast_nullable_to_non_nullable - as String, - shade900: null == shade900 - ? _self.shade900 - : shade900 // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -/// Adds pattern-matching-related methods to [StacMaterialColor]. -extension StacMaterialColorPatterns on StacMaterialColor { - /// 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(_StacMaterialColor value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacMaterialColor() 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(_StacMaterialColor value) $default, - ) { - final _that = this; - switch (_that) { - case _StacMaterialColor(): - 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(_StacMaterialColor value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacMaterialColor() 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 primary, - String shade50, - String shade100, - String shade200, - String shade300, - String shade400, - String shade500, - String shade600, - String shade700, - String shade800, - String shade900)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacMaterialColor() when $default != null: - return $default( - _that.primary, - _that.shade50, - _that.shade100, - _that.shade200, - _that.shade300, - _that.shade400, - _that.shade500, - _that.shade600, - _that.shade700, - _that.shade800, - _that.shade900); - 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 primary, - String shade50, - String shade100, - String shade200, - String shade300, - String shade400, - String shade500, - String shade600, - String shade700, - String shade800, - String shade900) - $default, - ) { - final _that = this; - switch (_that) { - case _StacMaterialColor(): - return $default( - _that.primary, - _that.shade50, - _that.shade100, - _that.shade200, - _that.shade300, - _that.shade400, - _that.shade500, - _that.shade600, - _that.shade700, - _that.shade800, - _that.shade900); - 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 primary, - String shade50, - String shade100, - String shade200, - String shade300, - String shade400, - String shade500, - String shade600, - String shade700, - String shade800, - String shade900)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacMaterialColor() when $default != null: - return $default( - _that.primary, - _that.shade50, - _that.shade100, - _that.shade200, - _that.shade300, - _that.shade400, - _that.shade500, - _that.shade600, - _that.shade700, - _that.shade800, - _that.shade900); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacMaterialColor implements StacMaterialColor { - const _StacMaterialColor( - {required this.primary, - required this.shade50, - required this.shade100, - required this.shade200, - required this.shade300, - required this.shade400, - required this.shade500, - required this.shade600, - required this.shade700, - required this.shade800, - required this.shade900}); - factory _StacMaterialColor.fromJson(Map json) => - _$StacMaterialColorFromJson(json); - - @override - final String primary; - @override - final String shade50; - @override - final String shade100; - @override - final String shade200; - @override - final String shade300; - @override - final String shade400; - @override - final String shade500; - @override - final String shade600; - @override - final String shade700; - @override - final String shade800; - @override - final String shade900; - - /// Create a copy of StacMaterialColor - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacMaterialColorCopyWith<_StacMaterialColor> get copyWith => - __$StacMaterialColorCopyWithImpl<_StacMaterialColor>(this, _$identity); - - @override - Map toJson() { - return _$StacMaterialColorToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacMaterialColor && - (identical(other.primary, primary) || other.primary == primary) && - (identical(other.shade50, shade50) || other.shade50 == shade50) && - (identical(other.shade100, shade100) || - other.shade100 == shade100) && - (identical(other.shade200, shade200) || - other.shade200 == shade200) && - (identical(other.shade300, shade300) || - other.shade300 == shade300) && - (identical(other.shade400, shade400) || - other.shade400 == shade400) && - (identical(other.shade500, shade500) || - other.shade500 == shade500) && - (identical(other.shade600, shade600) || - other.shade600 == shade600) && - (identical(other.shade700, shade700) || - other.shade700 == shade700) && - (identical(other.shade800, shade800) || - other.shade800 == shade800) && - (identical(other.shade900, shade900) || - other.shade900 == shade900)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - primary, - shade50, - shade100, - shade200, - shade300, - shade400, - shade500, - shade600, - shade700, - shade800, - shade900); - - @override - String toString() { - return 'StacMaterialColor(primary: $primary, shade50: $shade50, shade100: $shade100, shade200: $shade200, shade300: $shade300, shade400: $shade400, shade500: $shade500, shade600: $shade600, shade700: $shade700, shade800: $shade800, shade900: $shade900)'; - } -} - -/// @nodoc -abstract mixin class _$StacMaterialColorCopyWith<$Res> - implements $StacMaterialColorCopyWith<$Res> { - factory _$StacMaterialColorCopyWith( - _StacMaterialColor value, $Res Function(_StacMaterialColor) _then) = - __$StacMaterialColorCopyWithImpl; - @override - @useResult - $Res call( - {String primary, - String shade50, - String shade100, - String shade200, - String shade300, - String shade400, - String shade500, - String shade600, - String shade700, - String shade800, - String shade900}); -} - -/// @nodoc -class __$StacMaterialColorCopyWithImpl<$Res> - implements _$StacMaterialColorCopyWith<$Res> { - __$StacMaterialColorCopyWithImpl(this._self, this._then); - - final _StacMaterialColor _self; - final $Res Function(_StacMaterialColor) _then; - - /// Create a copy of StacMaterialColor - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? primary = null, - Object? shade50 = null, - Object? shade100 = null, - Object? shade200 = null, - Object? shade300 = null, - Object? shade400 = null, - Object? shade500 = null, - Object? shade600 = null, - Object? shade700 = null, - Object? shade800 = null, - Object? shade900 = null, - }) { - return _then(_StacMaterialColor( - primary: null == primary - ? _self.primary - : primary // ignore: cast_nullable_to_non_nullable - as String, - shade50: null == shade50 - ? _self.shade50 - : shade50 // ignore: cast_nullable_to_non_nullable - as String, - shade100: null == shade100 - ? _self.shade100 - : shade100 // ignore: cast_nullable_to_non_nullable - as String, - shade200: null == shade200 - ? _self.shade200 - : shade200 // ignore: cast_nullable_to_non_nullable - as String, - shade300: null == shade300 - ? _self.shade300 - : shade300 // ignore: cast_nullable_to_non_nullable - as String, - shade400: null == shade400 - ? _self.shade400 - : shade400 // ignore: cast_nullable_to_non_nullable - as String, - shade500: null == shade500 - ? _self.shade500 - : shade500 // ignore: cast_nullable_to_non_nullable - as String, - shade600: null == shade600 - ? _self.shade600 - : shade600 // ignore: cast_nullable_to_non_nullable - as String, - shade700: null == shade700 - ? _self.shade700 - : shade700 // ignore: cast_nullable_to_non_nullable - as String, - shade800: null == shade800 - ? _self.shade800 - : shade800 // ignore: cast_nullable_to_non_nullable - as String, - shade900: null == shade900 - ? _self.shade900 - : shade900 // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.dart b/packages/stac/lib/src/parsers/theme/stac_material_color_parser.dart similarity index 51% rename from packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.dart rename to packages/stac/lib/src/parsers/theme/stac_material_color_parser.dart index 12b6aa450..5f9839a25 100644 --- a/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.dart +++ b/packages/stac/lib/src/parsers/theme/stac_material_color_parser.dart @@ -1,30 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; -part 'stac_material_color.freezed.dart'; -part 'stac_material_color.g.dart'; - -@freezed -abstract class StacMaterialColor with _$StacMaterialColor { - const factory StacMaterialColor({ - required String primary, - required String shade50, - required String shade100, - required String shade200, - required String shade300, - required String shade400, - required String shade500, - required String shade600, - required String shade700, - required String shade800, - required String shade900, - }) = _StacMaterialColor; - - factory StacMaterialColor.fromJson(Map json) => - _$StacMaterialColorFromJson(json); -} - +/// Parser extension for [StacMaterialColor]. +/// +/// Converts [StacMaterialColor] to Flutter's [MaterialColor]. extension StacMaterialColorParser on StacMaterialColor { MaterialColor parse(BuildContext context) { Map color = { diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart deleted file mode 100644 index e73ca3dc1..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_border_parser.dart'; -import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; -import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_navigation_bar_theme_data.freezed.dart'; -part 'stac_navigation_bar_theme_data.g.dart'; - -@freezed -abstract class StacNavigationBarThemeData with _$StacNavigationBarThemeData { - const factory StacNavigationBarThemeData({ - double? height, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacBorder? indicatorShape, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme, - NavigationDestinationLabelBehavior? labelBehavior, - }) = _StacNavigationBarThemeData; - - factory StacNavigationBarThemeData.fromJson(Map json) => - _$StacNavigationBarThemeDataFromJson(json); -} - -extension StacNavigationBarThemeDataParser on StacNavigationBarThemeData { - NavigationBarThemeData? parse(BuildContext context) { - return NavigationBarThemeData( - height: height, - backgroundColor: backgroundColor.toColor(context), - elevation: elevation, - shadowColor: shadowColor.toColor(context), - surfaceTintColor: surfaceTintColor.toColor(context), - indicatorColor: indicatorColor.toColor(context), - indicatorShape: indicatorShape?.parse(context), - labelTextStyle: WidgetStateProperty.all(labelTextStyle?.parse(context)), - iconTheme: WidgetStateProperty.all(iconTheme?.parse(context)), - labelBehavior: labelBehavior, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.freezed.dart deleted file mode 100644 index 721413c77..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.freezed.dart +++ /dev/null @@ -1,620 +0,0 @@ -// 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 - -part of 'stac_navigation_bar_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacNavigationBarThemeData { - double? get height; - String? get backgroundColor; - double? get elevation; - String? get shadowColor; - String? get surfaceTintColor; - String? get indicatorColor; - StacBorder? get indicatorShape; - StacTextStyle? get labelTextStyle; - StacIconThemeData? get iconTheme; - NavigationDestinationLabelBehavior? get labelBehavior; - - /// Create a copy of StacNavigationBarThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacNavigationBarThemeDataCopyWith - get copyWith => - _$StacNavigationBarThemeDataCopyWithImpl( - this as StacNavigationBarThemeData, _$identity); - - /// Serializes this StacNavigationBarThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacNavigationBarThemeData && - (identical(other.height, height) || other.height == height) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.indicatorColor, indicatorColor) || - other.indicatorColor == indicatorColor) && - (identical(other.indicatorShape, indicatorShape) || - other.indicatorShape == indicatorShape) && - (identical(other.labelTextStyle, labelTextStyle) || - other.labelTextStyle == labelTextStyle) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme) && - (identical(other.labelBehavior, labelBehavior) || - other.labelBehavior == labelBehavior)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - height, - backgroundColor, - elevation, - shadowColor, - surfaceTintColor, - indicatorColor, - indicatorShape, - labelTextStyle, - iconTheme, - labelBehavior); - - @override - String toString() { - return 'StacNavigationBarThemeData(height: $height, backgroundColor: $backgroundColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, indicatorColor: $indicatorColor, indicatorShape: $indicatorShape, labelTextStyle: $labelTextStyle, iconTheme: $iconTheme, labelBehavior: $labelBehavior)'; - } -} - -/// @nodoc -abstract mixin class $StacNavigationBarThemeDataCopyWith<$Res> { - factory $StacNavigationBarThemeDataCopyWith(StacNavigationBarThemeData value, - $Res Function(StacNavigationBarThemeData) _then) = - _$StacNavigationBarThemeDataCopyWithImpl; - @useResult - $Res call( - {double? height, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacBorder? indicatorShape, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme, - NavigationDestinationLabelBehavior? labelBehavior}); - - $StacIconThemeDataCopyWith<$Res>? get iconTheme; -} - -/// @nodoc -class _$StacNavigationBarThemeDataCopyWithImpl<$Res> - implements $StacNavigationBarThemeDataCopyWith<$Res> { - _$StacNavigationBarThemeDataCopyWithImpl(this._self, this._then); - - final StacNavigationBarThemeData _self; - final $Res Function(StacNavigationBarThemeData) _then; - - /// Create a copy of StacNavigationBarThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? height = freezed, - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? indicatorColor = freezed, - Object? indicatorShape = freezed, - Object? labelTextStyle = freezed, - Object? iconTheme = freezed, - Object? labelBehavior = freezed, - }) { - return _then(_self.copyWith( - height: freezed == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as double?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorColor: freezed == indicatorColor - ? _self.indicatorColor - : indicatorColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorShape: freezed == indicatorShape - ? _self.indicatorShape - : indicatorShape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - labelTextStyle: freezed == labelTextStyle - ? _self.labelTextStyle - : labelTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - labelBehavior: freezed == labelBehavior - ? _self.labelBehavior - : labelBehavior // ignore: cast_nullable_to_non_nullable - as NavigationDestinationLabelBehavior?, - )); - } - - /// Create a copy of StacNavigationBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacNavigationBarThemeData]. -extension StacNavigationBarThemeDataPatterns on StacNavigationBarThemeData { - /// 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(_StacNavigationBarThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacNavigationBarThemeData() 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(_StacNavigationBarThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacNavigationBarThemeData(): - 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(_StacNavigationBarThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacNavigationBarThemeData() 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( - double? height, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacBorder? indicatorShape, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme, - NavigationDestinationLabelBehavior? labelBehavior)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacNavigationBarThemeData() when $default != null: - return $default( - _that.height, - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.indicatorColor, - _that.indicatorShape, - _that.labelTextStyle, - _that.iconTheme, - _that.labelBehavior); - 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( - double? height, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacBorder? indicatorShape, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme, - NavigationDestinationLabelBehavior? labelBehavior) - $default, - ) { - final _that = this; - switch (_that) { - case _StacNavigationBarThemeData(): - return $default( - _that.height, - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.indicatorColor, - _that.indicatorShape, - _that.labelTextStyle, - _that.iconTheme, - _that.labelBehavior); - 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( - double? height, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacBorder? indicatorShape, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme, - NavigationDestinationLabelBehavior? labelBehavior)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacNavigationBarThemeData() when $default != null: - return $default( - _that.height, - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.indicatorColor, - _that.indicatorShape, - _that.labelTextStyle, - _that.iconTheme, - _that.labelBehavior); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacNavigationBarThemeData implements StacNavigationBarThemeData { - const _StacNavigationBarThemeData( - {this.height, - this.backgroundColor, - this.elevation, - this.shadowColor, - this.surfaceTintColor, - this.indicatorColor, - this.indicatorShape, - this.labelTextStyle, - this.iconTheme, - this.labelBehavior}); - factory _StacNavigationBarThemeData.fromJson(Map json) => - _$StacNavigationBarThemeDataFromJson(json); - - @override - final double? height; - @override - final String? backgroundColor; - @override - final double? elevation; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final String? indicatorColor; - @override - final StacBorder? indicatorShape; - @override - final StacTextStyle? labelTextStyle; - @override - final StacIconThemeData? iconTheme; - @override - final NavigationDestinationLabelBehavior? labelBehavior; - - /// Create a copy of StacNavigationBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacNavigationBarThemeDataCopyWith<_StacNavigationBarThemeData> - get copyWith => __$StacNavigationBarThemeDataCopyWithImpl< - _StacNavigationBarThemeData>(this, _$identity); - - @override - Map toJson() { - return _$StacNavigationBarThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacNavigationBarThemeData && - (identical(other.height, height) || other.height == height) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.indicatorColor, indicatorColor) || - other.indicatorColor == indicatorColor) && - (identical(other.indicatorShape, indicatorShape) || - other.indicatorShape == indicatorShape) && - (identical(other.labelTextStyle, labelTextStyle) || - other.labelTextStyle == labelTextStyle) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme) && - (identical(other.labelBehavior, labelBehavior) || - other.labelBehavior == labelBehavior)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - height, - backgroundColor, - elevation, - shadowColor, - surfaceTintColor, - indicatorColor, - indicatorShape, - labelTextStyle, - iconTheme, - labelBehavior); - - @override - String toString() { - return 'StacNavigationBarThemeData(height: $height, backgroundColor: $backgroundColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, indicatorColor: $indicatorColor, indicatorShape: $indicatorShape, labelTextStyle: $labelTextStyle, iconTheme: $iconTheme, labelBehavior: $labelBehavior)'; - } -} - -/// @nodoc -abstract mixin class _$StacNavigationBarThemeDataCopyWith<$Res> - implements $StacNavigationBarThemeDataCopyWith<$Res> { - factory _$StacNavigationBarThemeDataCopyWith( - _StacNavigationBarThemeData value, - $Res Function(_StacNavigationBarThemeData) _then) = - __$StacNavigationBarThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {double? height, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacBorder? indicatorShape, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme, - NavigationDestinationLabelBehavior? labelBehavior}); - - @override - $StacIconThemeDataCopyWith<$Res>? get iconTheme; -} - -/// @nodoc -class __$StacNavigationBarThemeDataCopyWithImpl<$Res> - implements _$StacNavigationBarThemeDataCopyWith<$Res> { - __$StacNavigationBarThemeDataCopyWithImpl(this._self, this._then); - - final _StacNavigationBarThemeData _self; - final $Res Function(_StacNavigationBarThemeData) _then; - - /// Create a copy of StacNavigationBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? height = freezed, - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? indicatorColor = freezed, - Object? indicatorShape = freezed, - Object? labelTextStyle = freezed, - Object? iconTheme = freezed, - Object? labelBehavior = freezed, - }) { - return _then(_StacNavigationBarThemeData( - height: freezed == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as double?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorColor: freezed == indicatorColor - ? _self.indicatorColor - : indicatorColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorShape: freezed == indicatorShape - ? _self.indicatorShape - : indicatorShape // ignore: cast_nullable_to_non_nullable - as StacBorder?, - labelTextStyle: freezed == labelTextStyle - ? _self.labelTextStyle - : labelTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - labelBehavior: freezed == labelBehavior - ? _self.labelBehavior - : labelBehavior // ignore: cast_nullable_to_non_nullable - as NavigationDestinationLabelBehavior?, - )); - } - - /// Create a copy of StacNavigationBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.g.dart deleted file mode 100644 index 81a1e9b5c..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.g.dart +++ /dev/null @@ -1,52 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_navigation_bar_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacNavigationBarThemeData _$StacNavigationBarThemeDataFromJson( - Map json) => - _StacNavigationBarThemeData( - height: (json['height'] as num?)?.toDouble(), - backgroundColor: json['backgroundColor'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - shadowColor: json['shadowColor'] as String?, - surfaceTintColor: json['surfaceTintColor'] as String?, - indicatorColor: json['indicatorColor'] as String?, - indicatorShape: json['indicatorShape'] == null - ? null - : StacBorder.fromJson(json['indicatorShape'] as Map), - labelTextStyle: json['labelTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['labelTextStyle']), - iconTheme: json['iconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['iconTheme'] as Map), - labelBehavior: $enumDecodeNullable( - _$NavigationDestinationLabelBehaviorEnumMap, json['labelBehavior']), - ); - -Map _$StacNavigationBarThemeDataToJson( - _StacNavigationBarThemeData instance) => - { - 'height': instance.height, - 'backgroundColor': instance.backgroundColor, - 'elevation': instance.elevation, - 'shadowColor': instance.shadowColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'indicatorColor': instance.indicatorColor, - 'indicatorShape': instance.indicatorShape, - 'labelTextStyle': instance.labelTextStyle, - 'iconTheme': instance.iconTheme, - 'labelBehavior': - _$NavigationDestinationLabelBehaviorEnumMap[instance.labelBehavior], - }; - -const _$NavigationDestinationLabelBehaviorEnumMap = { - NavigationDestinationLabelBehavior.alwaysShow: 'alwaysShow', - NavigationDestinationLabelBehavior.alwaysHide: 'alwaysHide', - NavigationDestinationLabelBehavior.onlyShowSelected: 'onlyShowSelected', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data_parser.dart new file mode 100644 index 000000000..737d39b77 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data_parser.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/foundation.dart'; +import 'package:stac/src/parsers/theme/stac_icon_theme_data_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacNavigationBarThemeData]. +/// +/// Converts [StacNavigationBarThemeData] to Flutter's [NavigationBarThemeData]. +extension StacNavigationBarThemeDataParser on StacNavigationBarThemeData { + NavigationBarThemeData? parse(BuildContext context) { + return NavigationBarThemeData( + height: height, + backgroundColor: backgroundColor?.toColor(context), + elevation: elevation, + shadowColor: shadowColor?.toColor(context), + surfaceTintColor: surfaceTintColor?.toColor(context), + indicatorColor: indicatorColor?.toColor(context), + indicatorShape: indicatorShape?.parse(context), + labelTextStyle: WidgetStateProperty.all(labelTextStyle?.parse(context)), + iconTheme: WidgetStateProperty.all(iconTheme?.parse(context)), + labelBehavior: labelBehavior?.parse, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart deleted file mode 100644 index 0e51dd218..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart +++ /dev/null @@ -1,624 +0,0 @@ -// 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 - -part of 'stac_navigation_drawer_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacNavigationDrawerThemeData { - double? get tileHeight; - String? get backgroundColor; - double? get elevation; - String? get shadowColor; - String? get surfaceTintColor; - String? get indicatorColor; - StacShapeBorder? get indicatorShape; - StacSize? get indicatorSize; - StacTextStyle? get labelTextStyle; - StacIconThemeData? get iconTheme; - - /// Create a copy of StacNavigationDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacNavigationDrawerThemeDataCopyWith - get copyWith => _$StacNavigationDrawerThemeDataCopyWithImpl< - StacNavigationDrawerThemeData>( - this as StacNavigationDrawerThemeData, _$identity); - - /// Serializes this StacNavigationDrawerThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacNavigationDrawerThemeData && - (identical(other.tileHeight, tileHeight) || - other.tileHeight == tileHeight) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.indicatorColor, indicatorColor) || - other.indicatorColor == indicatorColor) && - (identical(other.indicatorShape, indicatorShape) || - other.indicatorShape == indicatorShape) && - (identical(other.indicatorSize, indicatorSize) || - other.indicatorSize == indicatorSize) && - (identical(other.labelTextStyle, labelTextStyle) || - other.labelTextStyle == labelTextStyle) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - tileHeight, - backgroundColor, - elevation, - shadowColor, - surfaceTintColor, - indicatorColor, - indicatorShape, - indicatorSize, - labelTextStyle, - iconTheme); - - @override - String toString() { - return 'StacNavigationDrawerThemeData(tileHeight: $tileHeight, backgroundColor: $backgroundColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, indicatorColor: $indicatorColor, indicatorShape: $indicatorShape, indicatorSize: $indicatorSize, labelTextStyle: $labelTextStyle, iconTheme: $iconTheme)'; - } -} - -/// @nodoc -abstract mixin class $StacNavigationDrawerThemeDataCopyWith<$Res> { - factory $StacNavigationDrawerThemeDataCopyWith( - StacNavigationDrawerThemeData value, - $Res Function(StacNavigationDrawerThemeData) _then) = - _$StacNavigationDrawerThemeDataCopyWithImpl; - @useResult - $Res call( - {double? tileHeight, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacShapeBorder? indicatorShape, - StacSize? indicatorSize, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme}); - - $StacIconThemeDataCopyWith<$Res>? get iconTheme; -} - -/// @nodoc -class _$StacNavigationDrawerThemeDataCopyWithImpl<$Res> - implements $StacNavigationDrawerThemeDataCopyWith<$Res> { - _$StacNavigationDrawerThemeDataCopyWithImpl(this._self, this._then); - - final StacNavigationDrawerThemeData _self; - final $Res Function(StacNavigationDrawerThemeData) _then; - - /// Create a copy of StacNavigationDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? tileHeight = freezed, - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? indicatorColor = freezed, - Object? indicatorShape = freezed, - Object? indicatorSize = freezed, - Object? labelTextStyle = freezed, - Object? iconTheme = freezed, - }) { - return _then(_self.copyWith( - tileHeight: freezed == tileHeight - ? _self.tileHeight - : tileHeight // ignore: cast_nullable_to_non_nullable - as double?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorColor: freezed == indicatorColor - ? _self.indicatorColor - : indicatorColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorShape: freezed == indicatorShape - ? _self.indicatorShape - : indicatorShape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - indicatorSize: freezed == indicatorSize - ? _self.indicatorSize - : indicatorSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - labelTextStyle: freezed == labelTextStyle - ? _self.labelTextStyle - : labelTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - )); - } - - /// Create a copy of StacNavigationDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacNavigationDrawerThemeData]. -extension StacNavigationDrawerThemeDataPatterns - on StacNavigationDrawerThemeData { - /// 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(_StacNavigationDrawerThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacNavigationDrawerThemeData() 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(_StacNavigationDrawerThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacNavigationDrawerThemeData(): - 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(_StacNavigationDrawerThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacNavigationDrawerThemeData() 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( - double? tileHeight, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacShapeBorder? indicatorShape, - StacSize? indicatorSize, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacNavigationDrawerThemeData() when $default != null: - return $default( - _that.tileHeight, - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.indicatorColor, - _that.indicatorShape, - _that.indicatorSize, - _that.labelTextStyle, - _that.iconTheme); - 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( - double? tileHeight, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacShapeBorder? indicatorShape, - StacSize? indicatorSize, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme) - $default, - ) { - final _that = this; - switch (_that) { - case _StacNavigationDrawerThemeData(): - return $default( - _that.tileHeight, - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.indicatorColor, - _that.indicatorShape, - _that.indicatorSize, - _that.labelTextStyle, - _that.iconTheme); - 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( - double? tileHeight, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacShapeBorder? indicatorShape, - StacSize? indicatorSize, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacNavigationDrawerThemeData() when $default != null: - return $default( - _that.tileHeight, - _that.backgroundColor, - _that.elevation, - _that.shadowColor, - _that.surfaceTintColor, - _that.indicatorColor, - _that.indicatorShape, - _that.indicatorSize, - _that.labelTextStyle, - _that.iconTheme); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacNavigationDrawerThemeData implements StacNavigationDrawerThemeData { - const _StacNavigationDrawerThemeData( - {this.tileHeight, - this.backgroundColor, - this.elevation, - this.shadowColor, - this.surfaceTintColor, - this.indicatorColor, - this.indicatorShape, - this.indicatorSize, - this.labelTextStyle, - this.iconTheme}); - factory _StacNavigationDrawerThemeData.fromJson(Map json) => - _$StacNavigationDrawerThemeDataFromJson(json); - - @override - final double? tileHeight; - @override - final String? backgroundColor; - @override - final double? elevation; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final String? indicatorColor; - @override - final StacShapeBorder? indicatorShape; - @override - final StacSize? indicatorSize; - @override - final StacTextStyle? labelTextStyle; - @override - final StacIconThemeData? iconTheme; - - /// Create a copy of StacNavigationDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacNavigationDrawerThemeDataCopyWith<_StacNavigationDrawerThemeData> - get copyWith => __$StacNavigationDrawerThemeDataCopyWithImpl< - _StacNavigationDrawerThemeData>(this, _$identity); - - @override - Map toJson() { - return _$StacNavigationDrawerThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacNavigationDrawerThemeData && - (identical(other.tileHeight, tileHeight) || - other.tileHeight == tileHeight) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.indicatorColor, indicatorColor) || - other.indicatorColor == indicatorColor) && - (identical(other.indicatorShape, indicatorShape) || - other.indicatorShape == indicatorShape) && - (identical(other.indicatorSize, indicatorSize) || - other.indicatorSize == indicatorSize) && - (identical(other.labelTextStyle, labelTextStyle) || - other.labelTextStyle == labelTextStyle) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - tileHeight, - backgroundColor, - elevation, - shadowColor, - surfaceTintColor, - indicatorColor, - indicatorShape, - indicatorSize, - labelTextStyle, - iconTheme); - - @override - String toString() { - return 'StacNavigationDrawerThemeData(tileHeight: $tileHeight, backgroundColor: $backgroundColor, elevation: $elevation, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, indicatorColor: $indicatorColor, indicatorShape: $indicatorShape, indicatorSize: $indicatorSize, labelTextStyle: $labelTextStyle, iconTheme: $iconTheme)'; - } -} - -/// @nodoc -abstract mixin class _$StacNavigationDrawerThemeDataCopyWith<$Res> - implements $StacNavigationDrawerThemeDataCopyWith<$Res> { - factory _$StacNavigationDrawerThemeDataCopyWith( - _StacNavigationDrawerThemeData value, - $Res Function(_StacNavigationDrawerThemeData) _then) = - __$StacNavigationDrawerThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {double? tileHeight, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacShapeBorder? indicatorShape, - StacSize? indicatorSize, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme}); - - @override - $StacIconThemeDataCopyWith<$Res>? get iconTheme; -} - -/// @nodoc -class __$StacNavigationDrawerThemeDataCopyWithImpl<$Res> - implements _$StacNavigationDrawerThemeDataCopyWith<$Res> { - __$StacNavigationDrawerThemeDataCopyWithImpl(this._self, this._then); - - final _StacNavigationDrawerThemeData _self; - final $Res Function(_StacNavigationDrawerThemeData) _then; - - /// Create a copy of StacNavigationDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? tileHeight = freezed, - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? indicatorColor = freezed, - Object? indicatorShape = freezed, - Object? indicatorSize = freezed, - Object? labelTextStyle = freezed, - Object? iconTheme = freezed, - }) { - return _then(_StacNavigationDrawerThemeData( - tileHeight: freezed == tileHeight - ? _self.tileHeight - : tileHeight // ignore: cast_nullable_to_non_nullable - as double?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorColor: freezed == indicatorColor - ? _self.indicatorColor - : indicatorColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorShape: freezed == indicatorShape - ? _self.indicatorShape - : indicatorShape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - indicatorSize: freezed == indicatorSize - ? _self.indicatorSize - : indicatorSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - labelTextStyle: freezed == labelTextStyle - ? _self.labelTextStyle - : labelTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - )); - } - - /// Create a copy of StacNavigationDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.g.dart deleted file mode 100644 index 25d5825f0..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.g.dart +++ /dev/null @@ -1,47 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_navigation_drawer_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacNavigationDrawerThemeData _$StacNavigationDrawerThemeDataFromJson( - Map json) => - _StacNavigationDrawerThemeData( - tileHeight: (json['tileHeight'] as num?)?.toDouble(), - backgroundColor: json['backgroundColor'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - shadowColor: json['shadowColor'] as String?, - surfaceTintColor: json['surfaceTintColor'] as String?, - indicatorColor: json['indicatorColor'] as String?, - indicatorShape: json['indicatorShape'] == null - ? null - : StacShapeBorder.fromJson( - json['indicatorShape'] as Map), - indicatorSize: json['indicatorSize'] == null - ? null - : StacSize.fromJson(json['indicatorSize'] as Map), - labelTextStyle: json['labelTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['labelTextStyle']), - iconTheme: json['iconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['iconTheme'] as Map), - ); - -Map _$StacNavigationDrawerThemeDataToJson( - _StacNavigationDrawerThemeData instance) => - { - 'tileHeight': instance.tileHeight, - 'backgroundColor': instance.backgroundColor, - 'elevation': instance.elevation, - 'shadowColor': instance.shadowColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'indicatorColor': instance.indicatorColor, - 'indicatorShape': instance.indicatorShape, - 'indicatorSize': instance.indicatorSize, - 'labelTextStyle': instance.labelTextStyle, - 'iconTheme': instance.iconTheme, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data_parser.dart similarity index 53% rename from packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart rename to packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data_parser.dart index 4083b36e8..f71833e04 100644 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data_parser.dart @@ -1,35 +1,13 @@ import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/foundation/borders/stac_shape_border_parser.dart'; import 'package:stac/src/parsers/foundation/geometry/stac_size_parser.dart'; import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; -import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; +import 'package:stac/src/parsers/theme/themes.dart'; import 'package:stac/src/utils/utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_navigation_drawer_theme_data.freezed.dart'; -part 'stac_navigation_drawer_theme_data.g.dart'; - -@freezed -abstract class StacNavigationDrawerThemeData - with _$StacNavigationDrawerThemeData { - const factory StacNavigationDrawerThemeData({ - double? tileHeight, - String? backgroundColor, - double? elevation, - String? shadowColor, - String? surfaceTintColor, - String? indicatorColor, - StacShapeBorder? indicatorShape, - StacSize? indicatorSize, - StacTextStyle? labelTextStyle, - StacIconThemeData? iconTheme, - }) = _StacNavigationDrawerThemeData; - - factory StacNavigationDrawerThemeData.fromJson(Map json) => - _$StacNavigationDrawerThemeDataFromJson(json); -} +/// Parser extension for [StacNavigationDrawerThemeData]. +/// +/// Converts [StacNavigationDrawerThemeData] to Flutter's [NavigationDrawerThemeData]. extension StacNavigationDrawerThemeDataParser on StacNavigationDrawerThemeData { NavigationDrawerThemeData parse(BuildContext context) { return NavigationDrawerThemeData( diff --git a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart deleted file mode 100644 index 8da5b70de..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/utils/color_utils.dart'; - -part 'stac_scrollbar_theme_data.freezed.dart'; -part 'stac_scrollbar_theme_data.g.dart'; - -@freezed -abstract class StacScrollbarThemeData with _$StacScrollbarThemeData { - const factory StacScrollbarThemeData({ - bool? thumbVisibility, - double? thickness, - bool? trackVisibility, - double? radius, - String? thumbColor, - String? trackColor, - String? trackBorderColor, - double? crossAxisMargin, - double? mainAxisMargin, - double? minThumbLength, - bool? interactive, - }) = _StacScrollbarThemeData; - - factory StacScrollbarThemeData.fromJson(Map json) => - _$StacScrollbarThemeDataFromJson(json); -} - -extension StacScrollbarThemeDataParser on StacScrollbarThemeData { - ScrollbarThemeData parse(BuildContext context) { - return ScrollbarThemeData( - thumbVisibility: WidgetStatePropertyAll(thumbVisibility), - thickness: WidgetStatePropertyAll(thickness), - trackVisibility: WidgetStatePropertyAll(trackVisibility), - radius: Radius.circular(radius ?? 0), - thumbColor: WidgetStatePropertyAll(thumbColor!.toColor(context)), - trackColor: WidgetStatePropertyAll(trackColor!.toColor(context)), - trackBorderColor: - WidgetStatePropertyAll(trackBorderColor!.toColor(context)), - crossAxisMargin: crossAxisMargin, - mainAxisMargin: mainAxisMargin, - minThumbLength: minThumbLength, - interactive: interactive, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart deleted file mode 100644 index 60c5fc3b8..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart +++ /dev/null @@ -1,613 +0,0 @@ -// 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 - -part of 'stac_scrollbar_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacScrollbarThemeData { - bool? get thumbVisibility; - double? get thickness; - bool? get trackVisibility; - double? get radius; - String? get thumbColor; - String? get trackColor; - String? get trackBorderColor; - double? get crossAxisMargin; - double? get mainAxisMargin; - double? get minThumbLength; - bool? get interactive; - - /// Create a copy of StacScrollbarThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacScrollbarThemeDataCopyWith get copyWith => - _$StacScrollbarThemeDataCopyWithImpl( - this as StacScrollbarThemeData, _$identity); - - /// Serializes this StacScrollbarThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacScrollbarThemeData && - (identical(other.thumbVisibility, thumbVisibility) || - other.thumbVisibility == thumbVisibility) && - (identical(other.thickness, thickness) || - other.thickness == thickness) && - (identical(other.trackVisibility, trackVisibility) || - other.trackVisibility == trackVisibility) && - (identical(other.radius, radius) || other.radius == radius) && - (identical(other.thumbColor, thumbColor) || - other.thumbColor == thumbColor) && - (identical(other.trackColor, trackColor) || - other.trackColor == trackColor) && - (identical(other.trackBorderColor, trackBorderColor) || - other.trackBorderColor == trackBorderColor) && - (identical(other.crossAxisMargin, crossAxisMargin) || - other.crossAxisMargin == crossAxisMargin) && - (identical(other.mainAxisMargin, mainAxisMargin) || - other.mainAxisMargin == mainAxisMargin) && - (identical(other.minThumbLength, minThumbLength) || - other.minThumbLength == minThumbLength) && - (identical(other.interactive, interactive) || - other.interactive == interactive)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - thumbVisibility, - thickness, - trackVisibility, - radius, - thumbColor, - trackColor, - trackBorderColor, - crossAxisMargin, - mainAxisMargin, - minThumbLength, - interactive); - - @override - String toString() { - return 'StacScrollbarThemeData(thumbVisibility: $thumbVisibility, thickness: $thickness, trackVisibility: $trackVisibility, radius: $radius, thumbColor: $thumbColor, trackColor: $trackColor, trackBorderColor: $trackBorderColor, crossAxisMargin: $crossAxisMargin, mainAxisMargin: $mainAxisMargin, minThumbLength: $minThumbLength, interactive: $interactive)'; - } -} - -/// @nodoc -abstract mixin class $StacScrollbarThemeDataCopyWith<$Res> { - factory $StacScrollbarThemeDataCopyWith(StacScrollbarThemeData value, - $Res Function(StacScrollbarThemeData) _then) = - _$StacScrollbarThemeDataCopyWithImpl; - @useResult - $Res call( - {bool? thumbVisibility, - double? thickness, - bool? trackVisibility, - double? radius, - String? thumbColor, - String? trackColor, - String? trackBorderColor, - double? crossAxisMargin, - double? mainAxisMargin, - double? minThumbLength, - bool? interactive}); -} - -/// @nodoc -class _$StacScrollbarThemeDataCopyWithImpl<$Res> - implements $StacScrollbarThemeDataCopyWith<$Res> { - _$StacScrollbarThemeDataCopyWithImpl(this._self, this._then); - - final StacScrollbarThemeData _self; - final $Res Function(StacScrollbarThemeData) _then; - - /// Create a copy of StacScrollbarThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? thumbVisibility = freezed, - Object? thickness = freezed, - Object? trackVisibility = freezed, - Object? radius = freezed, - Object? thumbColor = freezed, - Object? trackColor = freezed, - Object? trackBorderColor = freezed, - Object? crossAxisMargin = freezed, - Object? mainAxisMargin = freezed, - Object? minThumbLength = freezed, - Object? interactive = freezed, - }) { - return _then(_self.copyWith( - thumbVisibility: freezed == thumbVisibility - ? _self.thumbVisibility - : thumbVisibility // ignore: cast_nullable_to_non_nullable - as bool?, - thickness: freezed == thickness - ? _self.thickness - : thickness // ignore: cast_nullable_to_non_nullable - as double?, - trackVisibility: freezed == trackVisibility - ? _self.trackVisibility - : trackVisibility // ignore: cast_nullable_to_non_nullable - as bool?, - radius: freezed == radius - ? _self.radius - : radius // ignore: cast_nullable_to_non_nullable - as double?, - thumbColor: freezed == thumbColor - ? _self.thumbColor - : thumbColor // ignore: cast_nullable_to_non_nullable - as String?, - trackColor: freezed == trackColor - ? _self.trackColor - : trackColor // ignore: cast_nullable_to_non_nullable - as String?, - trackBorderColor: freezed == trackBorderColor - ? _self.trackBorderColor - : trackBorderColor // ignore: cast_nullable_to_non_nullable - as String?, - crossAxisMargin: freezed == crossAxisMargin - ? _self.crossAxisMargin - : crossAxisMargin // ignore: cast_nullable_to_non_nullable - as double?, - mainAxisMargin: freezed == mainAxisMargin - ? _self.mainAxisMargin - : mainAxisMargin // ignore: cast_nullable_to_non_nullable - as double?, - minThumbLength: freezed == minThumbLength - ? _self.minThumbLength - : minThumbLength // ignore: cast_nullable_to_non_nullable - as double?, - interactive: freezed == interactive - ? _self.interactive - : interactive // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacScrollbarThemeData]. -extension StacScrollbarThemeDataPatterns on StacScrollbarThemeData { - /// 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(_StacScrollbarThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacScrollbarThemeData() 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(_StacScrollbarThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacScrollbarThemeData(): - 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(_StacScrollbarThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacScrollbarThemeData() 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( - bool? thumbVisibility, - double? thickness, - bool? trackVisibility, - double? radius, - String? thumbColor, - String? trackColor, - String? trackBorderColor, - double? crossAxisMargin, - double? mainAxisMargin, - double? minThumbLength, - bool? interactive)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacScrollbarThemeData() when $default != null: - return $default( - _that.thumbVisibility, - _that.thickness, - _that.trackVisibility, - _that.radius, - _that.thumbColor, - _that.trackColor, - _that.trackBorderColor, - _that.crossAxisMargin, - _that.mainAxisMargin, - _that.minThumbLength, - _that.interactive); - 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( - bool? thumbVisibility, - double? thickness, - bool? trackVisibility, - double? radius, - String? thumbColor, - String? trackColor, - String? trackBorderColor, - double? crossAxisMargin, - double? mainAxisMargin, - double? minThumbLength, - bool? interactive) - $default, - ) { - final _that = this; - switch (_that) { - case _StacScrollbarThemeData(): - return $default( - _that.thumbVisibility, - _that.thickness, - _that.trackVisibility, - _that.radius, - _that.thumbColor, - _that.trackColor, - _that.trackBorderColor, - _that.crossAxisMargin, - _that.mainAxisMargin, - _that.minThumbLength, - _that.interactive); - 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( - bool? thumbVisibility, - double? thickness, - bool? trackVisibility, - double? radius, - String? thumbColor, - String? trackColor, - String? trackBorderColor, - double? crossAxisMargin, - double? mainAxisMargin, - double? minThumbLength, - bool? interactive)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacScrollbarThemeData() when $default != null: - return $default( - _that.thumbVisibility, - _that.thickness, - _that.trackVisibility, - _that.radius, - _that.thumbColor, - _that.trackColor, - _that.trackBorderColor, - _that.crossAxisMargin, - _that.mainAxisMargin, - _that.minThumbLength, - _that.interactive); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacScrollbarThemeData implements StacScrollbarThemeData { - const _StacScrollbarThemeData( - {this.thumbVisibility, - this.thickness, - this.trackVisibility, - this.radius, - this.thumbColor, - this.trackColor, - this.trackBorderColor, - this.crossAxisMargin, - this.mainAxisMargin, - this.minThumbLength, - this.interactive}); - factory _StacScrollbarThemeData.fromJson(Map json) => - _$StacScrollbarThemeDataFromJson(json); - - @override - final bool? thumbVisibility; - @override - final double? thickness; - @override - final bool? trackVisibility; - @override - final double? radius; - @override - final String? thumbColor; - @override - final String? trackColor; - @override - final String? trackBorderColor; - @override - final double? crossAxisMargin; - @override - final double? mainAxisMargin; - @override - final double? minThumbLength; - @override - final bool? interactive; - - /// Create a copy of StacScrollbarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacScrollbarThemeDataCopyWith<_StacScrollbarThemeData> get copyWith => - __$StacScrollbarThemeDataCopyWithImpl<_StacScrollbarThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacScrollbarThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacScrollbarThemeData && - (identical(other.thumbVisibility, thumbVisibility) || - other.thumbVisibility == thumbVisibility) && - (identical(other.thickness, thickness) || - other.thickness == thickness) && - (identical(other.trackVisibility, trackVisibility) || - other.trackVisibility == trackVisibility) && - (identical(other.radius, radius) || other.radius == radius) && - (identical(other.thumbColor, thumbColor) || - other.thumbColor == thumbColor) && - (identical(other.trackColor, trackColor) || - other.trackColor == trackColor) && - (identical(other.trackBorderColor, trackBorderColor) || - other.trackBorderColor == trackBorderColor) && - (identical(other.crossAxisMargin, crossAxisMargin) || - other.crossAxisMargin == crossAxisMargin) && - (identical(other.mainAxisMargin, mainAxisMargin) || - other.mainAxisMargin == mainAxisMargin) && - (identical(other.minThumbLength, minThumbLength) || - other.minThumbLength == minThumbLength) && - (identical(other.interactive, interactive) || - other.interactive == interactive)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - thumbVisibility, - thickness, - trackVisibility, - radius, - thumbColor, - trackColor, - trackBorderColor, - crossAxisMargin, - mainAxisMargin, - minThumbLength, - interactive); - - @override - String toString() { - return 'StacScrollbarThemeData(thumbVisibility: $thumbVisibility, thickness: $thickness, trackVisibility: $trackVisibility, radius: $radius, thumbColor: $thumbColor, trackColor: $trackColor, trackBorderColor: $trackBorderColor, crossAxisMargin: $crossAxisMargin, mainAxisMargin: $mainAxisMargin, minThumbLength: $minThumbLength, interactive: $interactive)'; - } -} - -/// @nodoc -abstract mixin class _$StacScrollbarThemeDataCopyWith<$Res> - implements $StacScrollbarThemeDataCopyWith<$Res> { - factory _$StacScrollbarThemeDataCopyWith(_StacScrollbarThemeData value, - $Res Function(_StacScrollbarThemeData) _then) = - __$StacScrollbarThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {bool? thumbVisibility, - double? thickness, - bool? trackVisibility, - double? radius, - String? thumbColor, - String? trackColor, - String? trackBorderColor, - double? crossAxisMargin, - double? mainAxisMargin, - double? minThumbLength, - bool? interactive}); -} - -/// @nodoc -class __$StacScrollbarThemeDataCopyWithImpl<$Res> - implements _$StacScrollbarThemeDataCopyWith<$Res> { - __$StacScrollbarThemeDataCopyWithImpl(this._self, this._then); - - final _StacScrollbarThemeData _self; - final $Res Function(_StacScrollbarThemeData) _then; - - /// Create a copy of StacScrollbarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? thumbVisibility = freezed, - Object? thickness = freezed, - Object? trackVisibility = freezed, - Object? radius = freezed, - Object? thumbColor = freezed, - Object? trackColor = freezed, - Object? trackBorderColor = freezed, - Object? crossAxisMargin = freezed, - Object? mainAxisMargin = freezed, - Object? minThumbLength = freezed, - Object? interactive = freezed, - }) { - return _then(_StacScrollbarThemeData( - thumbVisibility: freezed == thumbVisibility - ? _self.thumbVisibility - : thumbVisibility // ignore: cast_nullable_to_non_nullable - as bool?, - thickness: freezed == thickness - ? _self.thickness - : thickness // ignore: cast_nullable_to_non_nullable - as double?, - trackVisibility: freezed == trackVisibility - ? _self.trackVisibility - : trackVisibility // ignore: cast_nullable_to_non_nullable - as bool?, - radius: freezed == radius - ? _self.radius - : radius // ignore: cast_nullable_to_non_nullable - as double?, - thumbColor: freezed == thumbColor - ? _self.thumbColor - : thumbColor // ignore: cast_nullable_to_non_nullable - as String?, - trackColor: freezed == trackColor - ? _self.trackColor - : trackColor // ignore: cast_nullable_to_non_nullable - as String?, - trackBorderColor: freezed == trackBorderColor - ? _self.trackBorderColor - : trackBorderColor // ignore: cast_nullable_to_non_nullable - as String?, - crossAxisMargin: freezed == crossAxisMargin - ? _self.crossAxisMargin - : crossAxisMargin // ignore: cast_nullable_to_non_nullable - as double?, - mainAxisMargin: freezed == mainAxisMargin - ? _self.mainAxisMargin - : mainAxisMargin // ignore: cast_nullable_to_non_nullable - as double?, - minThumbLength: freezed == minThumbLength - ? _self.minThumbLength - : minThumbLength // ignore: cast_nullable_to_non_nullable - as double?, - interactive: freezed == interactive - ? _self.interactive - : interactive // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.g.dart deleted file mode 100644 index aab93f2d0..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.g.dart +++ /dev/null @@ -1,39 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_scrollbar_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacScrollbarThemeData _$StacScrollbarThemeDataFromJson( - Map json) => - _StacScrollbarThemeData( - thumbVisibility: json['thumbVisibility'] as bool?, - thickness: (json['thickness'] as num?)?.toDouble(), - trackVisibility: json['trackVisibility'] as bool?, - radius: (json['radius'] as num?)?.toDouble(), - thumbColor: json['thumbColor'] as String?, - trackColor: json['trackColor'] as String?, - trackBorderColor: json['trackBorderColor'] as String?, - crossAxisMargin: (json['crossAxisMargin'] as num?)?.toDouble(), - mainAxisMargin: (json['mainAxisMargin'] as num?)?.toDouble(), - minThumbLength: (json['minThumbLength'] as num?)?.toDouble(), - interactive: json['interactive'] as bool?, - ); - -Map _$StacScrollbarThemeDataToJson( - _StacScrollbarThemeData instance) => - { - 'thumbVisibility': instance.thumbVisibility, - 'thickness': instance.thickness, - 'trackVisibility': instance.trackVisibility, - 'radius': instance.radius, - 'thumbColor': instance.thumbColor, - 'trackColor': instance.trackColor, - 'trackBorderColor': instance.trackBorderColor, - 'crossAxisMargin': instance.crossAxisMargin, - 'mainAxisMargin': instance.mainAxisMargin, - 'minThumbLength': instance.minThumbLength, - 'interactive': instance.interactive, - }; diff --git a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data_parser.dart new file mode 100644 index 000000000..2da1ea8e8 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data_parser.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacScrollbarThemeData]. +/// +/// Converts [StacScrollbarThemeData] to Flutter's [ScrollbarThemeData]. +extension StacScrollbarThemeDataParser on StacScrollbarThemeData { + ScrollbarThemeData parse(BuildContext context) { + return ScrollbarThemeData( + thumbVisibility: WidgetStatePropertyAll(thumbVisibility), + thickness: WidgetStatePropertyAll(thickness), + trackVisibility: WidgetStatePropertyAll(trackVisibility), + radius: radius != null ? Radius.circular(radius!) : null, + thumbColor: WidgetStatePropertyAll(thumbColor?.toColor(context)), + trackColor: WidgetStatePropertyAll(trackColor?.toColor(context)), + trackBorderColor: WidgetStatePropertyAll( + trackBorderColor?.toColor(context), + ), + crossAxisMargin: crossAxisMargin, + mainAxisMargin: mainAxisMargin, + minThumbLength: minThumbLength, + interactive: interactive, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart deleted file mode 100644 index c4a97b321..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart +++ /dev/null @@ -1,731 +0,0 @@ -// 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 - -part of 'stac_snack_bar_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacSnackBarThemeData { - SnackBarBehavior? get behavior; - String? get backgroundColor; - double? get elevation; - StacShapeBorder? get shape; - double? get width; - StacTextStyle? get contentTextStyle; - String? get actionTextColor; - String? get disabledActionTextColor; - StacEdgeInsets? get insetPadding; - DismissDirection? get dismissDirection; - bool? get showCloseIcon; - String? get closeIconColor; - double? get actionOverflowThreshold; - String? get actionBackgroundColor; - String? get disabledActionBackgroundColor; - - /// Create a copy of StacSnackBarThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacSnackBarThemeDataCopyWith get copyWith => - _$StacSnackBarThemeDataCopyWithImpl( - this as StacSnackBarThemeData, _$identity); - - /// Serializes this StacSnackBarThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacSnackBarThemeData && - (identical(other.behavior, behavior) || - other.behavior == behavior) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.width, width) || other.width == width) && - (identical(other.contentTextStyle, contentTextStyle) || - other.contentTextStyle == contentTextStyle) && - (identical(other.actionTextColor, actionTextColor) || - other.actionTextColor == actionTextColor) && - (identical( - other.disabledActionTextColor, disabledActionTextColor) || - other.disabledActionTextColor == disabledActionTextColor) && - (identical(other.insetPadding, insetPadding) || - other.insetPadding == insetPadding) && - (identical(other.dismissDirection, dismissDirection) || - other.dismissDirection == dismissDirection) && - (identical(other.showCloseIcon, showCloseIcon) || - other.showCloseIcon == showCloseIcon) && - (identical(other.closeIconColor, closeIconColor) || - other.closeIconColor == closeIconColor) && - (identical( - other.actionOverflowThreshold, actionOverflowThreshold) || - other.actionOverflowThreshold == actionOverflowThreshold) && - (identical(other.actionBackgroundColor, actionBackgroundColor) || - other.actionBackgroundColor == actionBackgroundColor) && - (identical(other.disabledActionBackgroundColor, - disabledActionBackgroundColor) || - other.disabledActionBackgroundColor == - disabledActionBackgroundColor)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - behavior, - backgroundColor, - elevation, - shape, - width, - contentTextStyle, - actionTextColor, - disabledActionTextColor, - insetPadding, - dismissDirection, - showCloseIcon, - closeIconColor, - actionOverflowThreshold, - actionBackgroundColor, - disabledActionBackgroundColor); - - @override - String toString() { - return 'StacSnackBarThemeData(behavior: $behavior, backgroundColor: $backgroundColor, elevation: $elevation, shape: $shape, width: $width, contentTextStyle: $contentTextStyle, actionTextColor: $actionTextColor, disabledActionTextColor: $disabledActionTextColor, insetPadding: $insetPadding, dismissDirection: $dismissDirection, showCloseIcon: $showCloseIcon, closeIconColor: $closeIconColor, actionOverflowThreshold: $actionOverflowThreshold, actionBackgroundColor: $actionBackgroundColor, disabledActionBackgroundColor: $disabledActionBackgroundColor)'; - } -} - -/// @nodoc -abstract mixin class $StacSnackBarThemeDataCopyWith<$Res> { - factory $StacSnackBarThemeDataCopyWith(StacSnackBarThemeData value, - $Res Function(StacSnackBarThemeData) _then) = - _$StacSnackBarThemeDataCopyWithImpl; - @useResult - $Res call( - {SnackBarBehavior? behavior, - String? backgroundColor, - double? elevation, - StacShapeBorder? shape, - double? width, - StacTextStyle? contentTextStyle, - String? actionTextColor, - String? disabledActionTextColor, - StacEdgeInsets? insetPadding, - DismissDirection? dismissDirection, - bool? showCloseIcon, - String? closeIconColor, - double? actionOverflowThreshold, - String? actionBackgroundColor, - String? disabledActionBackgroundColor}); -} - -/// @nodoc -class _$StacSnackBarThemeDataCopyWithImpl<$Res> - implements $StacSnackBarThemeDataCopyWith<$Res> { - _$StacSnackBarThemeDataCopyWithImpl(this._self, this._then); - - final StacSnackBarThemeData _self; - final $Res Function(StacSnackBarThemeData) _then; - - /// Create a copy of StacSnackBarThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? behavior = freezed, - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shape = freezed, - Object? width = freezed, - Object? contentTextStyle = freezed, - Object? actionTextColor = freezed, - Object? disabledActionTextColor = freezed, - Object? insetPadding = freezed, - Object? dismissDirection = freezed, - Object? showCloseIcon = freezed, - Object? closeIconColor = freezed, - Object? actionOverflowThreshold = freezed, - Object? actionBackgroundColor = freezed, - Object? disabledActionBackgroundColor = freezed, - }) { - return _then(_self.copyWith( - behavior: freezed == behavior - ? _self.behavior - : behavior // ignore: cast_nullable_to_non_nullable - as SnackBarBehavior?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - width: freezed == width - ? _self.width - : width // ignore: cast_nullable_to_non_nullable - as double?, - contentTextStyle: freezed == contentTextStyle - ? _self.contentTextStyle - : contentTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - actionTextColor: freezed == actionTextColor - ? _self.actionTextColor - : actionTextColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledActionTextColor: freezed == disabledActionTextColor - ? _self.disabledActionTextColor - : disabledActionTextColor // ignore: cast_nullable_to_non_nullable - as String?, - insetPadding: freezed == insetPadding - ? _self.insetPadding - : insetPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - dismissDirection: freezed == dismissDirection - ? _self.dismissDirection - : dismissDirection // ignore: cast_nullable_to_non_nullable - as DismissDirection?, - showCloseIcon: freezed == showCloseIcon - ? _self.showCloseIcon - : showCloseIcon // ignore: cast_nullable_to_non_nullable - as bool?, - closeIconColor: freezed == closeIconColor - ? _self.closeIconColor - : closeIconColor // ignore: cast_nullable_to_non_nullable - as String?, - actionOverflowThreshold: freezed == actionOverflowThreshold - ? _self.actionOverflowThreshold - : actionOverflowThreshold // ignore: cast_nullable_to_non_nullable - as double?, - actionBackgroundColor: freezed == actionBackgroundColor - ? _self.actionBackgroundColor - : actionBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledActionBackgroundColor: freezed == disabledActionBackgroundColor - ? _self.disabledActionBackgroundColor - : disabledActionBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacSnackBarThemeData]. -extension StacSnackBarThemeDataPatterns on StacSnackBarThemeData { - /// 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(_StacSnackBarThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacSnackBarThemeData() 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(_StacSnackBarThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacSnackBarThemeData(): - 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(_StacSnackBarThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacSnackBarThemeData() 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( - SnackBarBehavior? behavior, - String? backgroundColor, - double? elevation, - StacShapeBorder? shape, - double? width, - StacTextStyle? contentTextStyle, - String? actionTextColor, - String? disabledActionTextColor, - StacEdgeInsets? insetPadding, - DismissDirection? dismissDirection, - bool? showCloseIcon, - String? closeIconColor, - double? actionOverflowThreshold, - String? actionBackgroundColor, - String? disabledActionBackgroundColor)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacSnackBarThemeData() when $default != null: - return $default( - _that.behavior, - _that.backgroundColor, - _that.elevation, - _that.shape, - _that.width, - _that.contentTextStyle, - _that.actionTextColor, - _that.disabledActionTextColor, - _that.insetPadding, - _that.dismissDirection, - _that.showCloseIcon, - _that.closeIconColor, - _that.actionOverflowThreshold, - _that.actionBackgroundColor, - _that.disabledActionBackgroundColor); - 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( - SnackBarBehavior? behavior, - String? backgroundColor, - double? elevation, - StacShapeBorder? shape, - double? width, - StacTextStyle? contentTextStyle, - String? actionTextColor, - String? disabledActionTextColor, - StacEdgeInsets? insetPadding, - DismissDirection? dismissDirection, - bool? showCloseIcon, - String? closeIconColor, - double? actionOverflowThreshold, - String? actionBackgroundColor, - String? disabledActionBackgroundColor) - $default, - ) { - final _that = this; - switch (_that) { - case _StacSnackBarThemeData(): - return $default( - _that.behavior, - _that.backgroundColor, - _that.elevation, - _that.shape, - _that.width, - _that.contentTextStyle, - _that.actionTextColor, - _that.disabledActionTextColor, - _that.insetPadding, - _that.dismissDirection, - _that.showCloseIcon, - _that.closeIconColor, - _that.actionOverflowThreshold, - _that.actionBackgroundColor, - _that.disabledActionBackgroundColor); - 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( - SnackBarBehavior? behavior, - String? backgroundColor, - double? elevation, - StacShapeBorder? shape, - double? width, - StacTextStyle? contentTextStyle, - String? actionTextColor, - String? disabledActionTextColor, - StacEdgeInsets? insetPadding, - DismissDirection? dismissDirection, - bool? showCloseIcon, - String? closeIconColor, - double? actionOverflowThreshold, - String? actionBackgroundColor, - String? disabledActionBackgroundColor)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacSnackBarThemeData() when $default != null: - return $default( - _that.behavior, - _that.backgroundColor, - _that.elevation, - _that.shape, - _that.width, - _that.contentTextStyle, - _that.actionTextColor, - _that.disabledActionTextColor, - _that.insetPadding, - _that.dismissDirection, - _that.showCloseIcon, - _that.closeIconColor, - _that.actionOverflowThreshold, - _that.actionBackgroundColor, - _that.disabledActionBackgroundColor); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacSnackBarThemeData implements StacSnackBarThemeData { - const _StacSnackBarThemeData( - {this.behavior, - this.backgroundColor, - this.elevation, - this.shape, - this.width, - this.contentTextStyle, - this.actionTextColor, - this.disabledActionTextColor, - this.insetPadding, - this.dismissDirection, - this.showCloseIcon, - this.closeIconColor, - this.actionOverflowThreshold, - this.actionBackgroundColor, - this.disabledActionBackgroundColor}); - factory _StacSnackBarThemeData.fromJson(Map json) => - _$StacSnackBarThemeDataFromJson(json); - - @override - final SnackBarBehavior? behavior; - @override - final String? backgroundColor; - @override - final double? elevation; - @override - final StacShapeBorder? shape; - @override - final double? width; - @override - final StacTextStyle? contentTextStyle; - @override - final String? actionTextColor; - @override - final String? disabledActionTextColor; - @override - final StacEdgeInsets? insetPadding; - @override - final DismissDirection? dismissDirection; - @override - final bool? showCloseIcon; - @override - final String? closeIconColor; - @override - final double? actionOverflowThreshold; - @override - final String? actionBackgroundColor; - @override - final String? disabledActionBackgroundColor; - - /// Create a copy of StacSnackBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacSnackBarThemeDataCopyWith<_StacSnackBarThemeData> get copyWith => - __$StacSnackBarThemeDataCopyWithImpl<_StacSnackBarThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacSnackBarThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacSnackBarThemeData && - (identical(other.behavior, behavior) || - other.behavior == behavior) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.width, width) || other.width == width) && - (identical(other.contentTextStyle, contentTextStyle) || - other.contentTextStyle == contentTextStyle) && - (identical(other.actionTextColor, actionTextColor) || - other.actionTextColor == actionTextColor) && - (identical( - other.disabledActionTextColor, disabledActionTextColor) || - other.disabledActionTextColor == disabledActionTextColor) && - (identical(other.insetPadding, insetPadding) || - other.insetPadding == insetPadding) && - (identical(other.dismissDirection, dismissDirection) || - other.dismissDirection == dismissDirection) && - (identical(other.showCloseIcon, showCloseIcon) || - other.showCloseIcon == showCloseIcon) && - (identical(other.closeIconColor, closeIconColor) || - other.closeIconColor == closeIconColor) && - (identical( - other.actionOverflowThreshold, actionOverflowThreshold) || - other.actionOverflowThreshold == actionOverflowThreshold) && - (identical(other.actionBackgroundColor, actionBackgroundColor) || - other.actionBackgroundColor == actionBackgroundColor) && - (identical(other.disabledActionBackgroundColor, - disabledActionBackgroundColor) || - other.disabledActionBackgroundColor == - disabledActionBackgroundColor)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - behavior, - backgroundColor, - elevation, - shape, - width, - contentTextStyle, - actionTextColor, - disabledActionTextColor, - insetPadding, - dismissDirection, - showCloseIcon, - closeIconColor, - actionOverflowThreshold, - actionBackgroundColor, - disabledActionBackgroundColor); - - @override - String toString() { - return 'StacSnackBarThemeData(behavior: $behavior, backgroundColor: $backgroundColor, elevation: $elevation, shape: $shape, width: $width, contentTextStyle: $contentTextStyle, actionTextColor: $actionTextColor, disabledActionTextColor: $disabledActionTextColor, insetPadding: $insetPadding, dismissDirection: $dismissDirection, showCloseIcon: $showCloseIcon, closeIconColor: $closeIconColor, actionOverflowThreshold: $actionOverflowThreshold, actionBackgroundColor: $actionBackgroundColor, disabledActionBackgroundColor: $disabledActionBackgroundColor)'; - } -} - -/// @nodoc -abstract mixin class _$StacSnackBarThemeDataCopyWith<$Res> - implements $StacSnackBarThemeDataCopyWith<$Res> { - factory _$StacSnackBarThemeDataCopyWith(_StacSnackBarThemeData value, - $Res Function(_StacSnackBarThemeData) _then) = - __$StacSnackBarThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {SnackBarBehavior? behavior, - String? backgroundColor, - double? elevation, - StacShapeBorder? shape, - double? width, - StacTextStyle? contentTextStyle, - String? actionTextColor, - String? disabledActionTextColor, - StacEdgeInsets? insetPadding, - DismissDirection? dismissDirection, - bool? showCloseIcon, - String? closeIconColor, - double? actionOverflowThreshold, - String? actionBackgroundColor, - String? disabledActionBackgroundColor}); -} - -/// @nodoc -class __$StacSnackBarThemeDataCopyWithImpl<$Res> - implements _$StacSnackBarThemeDataCopyWith<$Res> { - __$StacSnackBarThemeDataCopyWithImpl(this._self, this._then); - - final _StacSnackBarThemeData _self; - final $Res Function(_StacSnackBarThemeData) _then; - - /// Create a copy of StacSnackBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? behavior = freezed, - Object? backgroundColor = freezed, - Object? elevation = freezed, - Object? shape = freezed, - Object? width = freezed, - Object? contentTextStyle = freezed, - Object? actionTextColor = freezed, - Object? disabledActionTextColor = freezed, - Object? insetPadding = freezed, - Object? dismissDirection = freezed, - Object? showCloseIcon = freezed, - Object? closeIconColor = freezed, - Object? actionOverflowThreshold = freezed, - Object? actionBackgroundColor = freezed, - Object? disabledActionBackgroundColor = freezed, - }) { - return _then(_StacSnackBarThemeData( - behavior: freezed == behavior - ? _self.behavior - : behavior // ignore: cast_nullable_to_non_nullable - as SnackBarBehavior?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacShapeBorder?, - width: freezed == width - ? _self.width - : width // ignore: cast_nullable_to_non_nullable - as double?, - contentTextStyle: freezed == contentTextStyle - ? _self.contentTextStyle - : contentTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - actionTextColor: freezed == actionTextColor - ? _self.actionTextColor - : actionTextColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledActionTextColor: freezed == disabledActionTextColor - ? _self.disabledActionTextColor - : disabledActionTextColor // ignore: cast_nullable_to_non_nullable - as String?, - insetPadding: freezed == insetPadding - ? _self.insetPadding - : insetPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - dismissDirection: freezed == dismissDirection - ? _self.dismissDirection - : dismissDirection // ignore: cast_nullable_to_non_nullable - as DismissDirection?, - showCloseIcon: freezed == showCloseIcon - ? _self.showCloseIcon - : showCloseIcon // ignore: cast_nullable_to_non_nullable - as bool?, - closeIconColor: freezed == closeIconColor - ? _self.closeIconColor - : closeIconColor // ignore: cast_nullable_to_non_nullable - as String?, - actionOverflowThreshold: freezed == actionOverflowThreshold - ? _self.actionOverflowThreshold - : actionOverflowThreshold // ignore: cast_nullable_to_non_nullable - as double?, - actionBackgroundColor: freezed == actionBackgroundColor - ? _self.actionBackgroundColor - : actionBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledActionBackgroundColor: freezed == disabledActionBackgroundColor - ? _self.disabledActionBackgroundColor - : disabledActionBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.g.dart deleted file mode 100644 index b7e751e87..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.g.dart +++ /dev/null @@ -1,72 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_snack_bar_theme_data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacSnackBarThemeData _$StacSnackBarThemeDataFromJson( - Map json) => - _StacSnackBarThemeData( - behavior: - $enumDecodeNullable(_$SnackBarBehaviorEnumMap, json['behavior']), - backgroundColor: json['backgroundColor'] as String?, - elevation: (json['elevation'] as num?)?.toDouble(), - shape: json['shape'] == null - ? null - : StacShapeBorder.fromJson(json['shape'] as Map), - width: (json['width'] as num?)?.toDouble(), - contentTextStyle: json['contentTextStyle'] == null - ? null - : StacTextStyle.fromJson(json['contentTextStyle']), - actionTextColor: json['actionTextColor'] as String?, - disabledActionTextColor: json['disabledActionTextColor'] as String?, - insetPadding: json['insetPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['insetPadding']), - dismissDirection: $enumDecodeNullable( - _$DismissDirectionEnumMap, json['dismissDirection']), - showCloseIcon: json['showCloseIcon'] as bool?, - closeIconColor: json['closeIconColor'] as String?, - actionOverflowThreshold: - (json['actionOverflowThreshold'] as num?)?.toDouble(), - actionBackgroundColor: json['actionBackgroundColor'] as String?, - disabledActionBackgroundColor: - json['disabledActionBackgroundColor'] as String?, - ); - -Map _$StacSnackBarThemeDataToJson( - _StacSnackBarThemeData instance) => - { - 'behavior': _$SnackBarBehaviorEnumMap[instance.behavior], - 'backgroundColor': instance.backgroundColor, - 'elevation': instance.elevation, - 'shape': instance.shape, - 'width': instance.width, - 'contentTextStyle': instance.contentTextStyle, - 'actionTextColor': instance.actionTextColor, - 'disabledActionTextColor': instance.disabledActionTextColor, - 'insetPadding': instance.insetPadding, - 'dismissDirection': _$DismissDirectionEnumMap[instance.dismissDirection], - 'showCloseIcon': instance.showCloseIcon, - 'closeIconColor': instance.closeIconColor, - 'actionOverflowThreshold': instance.actionOverflowThreshold, - 'actionBackgroundColor': instance.actionBackgroundColor, - 'disabledActionBackgroundColor': instance.disabledActionBackgroundColor, - }; - -const _$SnackBarBehaviorEnumMap = { - SnackBarBehavior.fixed: 'fixed', - SnackBarBehavior.floating: 'floating', -}; - -const _$DismissDirectionEnumMap = { - DismissDirection.vertical: 'vertical', - DismissDirection.horizontal: 'horizontal', - DismissDirection.endToStart: 'endToStart', - DismissDirection.startToEnd: 'startToEnd', - DismissDirection.up: 'up', - DismissDirection.down: 'down', - DismissDirection.none: 'none', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data_parser.dart similarity index 51% rename from packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart rename to packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data_parser.dart index eafcb02ec..ec99b3772 100644 --- a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data_parser.dart @@ -1,42 +1,19 @@ import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/foundation/borders/stac_shape_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/parsers/foundation/ui_components/stac_dismiss_direction_parser.dart'; +import 'package:stac/src/parsers/foundation/ui_components/stac_snack_bar_behavior_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_core/stac_core.dart'; -part 'stac_snack_bar_theme_data.freezed.dart'; -part 'stac_snack_bar_theme_data.g.dart'; - -@freezed -abstract class StacSnackBarThemeData with _$StacSnackBarThemeData { - const factory StacSnackBarThemeData({ - SnackBarBehavior? behavior, - String? backgroundColor, - double? elevation, - StacShapeBorder? shape, - double? width, - StacTextStyle? contentTextStyle, - String? actionTextColor, - String? disabledActionTextColor, - StacEdgeInsets? insetPadding, - DismissDirection? dismissDirection, - bool? showCloseIcon, - String? closeIconColor, - double? actionOverflowThreshold, - String? actionBackgroundColor, - String? disabledActionBackgroundColor, - }) = _StacSnackBarThemeData; - - factory StacSnackBarThemeData.fromJson(Map json) => - _$StacSnackBarThemeDataFromJson(json); -} - +/// Parser extension for [StacSnackBarThemeData]. +/// +/// Converts [StacSnackBarThemeData] to Flutter's [SnackBarThemeData]. extension StacSnackBarThemeDataParser on StacSnackBarThemeData { SnackBarThemeData? parse(BuildContext context) { return SnackBarThemeData( - behavior: behavior, + behavior: behavior?.parse, backgroundColor: backgroundColor?.toColor(context), elevation: elevation, shape: shape?.parse(context), @@ -45,13 +22,14 @@ extension StacSnackBarThemeDataParser on StacSnackBarThemeData { actionTextColor: actionTextColor?.toColor(context), disabledActionTextColor: disabledActionTextColor?.toColor(context), insetPadding: insetPadding?.parse, - dismissDirection: dismissDirection, + dismissDirection: dismissDirection?.parse, showCloseIcon: showCloseIcon, closeIconColor: closeIconColor?.toColor(context), actionOverflowThreshold: actionOverflowThreshold, actionBackgroundColor: actionBackgroundColor?.toColor(context), - disabledActionBackgroundColor: - disabledActionBackgroundColor?.toColor(context), + disabledActionBackgroundColor: disabledActionBackgroundColor?.toColor( + context, + ), ); } } diff --git a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart deleted file mode 100644 index 1cbc95f6c..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/decoration/stac_box_decoration_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'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_tab_bar_theme_data.freezed.dart'; -part 'stac_tab_bar_theme_data.g.dart'; - -@freezed -abstract class StacTabBarThemeData with _$StacTabBarThemeData { - const factory StacTabBarThemeData({ - StacBoxDecoration? indicator, - String? indicatorColor, - TabBarIndicatorSize? indicatorSize, - String? dividerColor, - String? labelColor, - StacEdgeInsets? labelPadding, - StacTextStyle? labelStyle, - String? unselectedLabelColor, - StacTextStyle? unselectedLabelStyle, - String? overlayColor, - }) = _StacTabBarThemeData; - - factory StacTabBarThemeData.fromJson(Map json) => - _$StacTabBarThemeDataFromJson(json); -} - -extension StacTabBarThemeDataParser on StacTabBarThemeData { - TabBarTheme? parse(BuildContext context) { - return TabBarTheme( - indicator: indicator?.parse(context), - indicatorColor: indicatorColor.toColor(context), - indicatorSize: indicatorSize, - dividerColor: dividerColor.toColor(context), - labelColor: labelColor.toColor(context), - labelPadding: labelPadding?.parse, - labelStyle: labelStyle?.parse(context), - unselectedLabelColor: unselectedLabelColor.toColor(context), - unselectedLabelStyle: unselectedLabelStyle?.parse(context), - overlayColor: WidgetStateProperty.all(overlayColor.toColor(context)), - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.freezed.dart deleted file mode 100644 index 4eac81c2b..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.freezed.dart +++ /dev/null @@ -1,587 +0,0 @@ -// 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 - -part of 'stac_tab_bar_theme_data.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacTabBarThemeData { - StacBoxDecoration? get indicator; - String? get indicatorColor; - TabBarIndicatorSize? get indicatorSize; - String? get dividerColor; - String? get labelColor; - StacEdgeInsets? get labelPadding; - StacTextStyle? get labelStyle; - String? get unselectedLabelColor; - StacTextStyle? get unselectedLabelStyle; - String? get overlayColor; - - /// Create a copy of StacTabBarThemeData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacTabBarThemeDataCopyWith get copyWith => - _$StacTabBarThemeDataCopyWithImpl( - this as StacTabBarThemeData, _$identity); - - /// Serializes this StacTabBarThemeData to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacTabBarThemeData && - (identical(other.indicator, indicator) || - other.indicator == indicator) && - (identical(other.indicatorColor, indicatorColor) || - other.indicatorColor == indicatorColor) && - (identical(other.indicatorSize, indicatorSize) || - other.indicatorSize == indicatorSize) && - (identical(other.dividerColor, dividerColor) || - other.dividerColor == dividerColor) && - (identical(other.labelColor, labelColor) || - other.labelColor == labelColor) && - (identical(other.labelPadding, labelPadding) || - other.labelPadding == labelPadding) && - (identical(other.labelStyle, labelStyle) || - other.labelStyle == labelStyle) && - (identical(other.unselectedLabelColor, unselectedLabelColor) || - other.unselectedLabelColor == unselectedLabelColor) && - (identical(other.unselectedLabelStyle, unselectedLabelStyle) || - other.unselectedLabelStyle == unselectedLabelStyle) && - (identical(other.overlayColor, overlayColor) || - other.overlayColor == overlayColor)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - indicator, - indicatorColor, - indicatorSize, - dividerColor, - labelColor, - labelPadding, - labelStyle, - unselectedLabelColor, - unselectedLabelStyle, - overlayColor); - - @override - String toString() { - return 'StacTabBarThemeData(indicator: $indicator, indicatorColor: $indicatorColor, indicatorSize: $indicatorSize, dividerColor: $dividerColor, labelColor: $labelColor, labelPadding: $labelPadding, labelStyle: $labelStyle, unselectedLabelColor: $unselectedLabelColor, unselectedLabelStyle: $unselectedLabelStyle, overlayColor: $overlayColor)'; - } -} - -/// @nodoc -abstract mixin class $StacTabBarThemeDataCopyWith<$Res> { - factory $StacTabBarThemeDataCopyWith( - StacTabBarThemeData value, $Res Function(StacTabBarThemeData) _then) = - _$StacTabBarThemeDataCopyWithImpl; - @useResult - $Res call( - {StacBoxDecoration? indicator, - String? indicatorColor, - TabBarIndicatorSize? indicatorSize, - String? dividerColor, - String? labelColor, - StacEdgeInsets? labelPadding, - StacTextStyle? labelStyle, - String? unselectedLabelColor, - StacTextStyle? unselectedLabelStyle, - String? overlayColor}); -} - -/// @nodoc -class _$StacTabBarThemeDataCopyWithImpl<$Res> - implements $StacTabBarThemeDataCopyWith<$Res> { - _$StacTabBarThemeDataCopyWithImpl(this._self, this._then); - - final StacTabBarThemeData _self; - final $Res Function(StacTabBarThemeData) _then; - - /// Create a copy of StacTabBarThemeData - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? indicator = freezed, - Object? indicatorColor = freezed, - Object? indicatorSize = freezed, - Object? dividerColor = freezed, - Object? labelColor = freezed, - Object? labelPadding = freezed, - Object? labelStyle = freezed, - Object? unselectedLabelColor = freezed, - Object? unselectedLabelStyle = freezed, - Object? overlayColor = freezed, - }) { - return _then(_self.copyWith( - indicator: freezed == indicator - ? _self.indicator - : indicator // ignore: cast_nullable_to_non_nullable - as StacBoxDecoration?, - indicatorColor: freezed == indicatorColor - ? _self.indicatorColor - : indicatorColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorSize: freezed == indicatorSize - ? _self.indicatorSize - : indicatorSize // ignore: cast_nullable_to_non_nullable - as TabBarIndicatorSize?, - dividerColor: freezed == dividerColor - ? _self.dividerColor - : dividerColor // ignore: cast_nullable_to_non_nullable - as String?, - labelColor: freezed == labelColor - ? _self.labelColor - : labelColor // ignore: cast_nullable_to_non_nullable - as String?, - labelPadding: freezed == labelPadding - ? _self.labelPadding - : labelPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - labelStyle: freezed == labelStyle - ? _self.labelStyle - : labelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - unselectedLabelColor: freezed == unselectedLabelColor - ? _self.unselectedLabelColor - : unselectedLabelColor // ignore: cast_nullable_to_non_nullable - as String?, - unselectedLabelStyle: freezed == unselectedLabelStyle - ? _self.unselectedLabelStyle - : unselectedLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - overlayColor: freezed == overlayColor - ? _self.overlayColor - : overlayColor // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacTabBarThemeData]. -extension StacTabBarThemeDataPatterns on StacTabBarThemeData { - /// 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(_StacTabBarThemeData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacTabBarThemeData() 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(_StacTabBarThemeData value) $default, - ) { - final _that = this; - switch (_that) { - case _StacTabBarThemeData(): - 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(_StacTabBarThemeData value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacTabBarThemeData() 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( - StacBoxDecoration? indicator, - String? indicatorColor, - TabBarIndicatorSize? indicatorSize, - String? dividerColor, - String? labelColor, - StacEdgeInsets? labelPadding, - StacTextStyle? labelStyle, - String? unselectedLabelColor, - StacTextStyle? unselectedLabelStyle, - String? overlayColor)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacTabBarThemeData() when $default != null: - return $default( - _that.indicator, - _that.indicatorColor, - _that.indicatorSize, - _that.dividerColor, - _that.labelColor, - _that.labelPadding, - _that.labelStyle, - _that.unselectedLabelColor, - _that.unselectedLabelStyle, - _that.overlayColor); - 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( - StacBoxDecoration? indicator, - String? indicatorColor, - TabBarIndicatorSize? indicatorSize, - String? dividerColor, - String? labelColor, - StacEdgeInsets? labelPadding, - StacTextStyle? labelStyle, - String? unselectedLabelColor, - StacTextStyle? unselectedLabelStyle, - String? overlayColor) - $default, - ) { - final _that = this; - switch (_that) { - case _StacTabBarThemeData(): - return $default( - _that.indicator, - _that.indicatorColor, - _that.indicatorSize, - _that.dividerColor, - _that.labelColor, - _that.labelPadding, - _that.labelStyle, - _that.unselectedLabelColor, - _that.unselectedLabelStyle, - _that.overlayColor); - 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( - StacBoxDecoration? indicator, - String? indicatorColor, - TabBarIndicatorSize? indicatorSize, - String? dividerColor, - String? labelColor, - StacEdgeInsets? labelPadding, - StacTextStyle? labelStyle, - String? unselectedLabelColor, - StacTextStyle? unselectedLabelStyle, - String? overlayColor)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacTabBarThemeData() when $default != null: - return $default( - _that.indicator, - _that.indicatorColor, - _that.indicatorSize, - _that.dividerColor, - _that.labelColor, - _that.labelPadding, - _that.labelStyle, - _that.unselectedLabelColor, - _that.unselectedLabelStyle, - _that.overlayColor); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacTabBarThemeData implements StacTabBarThemeData { - const _StacTabBarThemeData( - {this.indicator, - this.indicatorColor, - this.indicatorSize, - this.dividerColor, - this.labelColor, - this.labelPadding, - this.labelStyle, - this.unselectedLabelColor, - this.unselectedLabelStyle, - this.overlayColor}); - factory _StacTabBarThemeData.fromJson(Map json) => - _$StacTabBarThemeDataFromJson(json); - - @override - final StacBoxDecoration? indicator; - @override - final String? indicatorColor; - @override - final TabBarIndicatorSize? indicatorSize; - @override - final String? dividerColor; - @override - final String? labelColor; - @override - final StacEdgeInsets? labelPadding; - @override - final StacTextStyle? labelStyle; - @override - final String? unselectedLabelColor; - @override - final StacTextStyle? unselectedLabelStyle; - @override - final String? overlayColor; - - /// Create a copy of StacTabBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacTabBarThemeDataCopyWith<_StacTabBarThemeData> get copyWith => - __$StacTabBarThemeDataCopyWithImpl<_StacTabBarThemeData>( - this, _$identity); - - @override - Map toJson() { - return _$StacTabBarThemeDataToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacTabBarThemeData && - (identical(other.indicator, indicator) || - other.indicator == indicator) && - (identical(other.indicatorColor, indicatorColor) || - other.indicatorColor == indicatorColor) && - (identical(other.indicatorSize, indicatorSize) || - other.indicatorSize == indicatorSize) && - (identical(other.dividerColor, dividerColor) || - other.dividerColor == dividerColor) && - (identical(other.labelColor, labelColor) || - other.labelColor == labelColor) && - (identical(other.labelPadding, labelPadding) || - other.labelPadding == labelPadding) && - (identical(other.labelStyle, labelStyle) || - other.labelStyle == labelStyle) && - (identical(other.unselectedLabelColor, unselectedLabelColor) || - other.unselectedLabelColor == unselectedLabelColor) && - (identical(other.unselectedLabelStyle, unselectedLabelStyle) || - other.unselectedLabelStyle == unselectedLabelStyle) && - (identical(other.overlayColor, overlayColor) || - other.overlayColor == overlayColor)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - indicator, - indicatorColor, - indicatorSize, - dividerColor, - labelColor, - labelPadding, - labelStyle, - unselectedLabelColor, - unselectedLabelStyle, - overlayColor); - - @override - String toString() { - return 'StacTabBarThemeData(indicator: $indicator, indicatorColor: $indicatorColor, indicatorSize: $indicatorSize, dividerColor: $dividerColor, labelColor: $labelColor, labelPadding: $labelPadding, labelStyle: $labelStyle, unselectedLabelColor: $unselectedLabelColor, unselectedLabelStyle: $unselectedLabelStyle, overlayColor: $overlayColor)'; - } -} - -/// @nodoc -abstract mixin class _$StacTabBarThemeDataCopyWith<$Res> - implements $StacTabBarThemeDataCopyWith<$Res> { - factory _$StacTabBarThemeDataCopyWith(_StacTabBarThemeData value, - $Res Function(_StacTabBarThemeData) _then) = - __$StacTabBarThemeDataCopyWithImpl; - @override - @useResult - $Res call( - {StacBoxDecoration? indicator, - String? indicatorColor, - TabBarIndicatorSize? indicatorSize, - String? dividerColor, - String? labelColor, - StacEdgeInsets? labelPadding, - StacTextStyle? labelStyle, - String? unselectedLabelColor, - StacTextStyle? unselectedLabelStyle, - String? overlayColor}); -} - -/// @nodoc -class __$StacTabBarThemeDataCopyWithImpl<$Res> - implements _$StacTabBarThemeDataCopyWith<$Res> { - __$StacTabBarThemeDataCopyWithImpl(this._self, this._then); - - final _StacTabBarThemeData _self; - final $Res Function(_StacTabBarThemeData) _then; - - /// Create a copy of StacTabBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? indicator = freezed, - Object? indicatorColor = freezed, - Object? indicatorSize = freezed, - Object? dividerColor = freezed, - Object? labelColor = freezed, - Object? labelPadding = freezed, - Object? labelStyle = freezed, - Object? unselectedLabelColor = freezed, - Object? unselectedLabelStyle = freezed, - Object? overlayColor = freezed, - }) { - return _then(_StacTabBarThemeData( - indicator: freezed == indicator - ? _self.indicator - : indicator // ignore: cast_nullable_to_non_nullable - as StacBoxDecoration?, - indicatorColor: freezed == indicatorColor - ? _self.indicatorColor - : indicatorColor // ignore: cast_nullable_to_non_nullable - as String?, - indicatorSize: freezed == indicatorSize - ? _self.indicatorSize - : indicatorSize // ignore: cast_nullable_to_non_nullable - as TabBarIndicatorSize?, - dividerColor: freezed == dividerColor - ? _self.dividerColor - : dividerColor // ignore: cast_nullable_to_non_nullable - as String?, - labelColor: freezed == labelColor - ? _self.labelColor - : labelColor // ignore: cast_nullable_to_non_nullable - as String?, - labelPadding: freezed == labelPadding - ? _self.labelPadding - : labelPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - labelStyle: freezed == labelStyle - ? _self.labelStyle - : labelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - unselectedLabelColor: freezed == unselectedLabelColor - ? _self.unselectedLabelColor - : unselectedLabelColor // ignore: cast_nullable_to_non_nullable - as String?, - unselectedLabelStyle: freezed == unselectedLabelStyle - ? _self.unselectedLabelStyle - : unselectedLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - overlayColor: freezed == overlayColor - ? _self.overlayColor - : overlayColor // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data_parser.dart b/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data_parser.dart new file mode 100644 index 000000000..eb8fefd5c --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data_parser.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/decoration/stac_box_decoration_parser.dart'; +import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; +import 'package:stac/src/parsers/foundation/navigation/stac_tab_bar_indicator_size_parser.dart'; +import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacTabBarThemeData]. +/// +/// Converts [StacTabBarThemeData] to Flutter's [TabBarThemeData]. +extension StacTabBarThemeDataParser on StacTabBarThemeData { + TabBarThemeData? parse(BuildContext context) { + return TabBarThemeData( + indicator: indicator?.parse(context), + indicatorColor: indicatorColor?.toColor(context), + indicatorSize: indicatorSize?.parse, + dividerColor: dividerColor?.toColor(context), + labelColor: labelColor?.toColor(context), + labelPadding: labelPadding?.parse, + labelStyle: labelStyle?.parse(context), + unselectedLabelColor: unselectedLabelColor?.toColor(context), + unselectedLabelStyle: unselectedLabelStyle?.parse(context), + overlayColor: WidgetStateProperty.all(overlayColor?.toColor(context)), + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.freezed.dart deleted file mode 100644 index 396272f01..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.freezed.dart +++ /dev/null @@ -1,726 +0,0 @@ -// 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 - -part of 'stac_text_theme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacTextTheme { - StacTextStyle? get displayLarge; - StacTextStyle? get displayMedium; - StacTextStyle? get displaySmall; - StacTextStyle? get headlineLarge; - StacTextStyle? get headlineMedium; - StacTextStyle? get headlineSmall; - StacTextStyle? get titleLarge; - StacTextStyle? get titleMedium; - StacTextStyle? get titleSmall; - StacTextStyle? get bodyLarge; - StacTextStyle? get bodyMedium; - StacTextStyle? get bodySmall; - StacTextStyle? get labelLarge; - StacTextStyle? get labelMedium; - StacTextStyle? get labelSmall; - - /// Create a copy of StacTextTheme - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacTextThemeCopyWith get copyWith => - _$StacTextThemeCopyWithImpl( - this as StacTextTheme, _$identity); - - /// Serializes this StacTextTheme to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacTextTheme && - (identical(other.displayLarge, displayLarge) || - other.displayLarge == displayLarge) && - (identical(other.displayMedium, displayMedium) || - other.displayMedium == displayMedium) && - (identical(other.displaySmall, displaySmall) || - other.displaySmall == displaySmall) && - (identical(other.headlineLarge, headlineLarge) || - other.headlineLarge == headlineLarge) && - (identical(other.headlineMedium, headlineMedium) || - other.headlineMedium == headlineMedium) && - (identical(other.headlineSmall, headlineSmall) || - other.headlineSmall == headlineSmall) && - (identical(other.titleLarge, titleLarge) || - other.titleLarge == titleLarge) && - (identical(other.titleMedium, titleMedium) || - other.titleMedium == titleMedium) && - (identical(other.titleSmall, titleSmall) || - other.titleSmall == titleSmall) && - (identical(other.bodyLarge, bodyLarge) || - other.bodyLarge == bodyLarge) && - (identical(other.bodyMedium, bodyMedium) || - other.bodyMedium == bodyMedium) && - (identical(other.bodySmall, bodySmall) || - other.bodySmall == bodySmall) && - (identical(other.labelLarge, labelLarge) || - other.labelLarge == labelLarge) && - (identical(other.labelMedium, labelMedium) || - other.labelMedium == labelMedium) && - (identical(other.labelSmall, labelSmall) || - other.labelSmall == labelSmall)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - displayLarge, - displayMedium, - displaySmall, - headlineLarge, - headlineMedium, - headlineSmall, - titleLarge, - titleMedium, - titleSmall, - bodyLarge, - bodyMedium, - bodySmall, - labelLarge, - labelMedium, - labelSmall); - - @override - String toString() { - return 'StacTextTheme(displayLarge: $displayLarge, displayMedium: $displayMedium, displaySmall: $displaySmall, headlineLarge: $headlineLarge, headlineMedium: $headlineMedium, headlineSmall: $headlineSmall, titleLarge: $titleLarge, titleMedium: $titleMedium, titleSmall: $titleSmall, bodyLarge: $bodyLarge, bodyMedium: $bodyMedium, bodySmall: $bodySmall, labelLarge: $labelLarge, labelMedium: $labelMedium, labelSmall: $labelSmall)'; - } -} - -/// @nodoc -abstract mixin class $StacTextThemeCopyWith<$Res> { - factory $StacTextThemeCopyWith( - StacTextTheme value, $Res Function(StacTextTheme) _then) = - _$StacTextThemeCopyWithImpl; - @useResult - $Res call( - {StacTextStyle? displayLarge, - StacTextStyle? displayMedium, - StacTextStyle? displaySmall, - StacTextStyle? headlineLarge, - StacTextStyle? headlineMedium, - StacTextStyle? headlineSmall, - StacTextStyle? titleLarge, - StacTextStyle? titleMedium, - StacTextStyle? titleSmall, - StacTextStyle? bodyLarge, - StacTextStyle? bodyMedium, - StacTextStyle? bodySmall, - StacTextStyle? labelLarge, - StacTextStyle? labelMedium, - StacTextStyle? labelSmall}); -} - -/// @nodoc -class _$StacTextThemeCopyWithImpl<$Res> - implements $StacTextThemeCopyWith<$Res> { - _$StacTextThemeCopyWithImpl(this._self, this._then); - - final StacTextTheme _self; - final $Res Function(StacTextTheme) _then; - - /// Create a copy of StacTextTheme - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? displayLarge = freezed, - Object? displayMedium = freezed, - Object? displaySmall = freezed, - Object? headlineLarge = freezed, - Object? headlineMedium = freezed, - Object? headlineSmall = freezed, - Object? titleLarge = freezed, - Object? titleMedium = freezed, - Object? titleSmall = freezed, - Object? bodyLarge = freezed, - Object? bodyMedium = freezed, - Object? bodySmall = freezed, - Object? labelLarge = freezed, - Object? labelMedium = freezed, - Object? labelSmall = freezed, - }) { - return _then(_self.copyWith( - displayLarge: freezed == displayLarge - ? _self.displayLarge - : displayLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - displayMedium: freezed == displayMedium - ? _self.displayMedium - : displayMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - displaySmall: freezed == displaySmall - ? _self.displaySmall - : displaySmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - headlineLarge: freezed == headlineLarge - ? _self.headlineLarge - : headlineLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - headlineMedium: freezed == headlineMedium - ? _self.headlineMedium - : headlineMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - headlineSmall: freezed == headlineSmall - ? _self.headlineSmall - : headlineSmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - titleLarge: freezed == titleLarge - ? _self.titleLarge - : titleLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - titleMedium: freezed == titleMedium - ? _self.titleMedium - : titleMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - titleSmall: freezed == titleSmall - ? _self.titleSmall - : titleSmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - bodyLarge: freezed == bodyLarge - ? _self.bodyLarge - : bodyLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - bodyMedium: freezed == bodyMedium - ? _self.bodyMedium - : bodyMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - bodySmall: freezed == bodySmall - ? _self.bodySmall - : bodySmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - labelLarge: freezed == labelLarge - ? _self.labelLarge - : labelLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - labelMedium: freezed == labelMedium - ? _self.labelMedium - : labelMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - labelSmall: freezed == labelSmall - ? _self.labelSmall - : labelSmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacTextTheme]. -extension StacTextThemePatterns on StacTextTheme { - /// 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(_StacTextTheme value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacTextTheme() 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(_StacTextTheme value) $default, - ) { - final _that = this; - switch (_that) { - case _StacTextTheme(): - 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(_StacTextTheme value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacTextTheme() 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( - StacTextStyle? displayLarge, - StacTextStyle? displayMedium, - StacTextStyle? displaySmall, - StacTextStyle? headlineLarge, - StacTextStyle? headlineMedium, - StacTextStyle? headlineSmall, - StacTextStyle? titleLarge, - StacTextStyle? titleMedium, - StacTextStyle? titleSmall, - StacTextStyle? bodyLarge, - StacTextStyle? bodyMedium, - StacTextStyle? bodySmall, - StacTextStyle? labelLarge, - StacTextStyle? labelMedium, - StacTextStyle? labelSmall)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacTextTheme() when $default != null: - return $default( - _that.displayLarge, - _that.displayMedium, - _that.displaySmall, - _that.headlineLarge, - _that.headlineMedium, - _that.headlineSmall, - _that.titleLarge, - _that.titleMedium, - _that.titleSmall, - _that.bodyLarge, - _that.bodyMedium, - _that.bodySmall, - _that.labelLarge, - _that.labelMedium, - _that.labelSmall); - 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( - StacTextStyle? displayLarge, - StacTextStyle? displayMedium, - StacTextStyle? displaySmall, - StacTextStyle? headlineLarge, - StacTextStyle? headlineMedium, - StacTextStyle? headlineSmall, - StacTextStyle? titleLarge, - StacTextStyle? titleMedium, - StacTextStyle? titleSmall, - StacTextStyle? bodyLarge, - StacTextStyle? bodyMedium, - StacTextStyle? bodySmall, - StacTextStyle? labelLarge, - StacTextStyle? labelMedium, - StacTextStyle? labelSmall) - $default, - ) { - final _that = this; - switch (_that) { - case _StacTextTheme(): - return $default( - _that.displayLarge, - _that.displayMedium, - _that.displaySmall, - _that.headlineLarge, - _that.headlineMedium, - _that.headlineSmall, - _that.titleLarge, - _that.titleMedium, - _that.titleSmall, - _that.bodyLarge, - _that.bodyMedium, - _that.bodySmall, - _that.labelLarge, - _that.labelMedium, - _that.labelSmall); - 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( - StacTextStyle? displayLarge, - StacTextStyle? displayMedium, - StacTextStyle? displaySmall, - StacTextStyle? headlineLarge, - StacTextStyle? headlineMedium, - StacTextStyle? headlineSmall, - StacTextStyle? titleLarge, - StacTextStyle? titleMedium, - StacTextStyle? titleSmall, - StacTextStyle? bodyLarge, - StacTextStyle? bodyMedium, - StacTextStyle? bodySmall, - StacTextStyle? labelLarge, - StacTextStyle? labelMedium, - StacTextStyle? labelSmall)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacTextTheme() when $default != null: - return $default( - _that.displayLarge, - _that.displayMedium, - _that.displaySmall, - _that.headlineLarge, - _that.headlineMedium, - _that.headlineSmall, - _that.titleLarge, - _that.titleMedium, - _that.titleSmall, - _that.bodyLarge, - _that.bodyMedium, - _that.bodySmall, - _that.labelLarge, - _that.labelMedium, - _that.labelSmall); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacTextTheme implements StacTextTheme { - const _StacTextTheme( - {this.displayLarge, - this.displayMedium, - this.displaySmall, - this.headlineLarge, - this.headlineMedium, - this.headlineSmall, - this.titleLarge, - this.titleMedium, - this.titleSmall, - this.bodyLarge, - this.bodyMedium, - this.bodySmall, - this.labelLarge, - this.labelMedium, - this.labelSmall}); - factory _StacTextTheme.fromJson(Map json) => - _$StacTextThemeFromJson(json); - - @override - final StacTextStyle? displayLarge; - @override - final StacTextStyle? displayMedium; - @override - final StacTextStyle? displaySmall; - @override - final StacTextStyle? headlineLarge; - @override - final StacTextStyle? headlineMedium; - @override - final StacTextStyle? headlineSmall; - @override - final StacTextStyle? titleLarge; - @override - final StacTextStyle? titleMedium; - @override - final StacTextStyle? titleSmall; - @override - final StacTextStyle? bodyLarge; - @override - final StacTextStyle? bodyMedium; - @override - final StacTextStyle? bodySmall; - @override - final StacTextStyle? labelLarge; - @override - final StacTextStyle? labelMedium; - @override - final StacTextStyle? labelSmall; - - /// Create a copy of StacTextTheme - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacTextThemeCopyWith<_StacTextTheme> get copyWith => - __$StacTextThemeCopyWithImpl<_StacTextTheme>(this, _$identity); - - @override - Map toJson() { - return _$StacTextThemeToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacTextTheme && - (identical(other.displayLarge, displayLarge) || - other.displayLarge == displayLarge) && - (identical(other.displayMedium, displayMedium) || - other.displayMedium == displayMedium) && - (identical(other.displaySmall, displaySmall) || - other.displaySmall == displaySmall) && - (identical(other.headlineLarge, headlineLarge) || - other.headlineLarge == headlineLarge) && - (identical(other.headlineMedium, headlineMedium) || - other.headlineMedium == headlineMedium) && - (identical(other.headlineSmall, headlineSmall) || - other.headlineSmall == headlineSmall) && - (identical(other.titleLarge, titleLarge) || - other.titleLarge == titleLarge) && - (identical(other.titleMedium, titleMedium) || - other.titleMedium == titleMedium) && - (identical(other.titleSmall, titleSmall) || - other.titleSmall == titleSmall) && - (identical(other.bodyLarge, bodyLarge) || - other.bodyLarge == bodyLarge) && - (identical(other.bodyMedium, bodyMedium) || - other.bodyMedium == bodyMedium) && - (identical(other.bodySmall, bodySmall) || - other.bodySmall == bodySmall) && - (identical(other.labelLarge, labelLarge) || - other.labelLarge == labelLarge) && - (identical(other.labelMedium, labelMedium) || - other.labelMedium == labelMedium) && - (identical(other.labelSmall, labelSmall) || - other.labelSmall == labelSmall)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - displayLarge, - displayMedium, - displaySmall, - headlineLarge, - headlineMedium, - headlineSmall, - titleLarge, - titleMedium, - titleSmall, - bodyLarge, - bodyMedium, - bodySmall, - labelLarge, - labelMedium, - labelSmall); - - @override - String toString() { - return 'StacTextTheme(displayLarge: $displayLarge, displayMedium: $displayMedium, displaySmall: $displaySmall, headlineLarge: $headlineLarge, headlineMedium: $headlineMedium, headlineSmall: $headlineSmall, titleLarge: $titleLarge, titleMedium: $titleMedium, titleSmall: $titleSmall, bodyLarge: $bodyLarge, bodyMedium: $bodyMedium, bodySmall: $bodySmall, labelLarge: $labelLarge, labelMedium: $labelMedium, labelSmall: $labelSmall)'; - } -} - -/// @nodoc -abstract mixin class _$StacTextThemeCopyWith<$Res> - implements $StacTextThemeCopyWith<$Res> { - factory _$StacTextThemeCopyWith( - _StacTextTheme value, $Res Function(_StacTextTheme) _then) = - __$StacTextThemeCopyWithImpl; - @override - @useResult - $Res call( - {StacTextStyle? displayLarge, - StacTextStyle? displayMedium, - StacTextStyle? displaySmall, - StacTextStyle? headlineLarge, - StacTextStyle? headlineMedium, - StacTextStyle? headlineSmall, - StacTextStyle? titleLarge, - StacTextStyle? titleMedium, - StacTextStyle? titleSmall, - StacTextStyle? bodyLarge, - StacTextStyle? bodyMedium, - StacTextStyle? bodySmall, - StacTextStyle? labelLarge, - StacTextStyle? labelMedium, - StacTextStyle? labelSmall}); -} - -/// @nodoc -class __$StacTextThemeCopyWithImpl<$Res> - implements _$StacTextThemeCopyWith<$Res> { - __$StacTextThemeCopyWithImpl(this._self, this._then); - - final _StacTextTheme _self; - final $Res Function(_StacTextTheme) _then; - - /// Create a copy of StacTextTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? displayLarge = freezed, - Object? displayMedium = freezed, - Object? displaySmall = freezed, - Object? headlineLarge = freezed, - Object? headlineMedium = freezed, - Object? headlineSmall = freezed, - Object? titleLarge = freezed, - Object? titleMedium = freezed, - Object? titleSmall = freezed, - Object? bodyLarge = freezed, - Object? bodyMedium = freezed, - Object? bodySmall = freezed, - Object? labelLarge = freezed, - Object? labelMedium = freezed, - Object? labelSmall = freezed, - }) { - return _then(_StacTextTheme( - displayLarge: freezed == displayLarge - ? _self.displayLarge - : displayLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - displayMedium: freezed == displayMedium - ? _self.displayMedium - : displayMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - displaySmall: freezed == displaySmall - ? _self.displaySmall - : displaySmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - headlineLarge: freezed == headlineLarge - ? _self.headlineLarge - : headlineLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - headlineMedium: freezed == headlineMedium - ? _self.headlineMedium - : headlineMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - headlineSmall: freezed == headlineSmall - ? _self.headlineSmall - : headlineSmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - titleLarge: freezed == titleLarge - ? _self.titleLarge - : titleLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - titleMedium: freezed == titleMedium - ? _self.titleMedium - : titleMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - titleSmall: freezed == titleSmall - ? _self.titleSmall - : titleSmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - bodyLarge: freezed == bodyLarge - ? _self.bodyLarge - : bodyLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - bodyMedium: freezed == bodyMedium - ? _self.bodyMedium - : bodyMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - bodySmall: freezed == bodySmall - ? _self.bodySmall - : bodySmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - labelLarge: freezed == labelLarge - ? _self.labelLarge - : labelLarge // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - labelMedium: freezed == labelMedium - ? _self.labelMedium - : labelMedium // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - labelSmall: freezed == labelSmall - ? _self.labelSmall - : labelSmall // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.dart b/packages/stac/lib/src/parsers/theme/stac_text_theme_parser.dart similarity index 54% rename from packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.dart rename to packages/stac/lib/src/parsers/theme/stac_text_theme_parser.dart index 8da547365..71f20f57e 100644 --- a/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.dart +++ b/packages/stac/lib/src/parsers/theme/stac_text_theme_parser.dart @@ -1,35 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/foundation/text/stac_text_style_parser.dart'; import 'package:stac_core/stac_core.dart'; -part 'stac_text_theme.freezed.dart'; -part 'stac_text_theme.g.dart'; - -@freezed -abstract class StacTextTheme with _$StacTextTheme { - const factory StacTextTheme({ - StacTextStyle? displayLarge, - StacTextStyle? displayMedium, - StacTextStyle? displaySmall, - StacTextStyle? headlineLarge, - StacTextStyle? headlineMedium, - StacTextStyle? headlineSmall, - StacTextStyle? titleLarge, - StacTextStyle? titleMedium, - StacTextStyle? titleSmall, - StacTextStyle? bodyLarge, - StacTextStyle? bodyMedium, - StacTextStyle? bodySmall, - StacTextStyle? labelLarge, - StacTextStyle? labelMedium, - StacTextStyle? labelSmall, - }) = _StacTextTheme; - - factory StacTextTheme.fromJson(Map json) => - _$StacTextThemeFromJson(json); -} - +/// Parser extension for [StacTextTheme]. +/// +/// Converts [StacTextTheme] to Flutter's [TextTheme]. extension StacTextThemeParser on StacTextTheme { TextTheme? parse(BuildContext context) { return TextTheme( diff --git a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.dart b/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.dart deleted file mode 100644 index b3283be3c..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.dart +++ /dev/null @@ -1,221 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart'; -import 'package:stac/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart'; -import 'package:stac/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart'; -import 'package:stac/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart'; -import 'package:stac/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart'; -import 'package:stac/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart'; -import 'package:stac/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_material_color/stac_material_color.dart'; -import 'package:stac/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_text_theme/stac_text_theme.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/stac_core.dart'; - -part 'stac_theme.freezed.dart'; -part 'stac_theme.g.dart'; - -@freezed -abstract class StacTheme with _$StacTheme { - const factory StacTheme({ - // GENERAL CONFIGURATION - bool? applyElevationOverlayColor, - StacInputDecorationTheme? inputDecorationTheme, - MaterialTapTargetSize? materialTapTargetSize, - TargetPlatform? platform, - StacScrollbarThemeData? scrollbarTheme, - bool? useMaterial3, - // COLOR - StacColorScheme? colorScheme, - Brightness? brightness, - String? colorSchemeSeed, - // [colorScheme] is the preferred way to configure colors. The [Color] properties - // listed below (as well as primarySwatch) will gradually be phased out, see - // https://github.com/flutter/flutter/issues/91772. - String? canvasColor, - String? cardColor, - String? disabledColor, - String? dividerColor, - String? focusColor, - String? highlightColor, - String? hintColor, - String? hoverColor, - String? primaryColor, - String? primaryColorDark, - String? primaryColorLight, - StacMaterialColor? primarySwatch, - String? scaffoldBackgroundColor, - String? secondaryHeaderColor, - String? shadowColor, - String? splashColor, - String? unselectedWidgetColor, - // TYPOGRAPHY & ICONOGRAPHY - String? fontFamily, - List? fontFamilyFallback, - String? package, - StacIconThemeData? iconTheme, - StacIconThemeData? primaryIconTheme, - StacTextTheme? primaryTextTheme, - StacTextTheme? textTheme, - // COMPONENT THEMES - StacAppBarTheme? appBarTheme, - StacBadgeThemeData? badgeTheme, - StacMaterialBannerThemeData? bannerTheme, - StacBottomAppBarTheme? bottomAppBarTheme, - StacBottomNavBarThemeData? bottomNavigationBarTheme, - StacBottomSheetThemeData? bottomSheetTheme, - StacButtonThemeData? buttonTheme, - StacCardThemeData? cardTheme, - StacCheckboxThemeData? checkboxTheme, - StacChipThemeData? chipTheme, - StacDatePickerThemeData? datePickerTheme, - StacDialogTheme? dialogTheme, - StacDividerThemeData? dividerTheme, - StacDrawerThemeData? drawerTheme, - // DropdownMenuThemeData? dropdownMenuTheme, - StacButtonStyle? elevatedButtonTheme, - // ExpansionTileThemeData? expansionTileTheme, - StacButtonStyle? filledButtonTheme, - StacFloatingActionButtonThemeData? floatingActionButtonTheme, - StacButtonStyle? iconButtonTheme, - StacListTileThemeData? listTileTheme, - // MenuBarThemeData? menuBarTheme, - StacButtonStyle? menuButtonTheme, - // MenuThemeData? menuTheme, - StacNavigationBarThemeData? navigationBarTheme, - StacNavigationDrawerThemeData? navigationDrawerTheme, - // NavigationRailThemeData? navigationRailTheme, - StacButtonStyle? outlinedButtonTheme, - // PopupMenuThemeData? popupMenuTheme, - // ProgressIndicatorThemeData? progressIndicatorTheme, - // RadioThemeData? radioTheme, - // SearchBarThemeData? searchBarTheme, - // SearchViewThemeData? searchViewTheme, - StacButtonStyle? segmentedButtonTheme, - // SliderThemeData? sliderTheme, - StacSnackBarThemeData? snackBarTheme, - // SwitchThemeData? switchTheme, - StacTabBarThemeData? tabBarTheme, - StacButtonStyle? textButtonTheme, - // TextSelectionThemeData? textSelectionTheme, - // TimePickerThemeData? timePickerTheme, - // ToggleButtonsThemeData? toggleButtonsTheme, - // TooltipThemeData? tooltipTheme, - }) = _StacTheme; - - factory StacTheme.fromJson(Map json) => - _$StacThemeFromJson(json); -} - -extension StacThemeParser on StacTheme { - ThemeData? parse(BuildContext context) { - return ThemeData( - // GENERAL CONFIGURATION - applyElevationOverlayColor: applyElevationOverlayColor, - inputDecorationTheme: inputDecorationTheme?.parse(context), - materialTapTargetSize: materialTapTargetSize, - scrollbarTheme: scrollbarTheme?.parse(context), - useMaterial3: useMaterial3, - // COLOR - colorScheme: colorScheme?.parse(context), - brightness: brightness, - colorSchemeSeed: colorSchemeSeed.toColor(context), - canvasColor: canvasColor?.toColor(context), - cardColor: cardColor?.toColor(context), - disabledColor: disabledColor?.toColor(context), - dividerColor: dividerColor?.toColor(context), - focusColor: focusColor?.toColor(context), - highlightColor: highlightColor?.toColor(context), - hintColor: hintColor?.toColor(context), - hoverColor: hoverColor?.toColor(context), - primaryColor: primaryColor?.toColor(context), - primaryColorDark: primaryColorDark?.toColor(context), - primaryColorLight: primaryColorLight?.toColor(context), - primarySwatch: primarySwatch?.parse(context), - scaffoldBackgroundColor: scaffoldBackgroundColor?.toColor(context), - secondaryHeaderColor: secondaryHeaderColor?.toColor(context), - shadowColor: shadowColor?.toColor(context), - splashColor: splashColor?.toColor(context), - unselectedWidgetColor: unselectedWidgetColor?.toColor(context), - // TYPOGRAPHY & ICONOGRAPHY - fontFamily: fontFamily, - fontFamilyFallback: fontFamilyFallback, - package: package, - iconTheme: iconTheme?.parse(context), - primaryIconTheme: primaryIconTheme?.parse(context), - primaryTextTheme: primaryTextTheme?.parse(context), - textTheme: textTheme?.parse(context), - // COMPONENT THEMES - appBarTheme: appBarTheme?.parse(context), - badgeTheme: badgeTheme?.parse(context), - bannerTheme: bannerTheme?.parse(context), - bottomAppBarTheme: bottomAppBarTheme?.parse(context), - bottomNavigationBarTheme: bottomNavigationBarTheme?.parse(context), - bottomSheetTheme: bottomSheetTheme?.parse(context), - buttonTheme: buttonTheme?.parse(context), - cardTheme: cardTheme?.parse(context), - checkboxTheme: checkboxTheme?.parse(context), - chipTheme: chipTheme?.parse(context), - datePickerTheme: datePickerTheme?.parse(context), - dialogTheme: dialogTheme?.parse(context)?.data, - dividerTheme: dividerTheme?.parse(context), - drawerTheme: drawerTheme?.parse(context), - // DropdownMenuThemeData? dropdownMenuTheme, - elevatedButtonTheme: ElevatedButtonThemeData( - style: elevatedButtonTheme?.parseElevatedButton(context)), - // ExpansionTileThemeData? expansionTileTheme, - filledButtonTheme: FilledButtonThemeData( - style: filledButtonTheme?.parseFilledButton(context), - ), - floatingActionButtonTheme: floatingActionButtonTheme?.parse(context), - iconButtonTheme: - IconButtonThemeData(style: iconButtonTheme?.parseIconButton(context)), - listTileTheme: listTileTheme?.parse(context), - // MenuBarThemeData? menuBarTheme, - menuButtonTheme: MenuButtonThemeData( - style: menuButtonTheme?.parseElevatedButton(context), - ), - // MenuThemeData? menuTheme, - navigationBarTheme: navigationBarTheme?.parse(context), - navigationDrawerTheme: navigationDrawerTheme?.parse(context), - // NavigationRailThemeData? navigationRailTheme, - outlinedButtonTheme: OutlinedButtonThemeData( - style: outlinedButtonTheme?.parseOutlinedButton(context)), - // PopupMenuThemeData? popupMenuTheme, - // ProgressIndicatorThemeData? progressIndicatorTheme, - // RadioThemeData? radioTheme, - // SearchBarThemeData? searchBarTheme, - // SearchViewThemeData? searchViewTheme, - // SegmentedButtonThemeData? segmentedButtonTheme, - // SliderThemeData? sliderTheme, - snackBarTheme: snackBarTheme?.parse(context), - // SwitchThemeData? switchTheme, - // tabBarTheme: tabBarTheme?.parse(context), - textButtonTheme: TextButtonThemeData( - style: textButtonTheme?.parseTextButton(context), - ), - // TextSelectionThemeData? textSelectionTheme, - // TimePickerThemeData? timePickerTheme, - // ToggleButtonsThemeData? toggleButtonsTheme, - // TooltipThemeData? tooltipTheme, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.freezed.dart deleted file mode 100644 index 75abfe82f..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.freezed.dart +++ /dev/null @@ -1,2832 +0,0 @@ -// 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 - -part of 'stac_theme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacTheme { -// GENERAL CONFIGURATION - bool? get applyElevationOverlayColor; - StacInputDecorationTheme? get inputDecorationTheme; - MaterialTapTargetSize? get materialTapTargetSize; - TargetPlatform? get platform; - StacScrollbarThemeData? get scrollbarTheme; - bool? get useMaterial3; // COLOR - StacColorScheme? get colorScheme; - Brightness? get brightness; - String? - get colorSchemeSeed; // [colorScheme] is the preferred way to configure colors. The [Color] properties -// listed below (as well as primarySwatch) will gradually be phased out, see -// https://github.com/flutter/flutter/issues/91772. - String? get canvasColor; - String? get cardColor; - String? get disabledColor; - String? get dividerColor; - String? get focusColor; - String? get highlightColor; - String? get hintColor; - String? get hoverColor; - String? get primaryColor; - String? get primaryColorDark; - String? get primaryColorLight; - StacMaterialColor? get primarySwatch; - String? get scaffoldBackgroundColor; - String? get secondaryHeaderColor; - String? get shadowColor; - String? get splashColor; - String? get unselectedWidgetColor; // TYPOGRAPHY & ICONOGRAPHY - String? get fontFamily; - List? get fontFamilyFallback; - String? get package; - StacIconThemeData? get iconTheme; - StacIconThemeData? get primaryIconTheme; - StacTextTheme? get primaryTextTheme; - StacTextTheme? get textTheme; // COMPONENT THEMES - StacAppBarTheme? get appBarTheme; - StacBadgeThemeData? get badgeTheme; - StacMaterialBannerThemeData? get bannerTheme; - StacBottomAppBarTheme? get bottomAppBarTheme; - StacBottomNavBarThemeData? get bottomNavigationBarTheme; - StacBottomSheetThemeData? get bottomSheetTheme; - StacButtonThemeData? get buttonTheme; - StacCardThemeData? get cardTheme; - StacCheckboxThemeData? get checkboxTheme; - StacChipThemeData? get chipTheme; - StacDatePickerThemeData? get datePickerTheme; - StacDialogTheme? get dialogTheme; - StacDividerThemeData? get dividerTheme; - StacDrawerThemeData? - get drawerTheme; // DropdownMenuThemeData? dropdownMenuTheme, - StacButtonStyle? - get elevatedButtonTheme; // ExpansionTileThemeData? expansionTileTheme, - StacButtonStyle? get filledButtonTheme; - StacFloatingActionButtonThemeData? get floatingActionButtonTheme; - StacButtonStyle? get iconButtonTheme; - StacListTileThemeData? get listTileTheme; // MenuBarThemeData? menuBarTheme, - StacButtonStyle? get menuButtonTheme; // MenuThemeData? menuTheme, - StacNavigationBarThemeData? get navigationBarTheme; - StacNavigationDrawerThemeData? - get navigationDrawerTheme; // NavigationRailThemeData? navigationRailTheme, - StacButtonStyle? - get outlinedButtonTheme; // PopupMenuThemeData? popupMenuTheme, -// ProgressIndicatorThemeData? progressIndicatorTheme, -// RadioThemeData? radioTheme, -// SearchBarThemeData? searchBarTheme, -// SearchViewThemeData? searchViewTheme, - StacButtonStyle? get segmentedButtonTheme; // SliderThemeData? sliderTheme, - StacSnackBarThemeData? get snackBarTheme; // SwitchThemeData? switchTheme, - StacTabBarThemeData? get tabBarTheme; - StacButtonStyle? get textButtonTheme; - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacThemeCopyWith get copyWith => - _$StacThemeCopyWithImpl(this as StacTheme, _$identity); - - /// Serializes this StacTheme to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacTheme && - (identical(other.applyElevationOverlayColor, applyElevationOverlayColor) || - other.applyElevationOverlayColor == - applyElevationOverlayColor) && - (identical(other.inputDecorationTheme, inputDecorationTheme) || - other.inputDecorationTheme == inputDecorationTheme) && - (identical(other.materialTapTargetSize, materialTapTargetSize) || - other.materialTapTargetSize == materialTapTargetSize) && - (identical(other.platform, platform) || - other.platform == platform) && - (identical(other.scrollbarTheme, scrollbarTheme) || - other.scrollbarTheme == scrollbarTheme) && - (identical(other.useMaterial3, useMaterial3) || - other.useMaterial3 == useMaterial3) && - (identical(other.colorScheme, colorScheme) || - other.colorScheme == colorScheme) && - (identical(other.brightness, brightness) || - other.brightness == brightness) && - (identical(other.colorSchemeSeed, colorSchemeSeed) || - other.colorSchemeSeed == colorSchemeSeed) && - (identical(other.canvasColor, canvasColor) || - other.canvasColor == canvasColor) && - (identical(other.cardColor, cardColor) || - other.cardColor == cardColor) && - (identical(other.disabledColor, disabledColor) || - other.disabledColor == disabledColor) && - (identical(other.dividerColor, dividerColor) || - other.dividerColor == dividerColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.highlightColor, highlightColor) || - other.highlightColor == highlightColor) && - (identical(other.hintColor, hintColor) || - other.hintColor == hintColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.primaryColor, primaryColor) || - other.primaryColor == primaryColor) && - (identical(other.primaryColorDark, primaryColorDark) || - other.primaryColorDark == primaryColorDark) && - (identical(other.primaryColorLight, primaryColorLight) || - other.primaryColorLight == primaryColorLight) && - (identical(other.primarySwatch, primarySwatch) || - other.primarySwatch == primarySwatch) && - (identical(other.scaffoldBackgroundColor, scaffoldBackgroundColor) || - other.scaffoldBackgroundColor == scaffoldBackgroundColor) && - (identical(other.secondaryHeaderColor, secondaryHeaderColor) || - other.secondaryHeaderColor == secondaryHeaderColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.unselectedWidgetColor, unselectedWidgetColor) || - other.unselectedWidgetColor == unselectedWidgetColor) && - (identical(other.fontFamily, fontFamily) || - other.fontFamily == fontFamily) && - const DeepCollectionEquality() - .equals(other.fontFamilyFallback, fontFamilyFallback) && - (identical(other.package, package) || other.package == package) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme) && - (identical(other.primaryIconTheme, primaryIconTheme) || - other.primaryIconTheme == primaryIconTheme) && - (identical(other.primaryTextTheme, primaryTextTheme) || - other.primaryTextTheme == primaryTextTheme) && - (identical(other.textTheme, textTheme) || - other.textTheme == textTheme) && - (identical(other.appBarTheme, appBarTheme) || other.appBarTheme == appBarTheme) && - (identical(other.badgeTheme, badgeTheme) || other.badgeTheme == badgeTheme) && - (identical(other.bannerTheme, bannerTheme) || other.bannerTheme == bannerTheme) && - (identical(other.bottomAppBarTheme, bottomAppBarTheme) || other.bottomAppBarTheme == bottomAppBarTheme) && - (identical(other.bottomNavigationBarTheme, bottomNavigationBarTheme) || other.bottomNavigationBarTheme == bottomNavigationBarTheme) && - (identical(other.bottomSheetTheme, bottomSheetTheme) || other.bottomSheetTheme == bottomSheetTheme) && - (identical(other.buttonTheme, buttonTheme) || other.buttonTheme == buttonTheme) && - (identical(other.cardTheme, cardTheme) || other.cardTheme == cardTheme) && - (identical(other.checkboxTheme, checkboxTheme) || other.checkboxTheme == checkboxTheme) && - (identical(other.chipTheme, chipTheme) || other.chipTheme == chipTheme) && - (identical(other.datePickerTheme, datePickerTheme) || other.datePickerTheme == datePickerTheme) && - (identical(other.dialogTheme, dialogTheme) || other.dialogTheme == dialogTheme) && - (identical(other.dividerTheme, dividerTheme) || other.dividerTheme == dividerTheme) && - (identical(other.drawerTheme, drawerTheme) || other.drawerTheme == drawerTheme) && - (identical(other.elevatedButtonTheme, elevatedButtonTheme) || other.elevatedButtonTheme == elevatedButtonTheme) && - (identical(other.filledButtonTheme, filledButtonTheme) || other.filledButtonTheme == filledButtonTheme) && - (identical(other.floatingActionButtonTheme, floatingActionButtonTheme) || other.floatingActionButtonTheme == floatingActionButtonTheme) && - (identical(other.iconButtonTheme, iconButtonTheme) || other.iconButtonTheme == iconButtonTheme) && - (identical(other.listTileTheme, listTileTheme) || other.listTileTheme == listTileTheme) && - (identical(other.menuButtonTheme, menuButtonTheme) || other.menuButtonTheme == menuButtonTheme) && - (identical(other.navigationBarTheme, navigationBarTheme) || other.navigationBarTheme == navigationBarTheme) && - (identical(other.navigationDrawerTheme, navigationDrawerTheme) || other.navigationDrawerTheme == navigationDrawerTheme) && - (identical(other.outlinedButtonTheme, outlinedButtonTheme) || other.outlinedButtonTheme == outlinedButtonTheme) && - (identical(other.segmentedButtonTheme, segmentedButtonTheme) || other.segmentedButtonTheme == segmentedButtonTheme) && - (identical(other.snackBarTheme, snackBarTheme) || other.snackBarTheme == snackBarTheme) && - (identical(other.tabBarTheme, tabBarTheme) || other.tabBarTheme == tabBarTheme) && - (identical(other.textButtonTheme, textButtonTheme) || other.textButtonTheme == textButtonTheme)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - applyElevationOverlayColor, - inputDecorationTheme, - materialTapTargetSize, - platform, - scrollbarTheme, - useMaterial3, - colorScheme, - brightness, - colorSchemeSeed, - canvasColor, - cardColor, - disabledColor, - dividerColor, - focusColor, - highlightColor, - hintColor, - hoverColor, - primaryColor, - primaryColorDark, - primaryColorLight, - primarySwatch, - scaffoldBackgroundColor, - secondaryHeaderColor, - shadowColor, - splashColor, - unselectedWidgetColor, - fontFamily, - const DeepCollectionEquality().hash(fontFamilyFallback), - package, - iconTheme, - primaryIconTheme, - primaryTextTheme, - textTheme, - appBarTheme, - badgeTheme, - bannerTheme, - bottomAppBarTheme, - bottomNavigationBarTheme, - bottomSheetTheme, - buttonTheme, - cardTheme, - checkboxTheme, - chipTheme, - datePickerTheme, - dialogTheme, - dividerTheme, - drawerTheme, - elevatedButtonTheme, - filledButtonTheme, - floatingActionButtonTheme, - iconButtonTheme, - listTileTheme, - menuButtonTheme, - navigationBarTheme, - navigationDrawerTheme, - outlinedButtonTheme, - segmentedButtonTheme, - snackBarTheme, - tabBarTheme, - textButtonTheme - ]); - - @override - String toString() { - return 'StacTheme(applyElevationOverlayColor: $applyElevationOverlayColor, inputDecorationTheme: $inputDecorationTheme, materialTapTargetSize: $materialTapTargetSize, platform: $platform, scrollbarTheme: $scrollbarTheme, useMaterial3: $useMaterial3, colorScheme: $colorScheme, brightness: $brightness, colorSchemeSeed: $colorSchemeSeed, canvasColor: $canvasColor, cardColor: $cardColor, disabledColor: $disabledColor, dividerColor: $dividerColor, focusColor: $focusColor, highlightColor: $highlightColor, hintColor: $hintColor, hoverColor: $hoverColor, primaryColor: $primaryColor, primaryColorDark: $primaryColorDark, primaryColorLight: $primaryColorLight, primarySwatch: $primarySwatch, scaffoldBackgroundColor: $scaffoldBackgroundColor, secondaryHeaderColor: $secondaryHeaderColor, shadowColor: $shadowColor, splashColor: $splashColor, unselectedWidgetColor: $unselectedWidgetColor, fontFamily: $fontFamily, fontFamilyFallback: $fontFamilyFallback, package: $package, iconTheme: $iconTheme, primaryIconTheme: $primaryIconTheme, primaryTextTheme: $primaryTextTheme, textTheme: $textTheme, appBarTheme: $appBarTheme, badgeTheme: $badgeTheme, bannerTheme: $bannerTheme, bottomAppBarTheme: $bottomAppBarTheme, bottomNavigationBarTheme: $bottomNavigationBarTheme, bottomSheetTheme: $bottomSheetTheme, buttonTheme: $buttonTheme, cardTheme: $cardTheme, checkboxTheme: $checkboxTheme, chipTheme: $chipTheme, datePickerTheme: $datePickerTheme, dialogTheme: $dialogTheme, dividerTheme: $dividerTheme, drawerTheme: $drawerTheme, elevatedButtonTheme: $elevatedButtonTheme, filledButtonTheme: $filledButtonTheme, floatingActionButtonTheme: $floatingActionButtonTheme, iconButtonTheme: $iconButtonTheme, listTileTheme: $listTileTheme, menuButtonTheme: $menuButtonTheme, navigationBarTheme: $navigationBarTheme, navigationDrawerTheme: $navigationDrawerTheme, outlinedButtonTheme: $outlinedButtonTheme, segmentedButtonTheme: $segmentedButtonTheme, snackBarTheme: $snackBarTheme, tabBarTheme: $tabBarTheme, textButtonTheme: $textButtonTheme)'; - } -} - -/// @nodoc -abstract mixin class $StacThemeCopyWith<$Res> { - factory $StacThemeCopyWith(StacTheme value, $Res Function(StacTheme) _then) = - _$StacThemeCopyWithImpl; - @useResult - $Res call( - {bool? applyElevationOverlayColor, - StacInputDecorationTheme? inputDecorationTheme, - MaterialTapTargetSize? materialTapTargetSize, - TargetPlatform? platform, - StacScrollbarThemeData? scrollbarTheme, - bool? useMaterial3, - StacColorScheme? colorScheme, - Brightness? brightness, - String? colorSchemeSeed, - String? canvasColor, - String? cardColor, - String? disabledColor, - String? dividerColor, - String? focusColor, - String? highlightColor, - String? hintColor, - String? hoverColor, - String? primaryColor, - String? primaryColorDark, - String? primaryColorLight, - StacMaterialColor? primarySwatch, - String? scaffoldBackgroundColor, - String? secondaryHeaderColor, - String? shadowColor, - String? splashColor, - String? unselectedWidgetColor, - String? fontFamily, - List? fontFamilyFallback, - String? package, - StacIconThemeData? iconTheme, - StacIconThemeData? primaryIconTheme, - StacTextTheme? primaryTextTheme, - StacTextTheme? textTheme, - StacAppBarTheme? appBarTheme, - StacBadgeThemeData? badgeTheme, - StacMaterialBannerThemeData? bannerTheme, - StacBottomAppBarTheme? bottomAppBarTheme, - StacBottomNavBarThemeData? bottomNavigationBarTheme, - StacBottomSheetThemeData? bottomSheetTheme, - StacButtonThemeData? buttonTheme, - StacCardThemeData? cardTheme, - StacCheckboxThemeData? checkboxTheme, - StacChipThemeData? chipTheme, - StacDatePickerThemeData? datePickerTheme, - StacDialogTheme? dialogTheme, - StacDividerThemeData? dividerTheme, - StacDrawerThemeData? drawerTheme, - StacButtonStyle? elevatedButtonTheme, - StacButtonStyle? filledButtonTheme, - StacFloatingActionButtonThemeData? floatingActionButtonTheme, - StacButtonStyle? iconButtonTheme, - StacListTileThemeData? listTileTheme, - StacButtonStyle? menuButtonTheme, - StacNavigationBarThemeData? navigationBarTheme, - StacNavigationDrawerThemeData? navigationDrawerTheme, - StacButtonStyle? outlinedButtonTheme, - StacButtonStyle? segmentedButtonTheme, - StacSnackBarThemeData? snackBarTheme, - StacTabBarThemeData? tabBarTheme, - StacButtonStyle? textButtonTheme}); - - $StacScrollbarThemeDataCopyWith<$Res>? get scrollbarTheme; - $StacColorSchemeCopyWith<$Res>? get colorScheme; - $StacMaterialColorCopyWith<$Res>? get primarySwatch; - $StacIconThemeDataCopyWith<$Res>? get iconTheme; - $StacIconThemeDataCopyWith<$Res>? get primaryIconTheme; - $StacTextThemeCopyWith<$Res>? get primaryTextTheme; - $StacTextThemeCopyWith<$Res>? get textTheme; - $StacAppBarThemeCopyWith<$Res>? get appBarTheme; - $StacBadgeThemeDataCopyWith<$Res>? get badgeTheme; - $StacMaterialBannerThemeDataCopyWith<$Res>? get bannerTheme; - $StacBottomAppBarThemeCopyWith<$Res>? get bottomAppBarTheme; - $StacBottomNavBarThemeDataCopyWith<$Res>? get bottomNavigationBarTheme; - $StacBottomSheetThemeDataCopyWith<$Res>? get bottomSheetTheme; - $StacButtonThemeDataCopyWith<$Res>? get buttonTheme; - $StacCardThemeDataCopyWith<$Res>? get cardTheme; - $StacCheckboxThemeDataCopyWith<$Res>? get checkboxTheme; - $StacChipThemeDataCopyWith<$Res>? get chipTheme; - $StacDatePickerThemeDataCopyWith<$Res>? get datePickerTheme; - $StacDialogThemeCopyWith<$Res>? get dialogTheme; - $StacDividerThemeDataCopyWith<$Res>? get dividerTheme; - $StacDrawerThemeDataCopyWith<$Res>? get drawerTheme; - $StacFloatingActionButtonThemeDataCopyWith<$Res>? - get floatingActionButtonTheme; - $StacListTileThemeDataCopyWith<$Res>? get listTileTheme; - $StacNavigationBarThemeDataCopyWith<$Res>? get navigationBarTheme; - $StacNavigationDrawerThemeDataCopyWith<$Res>? get navigationDrawerTheme; - $StacSnackBarThemeDataCopyWith<$Res>? get snackBarTheme; - $StacTabBarThemeDataCopyWith<$Res>? get tabBarTheme; -} - -/// @nodoc -class _$StacThemeCopyWithImpl<$Res> implements $StacThemeCopyWith<$Res> { - _$StacThemeCopyWithImpl(this._self, this._then); - - final StacTheme _self; - final $Res Function(StacTheme) _then; - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? applyElevationOverlayColor = freezed, - Object? inputDecorationTheme = freezed, - Object? materialTapTargetSize = freezed, - Object? platform = freezed, - Object? scrollbarTheme = freezed, - Object? useMaterial3 = freezed, - Object? colorScheme = freezed, - Object? brightness = freezed, - Object? colorSchemeSeed = freezed, - Object? canvasColor = freezed, - Object? cardColor = freezed, - Object? disabledColor = freezed, - Object? dividerColor = freezed, - Object? focusColor = freezed, - Object? highlightColor = freezed, - Object? hintColor = freezed, - Object? hoverColor = freezed, - Object? primaryColor = freezed, - Object? primaryColorDark = freezed, - Object? primaryColorLight = freezed, - Object? primarySwatch = freezed, - Object? scaffoldBackgroundColor = freezed, - Object? secondaryHeaderColor = freezed, - Object? shadowColor = freezed, - Object? splashColor = freezed, - Object? unselectedWidgetColor = freezed, - Object? fontFamily = freezed, - Object? fontFamilyFallback = freezed, - Object? package = freezed, - Object? iconTheme = freezed, - Object? primaryIconTheme = freezed, - Object? primaryTextTheme = freezed, - Object? textTheme = freezed, - Object? appBarTheme = freezed, - Object? badgeTheme = freezed, - Object? bannerTheme = freezed, - Object? bottomAppBarTheme = freezed, - Object? bottomNavigationBarTheme = freezed, - Object? bottomSheetTheme = freezed, - Object? buttonTheme = freezed, - Object? cardTheme = freezed, - Object? checkboxTheme = freezed, - Object? chipTheme = freezed, - Object? datePickerTheme = freezed, - Object? dialogTheme = freezed, - Object? dividerTheme = freezed, - Object? drawerTheme = freezed, - Object? elevatedButtonTheme = freezed, - Object? filledButtonTheme = freezed, - Object? floatingActionButtonTheme = freezed, - Object? iconButtonTheme = freezed, - Object? listTileTheme = freezed, - Object? menuButtonTheme = freezed, - Object? navigationBarTheme = freezed, - Object? navigationDrawerTheme = freezed, - Object? outlinedButtonTheme = freezed, - Object? segmentedButtonTheme = freezed, - Object? snackBarTheme = freezed, - Object? tabBarTheme = freezed, - Object? textButtonTheme = freezed, - }) { - return _then(_self.copyWith( - applyElevationOverlayColor: freezed == applyElevationOverlayColor - ? _self.applyElevationOverlayColor - : applyElevationOverlayColor // ignore: cast_nullable_to_non_nullable - as bool?, - inputDecorationTheme: freezed == inputDecorationTheme - ? _self.inputDecorationTheme - : inputDecorationTheme // ignore: cast_nullable_to_non_nullable - as StacInputDecorationTheme?, - materialTapTargetSize: freezed == materialTapTargetSize - ? _self.materialTapTargetSize - : materialTapTargetSize // ignore: cast_nullable_to_non_nullable - as MaterialTapTargetSize?, - platform: freezed == platform - ? _self.platform - : platform // ignore: cast_nullable_to_non_nullable - as TargetPlatform?, - scrollbarTheme: freezed == scrollbarTheme - ? _self.scrollbarTheme - : scrollbarTheme // ignore: cast_nullable_to_non_nullable - as StacScrollbarThemeData?, - useMaterial3: freezed == useMaterial3 - ? _self.useMaterial3 - : useMaterial3 // ignore: cast_nullable_to_non_nullable - as bool?, - colorScheme: freezed == colorScheme - ? _self.colorScheme - : colorScheme // ignore: cast_nullable_to_non_nullable - as StacColorScheme?, - brightness: freezed == brightness - ? _self.brightness - : brightness // ignore: cast_nullable_to_non_nullable - as Brightness?, - colorSchemeSeed: freezed == colorSchemeSeed - ? _self.colorSchemeSeed - : colorSchemeSeed // ignore: cast_nullable_to_non_nullable - as String?, - canvasColor: freezed == canvasColor - ? _self.canvasColor - : canvasColor // ignore: cast_nullable_to_non_nullable - as String?, - cardColor: freezed == cardColor - ? _self.cardColor - : cardColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledColor: freezed == disabledColor - ? _self.disabledColor - : disabledColor // ignore: cast_nullable_to_non_nullable - as String?, - dividerColor: freezed == dividerColor - ? _self.dividerColor - : dividerColor // ignore: cast_nullable_to_non_nullable - as String?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - highlightColor: freezed == highlightColor - ? _self.highlightColor - : highlightColor // ignore: cast_nullable_to_non_nullable - as String?, - hintColor: freezed == hintColor - ? _self.hintColor - : hintColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - primaryColor: freezed == primaryColor - ? _self.primaryColor - : primaryColor // ignore: cast_nullable_to_non_nullable - as String?, - primaryColorDark: freezed == primaryColorDark - ? _self.primaryColorDark - : primaryColorDark // ignore: cast_nullable_to_non_nullable - as String?, - primaryColorLight: freezed == primaryColorLight - ? _self.primaryColorLight - : primaryColorLight // ignore: cast_nullable_to_non_nullable - as String?, - primarySwatch: freezed == primarySwatch - ? _self.primarySwatch - : primarySwatch // ignore: cast_nullable_to_non_nullable - as StacMaterialColor?, - scaffoldBackgroundColor: freezed == scaffoldBackgroundColor - ? _self.scaffoldBackgroundColor - : scaffoldBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - secondaryHeaderColor: freezed == secondaryHeaderColor - ? _self.secondaryHeaderColor - : secondaryHeaderColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - unselectedWidgetColor: freezed == unselectedWidgetColor - ? _self.unselectedWidgetColor - : unselectedWidgetColor // ignore: cast_nullable_to_non_nullable - as String?, - fontFamily: freezed == fontFamily - ? _self.fontFamily - : fontFamily // ignore: cast_nullable_to_non_nullable - as String?, - fontFamilyFallback: freezed == fontFamilyFallback - ? _self.fontFamilyFallback - : fontFamilyFallback // ignore: cast_nullable_to_non_nullable - as List?, - package: freezed == package - ? _self.package - : package // ignore: cast_nullable_to_non_nullable - as String?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - primaryIconTheme: freezed == primaryIconTheme - ? _self.primaryIconTheme - : primaryIconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - primaryTextTheme: freezed == primaryTextTheme - ? _self.primaryTextTheme - : primaryTextTheme // ignore: cast_nullable_to_non_nullable - as StacTextTheme?, - textTheme: freezed == textTheme - ? _self.textTheme - : textTheme // ignore: cast_nullable_to_non_nullable - as StacTextTheme?, - appBarTheme: freezed == appBarTheme - ? _self.appBarTheme - : appBarTheme // ignore: cast_nullable_to_non_nullable - as StacAppBarTheme?, - badgeTheme: freezed == badgeTheme - ? _self.badgeTheme - : badgeTheme // ignore: cast_nullable_to_non_nullable - as StacBadgeThemeData?, - bannerTheme: freezed == bannerTheme - ? _self.bannerTheme - : bannerTheme // ignore: cast_nullable_to_non_nullable - as StacMaterialBannerThemeData?, - bottomAppBarTheme: freezed == bottomAppBarTheme - ? _self.bottomAppBarTheme - : bottomAppBarTheme // ignore: cast_nullable_to_non_nullable - as StacBottomAppBarTheme?, - bottomNavigationBarTheme: freezed == bottomNavigationBarTheme - ? _self.bottomNavigationBarTheme - : bottomNavigationBarTheme // ignore: cast_nullable_to_non_nullable - as StacBottomNavBarThemeData?, - bottomSheetTheme: freezed == bottomSheetTheme - ? _self.bottomSheetTheme - : bottomSheetTheme // ignore: cast_nullable_to_non_nullable - as StacBottomSheetThemeData?, - buttonTheme: freezed == buttonTheme - ? _self.buttonTheme - : buttonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonThemeData?, - cardTheme: freezed == cardTheme - ? _self.cardTheme - : cardTheme // ignore: cast_nullable_to_non_nullable - as StacCardThemeData?, - checkboxTheme: freezed == checkboxTheme - ? _self.checkboxTheme - : checkboxTheme // ignore: cast_nullable_to_non_nullable - as StacCheckboxThemeData?, - chipTheme: freezed == chipTheme - ? _self.chipTheme - : chipTheme // ignore: cast_nullable_to_non_nullable - as StacChipThemeData?, - datePickerTheme: freezed == datePickerTheme - ? _self.datePickerTheme - : datePickerTheme // ignore: cast_nullable_to_non_nullable - as StacDatePickerThemeData?, - dialogTheme: freezed == dialogTheme - ? _self.dialogTheme - : dialogTheme // ignore: cast_nullable_to_non_nullable - as StacDialogTheme?, - dividerTheme: freezed == dividerTheme - ? _self.dividerTheme - : dividerTheme // ignore: cast_nullable_to_non_nullable - as StacDividerThemeData?, - drawerTheme: freezed == drawerTheme - ? _self.drawerTheme - : drawerTheme // ignore: cast_nullable_to_non_nullable - as StacDrawerThemeData?, - elevatedButtonTheme: freezed == elevatedButtonTheme - ? _self.elevatedButtonTheme - : elevatedButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - filledButtonTheme: freezed == filledButtonTheme - ? _self.filledButtonTheme - : filledButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - floatingActionButtonTheme: freezed == floatingActionButtonTheme - ? _self.floatingActionButtonTheme - : floatingActionButtonTheme // ignore: cast_nullable_to_non_nullable - as StacFloatingActionButtonThemeData?, - iconButtonTheme: freezed == iconButtonTheme - ? _self.iconButtonTheme - : iconButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - listTileTheme: freezed == listTileTheme - ? _self.listTileTheme - : listTileTheme // ignore: cast_nullable_to_non_nullable - as StacListTileThemeData?, - menuButtonTheme: freezed == menuButtonTheme - ? _self.menuButtonTheme - : menuButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - navigationBarTheme: freezed == navigationBarTheme - ? _self.navigationBarTheme - : navigationBarTheme // ignore: cast_nullable_to_non_nullable - as StacNavigationBarThemeData?, - navigationDrawerTheme: freezed == navigationDrawerTheme - ? _self.navigationDrawerTheme - : navigationDrawerTheme // ignore: cast_nullable_to_non_nullable - as StacNavigationDrawerThemeData?, - outlinedButtonTheme: freezed == outlinedButtonTheme - ? _self.outlinedButtonTheme - : outlinedButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - segmentedButtonTheme: freezed == segmentedButtonTheme - ? _self.segmentedButtonTheme - : segmentedButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - snackBarTheme: freezed == snackBarTheme - ? _self.snackBarTheme - : snackBarTheme // ignore: cast_nullable_to_non_nullable - as StacSnackBarThemeData?, - tabBarTheme: freezed == tabBarTheme - ? _self.tabBarTheme - : tabBarTheme // ignore: cast_nullable_to_non_nullable - as StacTabBarThemeData?, - textButtonTheme: freezed == textButtonTheme - ? _self.textButtonTheme - : textButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - )); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacScrollbarThemeDataCopyWith<$Res>? get scrollbarTheme { - if (_self.scrollbarTheme == null) { - return null; - } - - return $StacScrollbarThemeDataCopyWith<$Res>(_self.scrollbarTheme!, - (value) { - return _then(_self.copyWith(scrollbarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacColorSchemeCopyWith<$Res>? get colorScheme { - if (_self.colorScheme == null) { - return null; - } - - return $StacColorSchemeCopyWith<$Res>(_self.colorScheme!, (value) { - return _then(_self.copyWith(colorScheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacMaterialColorCopyWith<$Res>? get primarySwatch { - if (_self.primarySwatch == null) { - return null; - } - - return $StacMaterialColorCopyWith<$Res>(_self.primarySwatch!, (value) { - return _then(_self.copyWith(primarySwatch: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get primaryIconTheme { - if (_self.primaryIconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.primaryIconTheme!, (value) { - return _then(_self.copyWith(primaryIconTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacTextThemeCopyWith<$Res>? get primaryTextTheme { - if (_self.primaryTextTheme == null) { - return null; - } - - return $StacTextThemeCopyWith<$Res>(_self.primaryTextTheme!, (value) { - return _then(_self.copyWith(primaryTextTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacTextThemeCopyWith<$Res>? get textTheme { - if (_self.textTheme == null) { - return null; - } - - return $StacTextThemeCopyWith<$Res>(_self.textTheme!, (value) { - return _then(_self.copyWith(textTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacAppBarThemeCopyWith<$Res>? get appBarTheme { - if (_self.appBarTheme == null) { - return null; - } - - return $StacAppBarThemeCopyWith<$Res>(_self.appBarTheme!, (value) { - return _then(_self.copyWith(appBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacBadgeThemeDataCopyWith<$Res>? get badgeTheme { - if (_self.badgeTheme == null) { - return null; - } - - return $StacBadgeThemeDataCopyWith<$Res>(_self.badgeTheme!, (value) { - return _then(_self.copyWith(badgeTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacMaterialBannerThemeDataCopyWith<$Res>? get bannerTheme { - if (_self.bannerTheme == null) { - return null; - } - - return $StacMaterialBannerThemeDataCopyWith<$Res>(_self.bannerTheme!, - (value) { - return _then(_self.copyWith(bannerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacBottomAppBarThemeCopyWith<$Res>? get bottomAppBarTheme { - if (_self.bottomAppBarTheme == null) { - return null; - } - - return $StacBottomAppBarThemeCopyWith<$Res>(_self.bottomAppBarTheme!, - (value) { - return _then(_self.copyWith(bottomAppBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacBottomNavBarThemeDataCopyWith<$Res>? get bottomNavigationBarTheme { - if (_self.bottomNavigationBarTheme == null) { - return null; - } - - return $StacBottomNavBarThemeDataCopyWith<$Res>( - _self.bottomNavigationBarTheme!, (value) { - return _then(_self.copyWith(bottomNavigationBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacBottomSheetThemeDataCopyWith<$Res>? get bottomSheetTheme { - if (_self.bottomSheetTheme == null) { - return null; - } - - return $StacBottomSheetThemeDataCopyWith<$Res>(_self.bottomSheetTheme!, - (value) { - return _then(_self.copyWith(bottomSheetTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonThemeDataCopyWith<$Res>? get buttonTheme { - if (_self.buttonTheme == null) { - return null; - } - - return $StacButtonThemeDataCopyWith<$Res>(_self.buttonTheme!, (value) { - return _then(_self.copyWith(buttonTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacCardThemeDataCopyWith<$Res>? get cardTheme { - if (_self.cardTheme == null) { - return null; - } - - return $StacCardThemeDataCopyWith<$Res>(_self.cardTheme!, (value) { - return _then(_self.copyWith(cardTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacCheckboxThemeDataCopyWith<$Res>? get checkboxTheme { - if (_self.checkboxTheme == null) { - return null; - } - - return $StacCheckboxThemeDataCopyWith<$Res>(_self.checkboxTheme!, (value) { - return _then(_self.copyWith(checkboxTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacChipThemeDataCopyWith<$Res>? get chipTheme { - if (_self.chipTheme == null) { - return null; - } - - return $StacChipThemeDataCopyWith<$Res>(_self.chipTheme!, (value) { - return _then(_self.copyWith(chipTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacDatePickerThemeDataCopyWith<$Res>? get datePickerTheme { - if (_self.datePickerTheme == null) { - return null; - } - - return $StacDatePickerThemeDataCopyWith<$Res>(_self.datePickerTheme!, - (value) { - return _then(_self.copyWith(datePickerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacDialogThemeCopyWith<$Res>? get dialogTheme { - if (_self.dialogTheme == null) { - return null; - } - - return $StacDialogThemeCopyWith<$Res>(_self.dialogTheme!, (value) { - return _then(_self.copyWith(dialogTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacDividerThemeDataCopyWith<$Res>? get dividerTheme { - if (_self.dividerTheme == null) { - return null; - } - - return $StacDividerThemeDataCopyWith<$Res>(_self.dividerTheme!, (value) { - return _then(_self.copyWith(dividerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacDrawerThemeDataCopyWith<$Res>? get drawerTheme { - if (_self.drawerTheme == null) { - return null; - } - - return $StacDrawerThemeDataCopyWith<$Res>(_self.drawerTheme!, (value) { - return _then(_self.copyWith(drawerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacFloatingActionButtonThemeDataCopyWith<$Res>? - get floatingActionButtonTheme { - if (_self.floatingActionButtonTheme == null) { - return null; - } - - return $StacFloatingActionButtonThemeDataCopyWith<$Res>( - _self.floatingActionButtonTheme!, (value) { - return _then(_self.copyWith(floatingActionButtonTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacListTileThemeDataCopyWith<$Res>? get listTileTheme { - if (_self.listTileTheme == null) { - return null; - } - - return $StacListTileThemeDataCopyWith<$Res>(_self.listTileTheme!, (value) { - return _then(_self.copyWith(listTileTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacNavigationBarThemeDataCopyWith<$Res>? get navigationBarTheme { - if (_self.navigationBarTheme == null) { - return null; - } - - return $StacNavigationBarThemeDataCopyWith<$Res>(_self.navigationBarTheme!, - (value) { - return _then(_self.copyWith(navigationBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacNavigationDrawerThemeDataCopyWith<$Res>? get navigationDrawerTheme { - if (_self.navigationDrawerTheme == null) { - return null; - } - - return $StacNavigationDrawerThemeDataCopyWith<$Res>( - _self.navigationDrawerTheme!, (value) { - return _then(_self.copyWith(navigationDrawerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSnackBarThemeDataCopyWith<$Res>? get snackBarTheme { - if (_self.snackBarTheme == null) { - return null; - } - - return $StacSnackBarThemeDataCopyWith<$Res>(_self.snackBarTheme!, (value) { - return _then(_self.copyWith(snackBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacTabBarThemeDataCopyWith<$Res>? get tabBarTheme { - if (_self.tabBarTheme == null) { - return null; - } - - return $StacTabBarThemeDataCopyWith<$Res>(_self.tabBarTheme!, (value) { - return _then(_self.copyWith(tabBarTheme: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacTheme]. -extension StacThemePatterns on StacTheme { - /// 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(_StacTheme value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacTheme() 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(_StacTheme value) $default, - ) { - final _that = this; - switch (_that) { - case _StacTheme(): - 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(_StacTheme value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacTheme() 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( - bool? applyElevationOverlayColor, - StacInputDecorationTheme? inputDecorationTheme, - MaterialTapTargetSize? materialTapTargetSize, - TargetPlatform? platform, - StacScrollbarThemeData? scrollbarTheme, - bool? useMaterial3, - StacColorScheme? colorScheme, - Brightness? brightness, - String? colorSchemeSeed, - String? canvasColor, - String? cardColor, - String? disabledColor, - String? dividerColor, - String? focusColor, - String? highlightColor, - String? hintColor, - String? hoverColor, - String? primaryColor, - String? primaryColorDark, - String? primaryColorLight, - StacMaterialColor? primarySwatch, - String? scaffoldBackgroundColor, - String? secondaryHeaderColor, - String? shadowColor, - String? splashColor, - String? unselectedWidgetColor, - String? fontFamily, - List? fontFamilyFallback, - String? package, - StacIconThemeData? iconTheme, - StacIconThemeData? primaryIconTheme, - StacTextTheme? primaryTextTheme, - StacTextTheme? textTheme, - StacAppBarTheme? appBarTheme, - StacBadgeThemeData? badgeTheme, - StacMaterialBannerThemeData? bannerTheme, - StacBottomAppBarTheme? bottomAppBarTheme, - StacBottomNavBarThemeData? bottomNavigationBarTheme, - StacBottomSheetThemeData? bottomSheetTheme, - StacButtonThemeData? buttonTheme, - StacCardThemeData? cardTheme, - StacCheckboxThemeData? checkboxTheme, - StacChipThemeData? chipTheme, - StacDatePickerThemeData? datePickerTheme, - StacDialogTheme? dialogTheme, - StacDividerThemeData? dividerTheme, - StacDrawerThemeData? drawerTheme, - StacButtonStyle? elevatedButtonTheme, - StacButtonStyle? filledButtonTheme, - StacFloatingActionButtonThemeData? floatingActionButtonTheme, - StacButtonStyle? iconButtonTheme, - StacListTileThemeData? listTileTheme, - StacButtonStyle? menuButtonTheme, - StacNavigationBarThemeData? navigationBarTheme, - StacNavigationDrawerThemeData? navigationDrawerTheme, - StacButtonStyle? outlinedButtonTheme, - StacButtonStyle? segmentedButtonTheme, - StacSnackBarThemeData? snackBarTheme, - StacTabBarThemeData? tabBarTheme, - StacButtonStyle? textButtonTheme)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacTheme() when $default != null: - return $default( - _that.applyElevationOverlayColor, - _that.inputDecorationTheme, - _that.materialTapTargetSize, - _that.platform, - _that.scrollbarTheme, - _that.useMaterial3, - _that.colorScheme, - _that.brightness, - _that.colorSchemeSeed, - _that.canvasColor, - _that.cardColor, - _that.disabledColor, - _that.dividerColor, - _that.focusColor, - _that.highlightColor, - _that.hintColor, - _that.hoverColor, - _that.primaryColor, - _that.primaryColorDark, - _that.primaryColorLight, - _that.primarySwatch, - _that.scaffoldBackgroundColor, - _that.secondaryHeaderColor, - _that.shadowColor, - _that.splashColor, - _that.unselectedWidgetColor, - _that.fontFamily, - _that.fontFamilyFallback, - _that.package, - _that.iconTheme, - _that.primaryIconTheme, - _that.primaryTextTheme, - _that.textTheme, - _that.appBarTheme, - _that.badgeTheme, - _that.bannerTheme, - _that.bottomAppBarTheme, - _that.bottomNavigationBarTheme, - _that.bottomSheetTheme, - _that.buttonTheme, - _that.cardTheme, - _that.checkboxTheme, - _that.chipTheme, - _that.datePickerTheme, - _that.dialogTheme, - _that.dividerTheme, - _that.drawerTheme, - _that.elevatedButtonTheme, - _that.filledButtonTheme, - _that.floatingActionButtonTheme, - _that.iconButtonTheme, - _that.listTileTheme, - _that.menuButtonTheme, - _that.navigationBarTheme, - _that.navigationDrawerTheme, - _that.outlinedButtonTheme, - _that.segmentedButtonTheme, - _that.snackBarTheme, - _that.tabBarTheme, - _that.textButtonTheme); - 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( - bool? applyElevationOverlayColor, - StacInputDecorationTheme? inputDecorationTheme, - MaterialTapTargetSize? materialTapTargetSize, - TargetPlatform? platform, - StacScrollbarThemeData? scrollbarTheme, - bool? useMaterial3, - StacColorScheme? colorScheme, - Brightness? brightness, - String? colorSchemeSeed, - String? canvasColor, - String? cardColor, - String? disabledColor, - String? dividerColor, - String? focusColor, - String? highlightColor, - String? hintColor, - String? hoverColor, - String? primaryColor, - String? primaryColorDark, - String? primaryColorLight, - StacMaterialColor? primarySwatch, - String? scaffoldBackgroundColor, - String? secondaryHeaderColor, - String? shadowColor, - String? splashColor, - String? unselectedWidgetColor, - String? fontFamily, - List? fontFamilyFallback, - String? package, - StacIconThemeData? iconTheme, - StacIconThemeData? primaryIconTheme, - StacTextTheme? primaryTextTheme, - StacTextTheme? textTheme, - StacAppBarTheme? appBarTheme, - StacBadgeThemeData? badgeTheme, - StacMaterialBannerThemeData? bannerTheme, - StacBottomAppBarTheme? bottomAppBarTheme, - StacBottomNavBarThemeData? bottomNavigationBarTheme, - StacBottomSheetThemeData? bottomSheetTheme, - StacButtonThemeData? buttonTheme, - StacCardThemeData? cardTheme, - StacCheckboxThemeData? checkboxTheme, - StacChipThemeData? chipTheme, - StacDatePickerThemeData? datePickerTheme, - StacDialogTheme? dialogTheme, - StacDividerThemeData? dividerTheme, - StacDrawerThemeData? drawerTheme, - StacButtonStyle? elevatedButtonTheme, - StacButtonStyle? filledButtonTheme, - StacFloatingActionButtonThemeData? floatingActionButtonTheme, - StacButtonStyle? iconButtonTheme, - StacListTileThemeData? listTileTheme, - StacButtonStyle? menuButtonTheme, - StacNavigationBarThemeData? navigationBarTheme, - StacNavigationDrawerThemeData? navigationDrawerTheme, - StacButtonStyle? outlinedButtonTheme, - StacButtonStyle? segmentedButtonTheme, - StacSnackBarThemeData? snackBarTheme, - StacTabBarThemeData? tabBarTheme, - StacButtonStyle? textButtonTheme) - $default, - ) { - final _that = this; - switch (_that) { - case _StacTheme(): - return $default( - _that.applyElevationOverlayColor, - _that.inputDecorationTheme, - _that.materialTapTargetSize, - _that.platform, - _that.scrollbarTheme, - _that.useMaterial3, - _that.colorScheme, - _that.brightness, - _that.colorSchemeSeed, - _that.canvasColor, - _that.cardColor, - _that.disabledColor, - _that.dividerColor, - _that.focusColor, - _that.highlightColor, - _that.hintColor, - _that.hoverColor, - _that.primaryColor, - _that.primaryColorDark, - _that.primaryColorLight, - _that.primarySwatch, - _that.scaffoldBackgroundColor, - _that.secondaryHeaderColor, - _that.shadowColor, - _that.splashColor, - _that.unselectedWidgetColor, - _that.fontFamily, - _that.fontFamilyFallback, - _that.package, - _that.iconTheme, - _that.primaryIconTheme, - _that.primaryTextTheme, - _that.textTheme, - _that.appBarTheme, - _that.badgeTheme, - _that.bannerTheme, - _that.bottomAppBarTheme, - _that.bottomNavigationBarTheme, - _that.bottomSheetTheme, - _that.buttonTheme, - _that.cardTheme, - _that.checkboxTheme, - _that.chipTheme, - _that.datePickerTheme, - _that.dialogTheme, - _that.dividerTheme, - _that.drawerTheme, - _that.elevatedButtonTheme, - _that.filledButtonTheme, - _that.floatingActionButtonTheme, - _that.iconButtonTheme, - _that.listTileTheme, - _that.menuButtonTheme, - _that.navigationBarTheme, - _that.navigationDrawerTheme, - _that.outlinedButtonTheme, - _that.segmentedButtonTheme, - _that.snackBarTheme, - _that.tabBarTheme, - _that.textButtonTheme); - 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( - bool? applyElevationOverlayColor, - StacInputDecorationTheme? inputDecorationTheme, - MaterialTapTargetSize? materialTapTargetSize, - TargetPlatform? platform, - StacScrollbarThemeData? scrollbarTheme, - bool? useMaterial3, - StacColorScheme? colorScheme, - Brightness? brightness, - String? colorSchemeSeed, - String? canvasColor, - String? cardColor, - String? disabledColor, - String? dividerColor, - String? focusColor, - String? highlightColor, - String? hintColor, - String? hoverColor, - String? primaryColor, - String? primaryColorDark, - String? primaryColorLight, - StacMaterialColor? primarySwatch, - String? scaffoldBackgroundColor, - String? secondaryHeaderColor, - String? shadowColor, - String? splashColor, - String? unselectedWidgetColor, - String? fontFamily, - List? fontFamilyFallback, - String? package, - StacIconThemeData? iconTheme, - StacIconThemeData? primaryIconTheme, - StacTextTheme? primaryTextTheme, - StacTextTheme? textTheme, - StacAppBarTheme? appBarTheme, - StacBadgeThemeData? badgeTheme, - StacMaterialBannerThemeData? bannerTheme, - StacBottomAppBarTheme? bottomAppBarTheme, - StacBottomNavBarThemeData? bottomNavigationBarTheme, - StacBottomSheetThemeData? bottomSheetTheme, - StacButtonThemeData? buttonTheme, - StacCardThemeData? cardTheme, - StacCheckboxThemeData? checkboxTheme, - StacChipThemeData? chipTheme, - StacDatePickerThemeData? datePickerTheme, - StacDialogTheme? dialogTheme, - StacDividerThemeData? dividerTheme, - StacDrawerThemeData? drawerTheme, - StacButtonStyle? elevatedButtonTheme, - StacButtonStyle? filledButtonTheme, - StacFloatingActionButtonThemeData? floatingActionButtonTheme, - StacButtonStyle? iconButtonTheme, - StacListTileThemeData? listTileTheme, - StacButtonStyle? menuButtonTheme, - StacNavigationBarThemeData? navigationBarTheme, - StacNavigationDrawerThemeData? navigationDrawerTheme, - StacButtonStyle? outlinedButtonTheme, - StacButtonStyle? segmentedButtonTheme, - StacSnackBarThemeData? snackBarTheme, - StacTabBarThemeData? tabBarTheme, - StacButtonStyle? textButtonTheme)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacTheme() when $default != null: - return $default( - _that.applyElevationOverlayColor, - _that.inputDecorationTheme, - _that.materialTapTargetSize, - _that.platform, - _that.scrollbarTheme, - _that.useMaterial3, - _that.colorScheme, - _that.brightness, - _that.colorSchemeSeed, - _that.canvasColor, - _that.cardColor, - _that.disabledColor, - _that.dividerColor, - _that.focusColor, - _that.highlightColor, - _that.hintColor, - _that.hoverColor, - _that.primaryColor, - _that.primaryColorDark, - _that.primaryColorLight, - _that.primarySwatch, - _that.scaffoldBackgroundColor, - _that.secondaryHeaderColor, - _that.shadowColor, - _that.splashColor, - _that.unselectedWidgetColor, - _that.fontFamily, - _that.fontFamilyFallback, - _that.package, - _that.iconTheme, - _that.primaryIconTheme, - _that.primaryTextTheme, - _that.textTheme, - _that.appBarTheme, - _that.badgeTheme, - _that.bannerTheme, - _that.bottomAppBarTheme, - _that.bottomNavigationBarTheme, - _that.bottomSheetTheme, - _that.buttonTheme, - _that.cardTheme, - _that.checkboxTheme, - _that.chipTheme, - _that.datePickerTheme, - _that.dialogTheme, - _that.dividerTheme, - _that.drawerTheme, - _that.elevatedButtonTheme, - _that.filledButtonTheme, - _that.floatingActionButtonTheme, - _that.iconButtonTheme, - _that.listTileTheme, - _that.menuButtonTheme, - _that.navigationBarTheme, - _that.navigationDrawerTheme, - _that.outlinedButtonTheme, - _that.segmentedButtonTheme, - _that.snackBarTheme, - _that.tabBarTheme, - _that.textButtonTheme); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacTheme implements StacTheme { - const _StacTheme( - {this.applyElevationOverlayColor, - this.inputDecorationTheme, - this.materialTapTargetSize, - this.platform, - this.scrollbarTheme, - this.useMaterial3, - this.colorScheme, - this.brightness, - this.colorSchemeSeed, - this.canvasColor, - this.cardColor, - this.disabledColor, - this.dividerColor, - this.focusColor, - this.highlightColor, - this.hintColor, - this.hoverColor, - this.primaryColor, - this.primaryColorDark, - this.primaryColorLight, - this.primarySwatch, - this.scaffoldBackgroundColor, - this.secondaryHeaderColor, - this.shadowColor, - this.splashColor, - this.unselectedWidgetColor, - this.fontFamily, - final List? fontFamilyFallback, - this.package, - this.iconTheme, - this.primaryIconTheme, - this.primaryTextTheme, - this.textTheme, - this.appBarTheme, - this.badgeTheme, - this.bannerTheme, - this.bottomAppBarTheme, - this.bottomNavigationBarTheme, - this.bottomSheetTheme, - this.buttonTheme, - this.cardTheme, - this.checkboxTheme, - this.chipTheme, - this.datePickerTheme, - this.dialogTheme, - this.dividerTheme, - this.drawerTheme, - this.elevatedButtonTheme, - this.filledButtonTheme, - this.floatingActionButtonTheme, - this.iconButtonTheme, - this.listTileTheme, - this.menuButtonTheme, - this.navigationBarTheme, - this.navigationDrawerTheme, - this.outlinedButtonTheme, - this.segmentedButtonTheme, - this.snackBarTheme, - this.tabBarTheme, - this.textButtonTheme}) - : _fontFamilyFallback = fontFamilyFallback; - factory _StacTheme.fromJson(Map json) => - _$StacThemeFromJson(json); - -// GENERAL CONFIGURATION - @override - final bool? applyElevationOverlayColor; - @override - final StacInputDecorationTheme? inputDecorationTheme; - @override - final MaterialTapTargetSize? materialTapTargetSize; - @override - final TargetPlatform? platform; - @override - final StacScrollbarThemeData? scrollbarTheme; - @override - final bool? useMaterial3; -// COLOR - @override - final StacColorScheme? colorScheme; - @override - final Brightness? brightness; - @override - final String? colorSchemeSeed; -// [colorScheme] is the preferred way to configure colors. The [Color] properties -// listed below (as well as primarySwatch) will gradually be phased out, see -// https://github.com/flutter/flutter/issues/91772. - @override - final String? canvasColor; - @override - final String? cardColor; - @override - final String? disabledColor; - @override - final String? dividerColor; - @override - final String? focusColor; - @override - final String? highlightColor; - @override - final String? hintColor; - @override - final String? hoverColor; - @override - final String? primaryColor; - @override - final String? primaryColorDark; - @override - final String? primaryColorLight; - @override - final StacMaterialColor? primarySwatch; - @override - final String? scaffoldBackgroundColor; - @override - final String? secondaryHeaderColor; - @override - final String? shadowColor; - @override - final String? splashColor; - @override - final String? unselectedWidgetColor; -// TYPOGRAPHY & ICONOGRAPHY - @override - final String? fontFamily; - final List? _fontFamilyFallback; - @override - List? get fontFamilyFallback { - final value = _fontFamilyFallback; - if (value == null) return null; - if (_fontFamilyFallback is EqualUnmodifiableListView) - return _fontFamilyFallback; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - final String? package; - @override - final StacIconThemeData? iconTheme; - @override - final StacIconThemeData? primaryIconTheme; - @override - final StacTextTheme? primaryTextTheme; - @override - final StacTextTheme? textTheme; -// COMPONENT THEMES - @override - final StacAppBarTheme? appBarTheme; - @override - final StacBadgeThemeData? badgeTheme; - @override - final StacMaterialBannerThemeData? bannerTheme; - @override - final StacBottomAppBarTheme? bottomAppBarTheme; - @override - final StacBottomNavBarThemeData? bottomNavigationBarTheme; - @override - final StacBottomSheetThemeData? bottomSheetTheme; - @override - final StacButtonThemeData? buttonTheme; - @override - final StacCardThemeData? cardTheme; - @override - final StacCheckboxThemeData? checkboxTheme; - @override - final StacChipThemeData? chipTheme; - @override - final StacDatePickerThemeData? datePickerTheme; - @override - final StacDialogTheme? dialogTheme; - @override - final StacDividerThemeData? dividerTheme; - @override - final StacDrawerThemeData? drawerTheme; -// DropdownMenuThemeData? dropdownMenuTheme, - @override - final StacButtonStyle? elevatedButtonTheme; -// ExpansionTileThemeData? expansionTileTheme, - @override - final StacButtonStyle? filledButtonTheme; - @override - final StacFloatingActionButtonThemeData? floatingActionButtonTheme; - @override - final StacButtonStyle? iconButtonTheme; - @override - final StacListTileThemeData? listTileTheme; -// MenuBarThemeData? menuBarTheme, - @override - final StacButtonStyle? menuButtonTheme; -// MenuThemeData? menuTheme, - @override - final StacNavigationBarThemeData? navigationBarTheme; - @override - final StacNavigationDrawerThemeData? navigationDrawerTheme; -// NavigationRailThemeData? navigationRailTheme, - @override - final StacButtonStyle? outlinedButtonTheme; -// PopupMenuThemeData? popupMenuTheme, -// ProgressIndicatorThemeData? progressIndicatorTheme, -// RadioThemeData? radioTheme, -// SearchBarThemeData? searchBarTheme, -// SearchViewThemeData? searchViewTheme, - @override - final StacButtonStyle? segmentedButtonTheme; -// SliderThemeData? sliderTheme, - @override - final StacSnackBarThemeData? snackBarTheme; -// SwitchThemeData? switchTheme, - @override - final StacTabBarThemeData? tabBarTheme; - @override - final StacButtonStyle? textButtonTheme; - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacThemeCopyWith<_StacTheme> get copyWith => - __$StacThemeCopyWithImpl<_StacTheme>(this, _$identity); - - @override - Map toJson() { - return _$StacThemeToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacTheme && - (identical(other.applyElevationOverlayColor, applyElevationOverlayColor) || - other.applyElevationOverlayColor == - applyElevationOverlayColor) && - (identical(other.inputDecorationTheme, inputDecorationTheme) || - other.inputDecorationTheme == inputDecorationTheme) && - (identical(other.materialTapTargetSize, materialTapTargetSize) || - other.materialTapTargetSize == materialTapTargetSize) && - (identical(other.platform, platform) || - other.platform == platform) && - (identical(other.scrollbarTheme, scrollbarTheme) || - other.scrollbarTheme == scrollbarTheme) && - (identical(other.useMaterial3, useMaterial3) || - other.useMaterial3 == useMaterial3) && - (identical(other.colorScheme, colorScheme) || - other.colorScheme == colorScheme) && - (identical(other.brightness, brightness) || - other.brightness == brightness) && - (identical(other.colorSchemeSeed, colorSchemeSeed) || - other.colorSchemeSeed == colorSchemeSeed) && - (identical(other.canvasColor, canvasColor) || - other.canvasColor == canvasColor) && - (identical(other.cardColor, cardColor) || - other.cardColor == cardColor) && - (identical(other.disabledColor, disabledColor) || - other.disabledColor == disabledColor) && - (identical(other.dividerColor, dividerColor) || - other.dividerColor == dividerColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.highlightColor, highlightColor) || - other.highlightColor == highlightColor) && - (identical(other.hintColor, hintColor) || - other.hintColor == hintColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.primaryColor, primaryColor) || - other.primaryColor == primaryColor) && - (identical(other.primaryColorDark, primaryColorDark) || - other.primaryColorDark == primaryColorDark) && - (identical(other.primaryColorLight, primaryColorLight) || - other.primaryColorLight == primaryColorLight) && - (identical(other.primarySwatch, primarySwatch) || - other.primarySwatch == primarySwatch) && - (identical(other.scaffoldBackgroundColor, scaffoldBackgroundColor) || - other.scaffoldBackgroundColor == scaffoldBackgroundColor) && - (identical(other.secondaryHeaderColor, secondaryHeaderColor) || - other.secondaryHeaderColor == secondaryHeaderColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.unselectedWidgetColor, unselectedWidgetColor) || - other.unselectedWidgetColor == unselectedWidgetColor) && - (identical(other.fontFamily, fontFamily) || - other.fontFamily == fontFamily) && - const DeepCollectionEquality() - .equals(other._fontFamilyFallback, _fontFamilyFallback) && - (identical(other.package, package) || other.package == package) && - (identical(other.iconTheme, iconTheme) || - other.iconTheme == iconTheme) && - (identical(other.primaryIconTheme, primaryIconTheme) || - other.primaryIconTheme == primaryIconTheme) && - (identical(other.primaryTextTheme, primaryTextTheme) || - other.primaryTextTheme == primaryTextTheme) && - (identical(other.textTheme, textTheme) || - other.textTheme == textTheme) && - (identical(other.appBarTheme, appBarTheme) || other.appBarTheme == appBarTheme) && - (identical(other.badgeTheme, badgeTheme) || other.badgeTheme == badgeTheme) && - (identical(other.bannerTheme, bannerTheme) || other.bannerTheme == bannerTheme) && - (identical(other.bottomAppBarTheme, bottomAppBarTheme) || other.bottomAppBarTheme == bottomAppBarTheme) && - (identical(other.bottomNavigationBarTheme, bottomNavigationBarTheme) || other.bottomNavigationBarTheme == bottomNavigationBarTheme) && - (identical(other.bottomSheetTheme, bottomSheetTheme) || other.bottomSheetTheme == bottomSheetTheme) && - (identical(other.buttonTheme, buttonTheme) || other.buttonTheme == buttonTheme) && - (identical(other.cardTheme, cardTheme) || other.cardTheme == cardTheme) && - (identical(other.checkboxTheme, checkboxTheme) || other.checkboxTheme == checkboxTheme) && - (identical(other.chipTheme, chipTheme) || other.chipTheme == chipTheme) && - (identical(other.datePickerTheme, datePickerTheme) || other.datePickerTheme == datePickerTheme) && - (identical(other.dialogTheme, dialogTheme) || other.dialogTheme == dialogTheme) && - (identical(other.dividerTheme, dividerTheme) || other.dividerTheme == dividerTheme) && - (identical(other.drawerTheme, drawerTheme) || other.drawerTheme == drawerTheme) && - (identical(other.elevatedButtonTheme, elevatedButtonTheme) || other.elevatedButtonTheme == elevatedButtonTheme) && - (identical(other.filledButtonTheme, filledButtonTheme) || other.filledButtonTheme == filledButtonTheme) && - (identical(other.floatingActionButtonTheme, floatingActionButtonTheme) || other.floatingActionButtonTheme == floatingActionButtonTheme) && - (identical(other.iconButtonTheme, iconButtonTheme) || other.iconButtonTheme == iconButtonTheme) && - (identical(other.listTileTheme, listTileTheme) || other.listTileTheme == listTileTheme) && - (identical(other.menuButtonTheme, menuButtonTheme) || other.menuButtonTheme == menuButtonTheme) && - (identical(other.navigationBarTheme, navigationBarTheme) || other.navigationBarTheme == navigationBarTheme) && - (identical(other.navigationDrawerTheme, navigationDrawerTheme) || other.navigationDrawerTheme == navigationDrawerTheme) && - (identical(other.outlinedButtonTheme, outlinedButtonTheme) || other.outlinedButtonTheme == outlinedButtonTheme) && - (identical(other.segmentedButtonTheme, segmentedButtonTheme) || other.segmentedButtonTheme == segmentedButtonTheme) && - (identical(other.snackBarTheme, snackBarTheme) || other.snackBarTheme == snackBarTheme) && - (identical(other.tabBarTheme, tabBarTheme) || other.tabBarTheme == tabBarTheme) && - (identical(other.textButtonTheme, textButtonTheme) || other.textButtonTheme == textButtonTheme)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - applyElevationOverlayColor, - inputDecorationTheme, - materialTapTargetSize, - platform, - scrollbarTheme, - useMaterial3, - colorScheme, - brightness, - colorSchemeSeed, - canvasColor, - cardColor, - disabledColor, - dividerColor, - focusColor, - highlightColor, - hintColor, - hoverColor, - primaryColor, - primaryColorDark, - primaryColorLight, - primarySwatch, - scaffoldBackgroundColor, - secondaryHeaderColor, - shadowColor, - splashColor, - unselectedWidgetColor, - fontFamily, - const DeepCollectionEquality().hash(_fontFamilyFallback), - package, - iconTheme, - primaryIconTheme, - primaryTextTheme, - textTheme, - appBarTheme, - badgeTheme, - bannerTheme, - bottomAppBarTheme, - bottomNavigationBarTheme, - bottomSheetTheme, - buttonTheme, - cardTheme, - checkboxTheme, - chipTheme, - datePickerTheme, - dialogTheme, - dividerTheme, - drawerTheme, - elevatedButtonTheme, - filledButtonTheme, - floatingActionButtonTheme, - iconButtonTheme, - listTileTheme, - menuButtonTheme, - navigationBarTheme, - navigationDrawerTheme, - outlinedButtonTheme, - segmentedButtonTheme, - snackBarTheme, - tabBarTheme, - textButtonTheme - ]); - - @override - String toString() { - return 'StacTheme(applyElevationOverlayColor: $applyElevationOverlayColor, inputDecorationTheme: $inputDecorationTheme, materialTapTargetSize: $materialTapTargetSize, platform: $platform, scrollbarTheme: $scrollbarTheme, useMaterial3: $useMaterial3, colorScheme: $colorScheme, brightness: $brightness, colorSchemeSeed: $colorSchemeSeed, canvasColor: $canvasColor, cardColor: $cardColor, disabledColor: $disabledColor, dividerColor: $dividerColor, focusColor: $focusColor, highlightColor: $highlightColor, hintColor: $hintColor, hoverColor: $hoverColor, primaryColor: $primaryColor, primaryColorDark: $primaryColorDark, primaryColorLight: $primaryColorLight, primarySwatch: $primarySwatch, scaffoldBackgroundColor: $scaffoldBackgroundColor, secondaryHeaderColor: $secondaryHeaderColor, shadowColor: $shadowColor, splashColor: $splashColor, unselectedWidgetColor: $unselectedWidgetColor, fontFamily: $fontFamily, fontFamilyFallback: $fontFamilyFallback, package: $package, iconTheme: $iconTheme, primaryIconTheme: $primaryIconTheme, primaryTextTheme: $primaryTextTheme, textTheme: $textTheme, appBarTheme: $appBarTheme, badgeTheme: $badgeTheme, bannerTheme: $bannerTheme, bottomAppBarTheme: $bottomAppBarTheme, bottomNavigationBarTheme: $bottomNavigationBarTheme, bottomSheetTheme: $bottomSheetTheme, buttonTheme: $buttonTheme, cardTheme: $cardTheme, checkboxTheme: $checkboxTheme, chipTheme: $chipTheme, datePickerTheme: $datePickerTheme, dialogTheme: $dialogTheme, dividerTheme: $dividerTheme, drawerTheme: $drawerTheme, elevatedButtonTheme: $elevatedButtonTheme, filledButtonTheme: $filledButtonTheme, floatingActionButtonTheme: $floatingActionButtonTheme, iconButtonTheme: $iconButtonTheme, listTileTheme: $listTileTheme, menuButtonTheme: $menuButtonTheme, navigationBarTheme: $navigationBarTheme, navigationDrawerTheme: $navigationDrawerTheme, outlinedButtonTheme: $outlinedButtonTheme, segmentedButtonTheme: $segmentedButtonTheme, snackBarTheme: $snackBarTheme, tabBarTheme: $tabBarTheme, textButtonTheme: $textButtonTheme)'; - } -} - -/// @nodoc -abstract mixin class _$StacThemeCopyWith<$Res> - implements $StacThemeCopyWith<$Res> { - factory _$StacThemeCopyWith( - _StacTheme value, $Res Function(_StacTheme) _then) = - __$StacThemeCopyWithImpl; - @override - @useResult - $Res call( - {bool? applyElevationOverlayColor, - StacInputDecorationTheme? inputDecorationTheme, - MaterialTapTargetSize? materialTapTargetSize, - TargetPlatform? platform, - StacScrollbarThemeData? scrollbarTheme, - bool? useMaterial3, - StacColorScheme? colorScheme, - Brightness? brightness, - String? colorSchemeSeed, - String? canvasColor, - String? cardColor, - String? disabledColor, - String? dividerColor, - String? focusColor, - String? highlightColor, - String? hintColor, - String? hoverColor, - String? primaryColor, - String? primaryColorDark, - String? primaryColorLight, - StacMaterialColor? primarySwatch, - String? scaffoldBackgroundColor, - String? secondaryHeaderColor, - String? shadowColor, - String? splashColor, - String? unselectedWidgetColor, - String? fontFamily, - List? fontFamilyFallback, - String? package, - StacIconThemeData? iconTheme, - StacIconThemeData? primaryIconTheme, - StacTextTheme? primaryTextTheme, - StacTextTheme? textTheme, - StacAppBarTheme? appBarTheme, - StacBadgeThemeData? badgeTheme, - StacMaterialBannerThemeData? bannerTheme, - StacBottomAppBarTheme? bottomAppBarTheme, - StacBottomNavBarThemeData? bottomNavigationBarTheme, - StacBottomSheetThemeData? bottomSheetTheme, - StacButtonThemeData? buttonTheme, - StacCardThemeData? cardTheme, - StacCheckboxThemeData? checkboxTheme, - StacChipThemeData? chipTheme, - StacDatePickerThemeData? datePickerTheme, - StacDialogTheme? dialogTheme, - StacDividerThemeData? dividerTheme, - StacDrawerThemeData? drawerTheme, - StacButtonStyle? elevatedButtonTheme, - StacButtonStyle? filledButtonTheme, - StacFloatingActionButtonThemeData? floatingActionButtonTheme, - StacButtonStyle? iconButtonTheme, - StacListTileThemeData? listTileTheme, - StacButtonStyle? menuButtonTheme, - StacNavigationBarThemeData? navigationBarTheme, - StacNavigationDrawerThemeData? navigationDrawerTheme, - StacButtonStyle? outlinedButtonTheme, - StacButtonStyle? segmentedButtonTheme, - StacSnackBarThemeData? snackBarTheme, - StacTabBarThemeData? tabBarTheme, - StacButtonStyle? textButtonTheme}); - - @override - $StacScrollbarThemeDataCopyWith<$Res>? get scrollbarTheme; - @override - $StacColorSchemeCopyWith<$Res>? get colorScheme; - @override - $StacMaterialColorCopyWith<$Res>? get primarySwatch; - @override - $StacIconThemeDataCopyWith<$Res>? get iconTheme; - @override - $StacIconThemeDataCopyWith<$Res>? get primaryIconTheme; - @override - $StacTextThemeCopyWith<$Res>? get primaryTextTheme; - @override - $StacTextThemeCopyWith<$Res>? get textTheme; - @override - $StacAppBarThemeCopyWith<$Res>? get appBarTheme; - @override - $StacBadgeThemeDataCopyWith<$Res>? get badgeTheme; - @override - $StacMaterialBannerThemeDataCopyWith<$Res>? get bannerTheme; - @override - $StacBottomAppBarThemeCopyWith<$Res>? get bottomAppBarTheme; - @override - $StacBottomNavBarThemeDataCopyWith<$Res>? get bottomNavigationBarTheme; - @override - $StacBottomSheetThemeDataCopyWith<$Res>? get bottomSheetTheme; - @override - $StacButtonThemeDataCopyWith<$Res>? get buttonTheme; - @override - $StacCardThemeDataCopyWith<$Res>? get cardTheme; - @override - $StacCheckboxThemeDataCopyWith<$Res>? get checkboxTheme; - @override - $StacChipThemeDataCopyWith<$Res>? get chipTheme; - @override - $StacDatePickerThemeDataCopyWith<$Res>? get datePickerTheme; - @override - $StacDialogThemeCopyWith<$Res>? get dialogTheme; - @override - $StacDividerThemeDataCopyWith<$Res>? get dividerTheme; - @override - $StacDrawerThemeDataCopyWith<$Res>? get drawerTheme; - @override - $StacFloatingActionButtonThemeDataCopyWith<$Res>? - get floatingActionButtonTheme; - @override - $StacListTileThemeDataCopyWith<$Res>? get listTileTheme; - @override - $StacNavigationBarThemeDataCopyWith<$Res>? get navigationBarTheme; - @override - $StacNavigationDrawerThemeDataCopyWith<$Res>? get navigationDrawerTheme; - @override - $StacSnackBarThemeDataCopyWith<$Res>? get snackBarTheme; - @override - $StacTabBarThemeDataCopyWith<$Res>? get tabBarTheme; -} - -/// @nodoc -class __$StacThemeCopyWithImpl<$Res> implements _$StacThemeCopyWith<$Res> { - __$StacThemeCopyWithImpl(this._self, this._then); - - final _StacTheme _self; - final $Res Function(_StacTheme) _then; - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? applyElevationOverlayColor = freezed, - Object? inputDecorationTheme = freezed, - Object? materialTapTargetSize = freezed, - Object? platform = freezed, - Object? scrollbarTheme = freezed, - Object? useMaterial3 = freezed, - Object? colorScheme = freezed, - Object? brightness = freezed, - Object? colorSchemeSeed = freezed, - Object? canvasColor = freezed, - Object? cardColor = freezed, - Object? disabledColor = freezed, - Object? dividerColor = freezed, - Object? focusColor = freezed, - Object? highlightColor = freezed, - Object? hintColor = freezed, - Object? hoverColor = freezed, - Object? primaryColor = freezed, - Object? primaryColorDark = freezed, - Object? primaryColorLight = freezed, - Object? primarySwatch = freezed, - Object? scaffoldBackgroundColor = freezed, - Object? secondaryHeaderColor = freezed, - Object? shadowColor = freezed, - Object? splashColor = freezed, - Object? unselectedWidgetColor = freezed, - Object? fontFamily = freezed, - Object? fontFamilyFallback = freezed, - Object? package = freezed, - Object? iconTheme = freezed, - Object? primaryIconTheme = freezed, - Object? primaryTextTheme = freezed, - Object? textTheme = freezed, - Object? appBarTheme = freezed, - Object? badgeTheme = freezed, - Object? bannerTheme = freezed, - Object? bottomAppBarTheme = freezed, - Object? bottomNavigationBarTheme = freezed, - Object? bottomSheetTheme = freezed, - Object? buttonTheme = freezed, - Object? cardTheme = freezed, - Object? checkboxTheme = freezed, - Object? chipTheme = freezed, - Object? datePickerTheme = freezed, - Object? dialogTheme = freezed, - Object? dividerTheme = freezed, - Object? drawerTheme = freezed, - Object? elevatedButtonTheme = freezed, - Object? filledButtonTheme = freezed, - Object? floatingActionButtonTheme = freezed, - Object? iconButtonTheme = freezed, - Object? listTileTheme = freezed, - Object? menuButtonTheme = freezed, - Object? navigationBarTheme = freezed, - Object? navigationDrawerTheme = freezed, - Object? outlinedButtonTheme = freezed, - Object? segmentedButtonTheme = freezed, - Object? snackBarTheme = freezed, - Object? tabBarTheme = freezed, - Object? textButtonTheme = freezed, - }) { - return _then(_StacTheme( - applyElevationOverlayColor: freezed == applyElevationOverlayColor - ? _self.applyElevationOverlayColor - : applyElevationOverlayColor // ignore: cast_nullable_to_non_nullable - as bool?, - inputDecorationTheme: freezed == inputDecorationTheme - ? _self.inputDecorationTheme - : inputDecorationTheme // ignore: cast_nullable_to_non_nullable - as StacInputDecorationTheme?, - materialTapTargetSize: freezed == materialTapTargetSize - ? _self.materialTapTargetSize - : materialTapTargetSize // ignore: cast_nullable_to_non_nullable - as MaterialTapTargetSize?, - platform: freezed == platform - ? _self.platform - : platform // ignore: cast_nullable_to_non_nullable - as TargetPlatform?, - scrollbarTheme: freezed == scrollbarTheme - ? _self.scrollbarTheme - : scrollbarTheme // ignore: cast_nullable_to_non_nullable - as StacScrollbarThemeData?, - useMaterial3: freezed == useMaterial3 - ? _self.useMaterial3 - : useMaterial3 // ignore: cast_nullable_to_non_nullable - as bool?, - colorScheme: freezed == colorScheme - ? _self.colorScheme - : colorScheme // ignore: cast_nullable_to_non_nullable - as StacColorScheme?, - brightness: freezed == brightness - ? _self.brightness - : brightness // ignore: cast_nullable_to_non_nullable - as Brightness?, - colorSchemeSeed: freezed == colorSchemeSeed - ? _self.colorSchemeSeed - : colorSchemeSeed // ignore: cast_nullable_to_non_nullable - as String?, - canvasColor: freezed == canvasColor - ? _self.canvasColor - : canvasColor // ignore: cast_nullable_to_non_nullable - as String?, - cardColor: freezed == cardColor - ? _self.cardColor - : cardColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledColor: freezed == disabledColor - ? _self.disabledColor - : disabledColor // ignore: cast_nullable_to_non_nullable - as String?, - dividerColor: freezed == dividerColor - ? _self.dividerColor - : dividerColor // ignore: cast_nullable_to_non_nullable - as String?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - highlightColor: freezed == highlightColor - ? _self.highlightColor - : highlightColor // ignore: cast_nullable_to_non_nullable - as String?, - hintColor: freezed == hintColor - ? _self.hintColor - : hintColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - primaryColor: freezed == primaryColor - ? _self.primaryColor - : primaryColor // ignore: cast_nullable_to_non_nullable - as String?, - primaryColorDark: freezed == primaryColorDark - ? _self.primaryColorDark - : primaryColorDark // ignore: cast_nullable_to_non_nullable - as String?, - primaryColorLight: freezed == primaryColorLight - ? _self.primaryColorLight - : primaryColorLight // ignore: cast_nullable_to_non_nullable - as String?, - primarySwatch: freezed == primarySwatch - ? _self.primarySwatch - : primarySwatch // ignore: cast_nullable_to_non_nullable - as StacMaterialColor?, - scaffoldBackgroundColor: freezed == scaffoldBackgroundColor - ? _self.scaffoldBackgroundColor - : scaffoldBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - secondaryHeaderColor: freezed == secondaryHeaderColor - ? _self.secondaryHeaderColor - : secondaryHeaderColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - unselectedWidgetColor: freezed == unselectedWidgetColor - ? _self.unselectedWidgetColor - : unselectedWidgetColor // ignore: cast_nullable_to_non_nullable - as String?, - fontFamily: freezed == fontFamily - ? _self.fontFamily - : fontFamily // ignore: cast_nullable_to_non_nullable - as String?, - fontFamilyFallback: freezed == fontFamilyFallback - ? _self._fontFamilyFallback - : fontFamilyFallback // ignore: cast_nullable_to_non_nullable - as List?, - package: freezed == package - ? _self.package - : package // ignore: cast_nullable_to_non_nullable - as String?, - iconTheme: freezed == iconTheme - ? _self.iconTheme - : iconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - primaryIconTheme: freezed == primaryIconTheme - ? _self.primaryIconTheme - : primaryIconTheme // ignore: cast_nullable_to_non_nullable - as StacIconThemeData?, - primaryTextTheme: freezed == primaryTextTheme - ? _self.primaryTextTheme - : primaryTextTheme // ignore: cast_nullable_to_non_nullable - as StacTextTheme?, - textTheme: freezed == textTheme - ? _self.textTheme - : textTheme // ignore: cast_nullable_to_non_nullable - as StacTextTheme?, - appBarTheme: freezed == appBarTheme - ? _self.appBarTheme - : appBarTheme // ignore: cast_nullable_to_non_nullable - as StacAppBarTheme?, - badgeTheme: freezed == badgeTheme - ? _self.badgeTheme - : badgeTheme // ignore: cast_nullable_to_non_nullable - as StacBadgeThemeData?, - bannerTheme: freezed == bannerTheme - ? _self.bannerTheme - : bannerTheme // ignore: cast_nullable_to_non_nullable - as StacMaterialBannerThemeData?, - bottomAppBarTheme: freezed == bottomAppBarTheme - ? _self.bottomAppBarTheme - : bottomAppBarTheme // ignore: cast_nullable_to_non_nullable - as StacBottomAppBarTheme?, - bottomNavigationBarTheme: freezed == bottomNavigationBarTheme - ? _self.bottomNavigationBarTheme - : bottomNavigationBarTheme // ignore: cast_nullable_to_non_nullable - as StacBottomNavBarThemeData?, - bottomSheetTheme: freezed == bottomSheetTheme - ? _self.bottomSheetTheme - : bottomSheetTheme // ignore: cast_nullable_to_non_nullable - as StacBottomSheetThemeData?, - buttonTheme: freezed == buttonTheme - ? _self.buttonTheme - : buttonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonThemeData?, - cardTheme: freezed == cardTheme - ? _self.cardTheme - : cardTheme // ignore: cast_nullable_to_non_nullable - as StacCardThemeData?, - checkboxTheme: freezed == checkboxTheme - ? _self.checkboxTheme - : checkboxTheme // ignore: cast_nullable_to_non_nullable - as StacCheckboxThemeData?, - chipTheme: freezed == chipTheme - ? _self.chipTheme - : chipTheme // ignore: cast_nullable_to_non_nullable - as StacChipThemeData?, - datePickerTheme: freezed == datePickerTheme - ? _self.datePickerTheme - : datePickerTheme // ignore: cast_nullable_to_non_nullable - as StacDatePickerThemeData?, - dialogTheme: freezed == dialogTheme - ? _self.dialogTheme - : dialogTheme // ignore: cast_nullable_to_non_nullable - as StacDialogTheme?, - dividerTheme: freezed == dividerTheme - ? _self.dividerTheme - : dividerTheme // ignore: cast_nullable_to_non_nullable - as StacDividerThemeData?, - drawerTheme: freezed == drawerTheme - ? _self.drawerTheme - : drawerTheme // ignore: cast_nullable_to_non_nullable - as StacDrawerThemeData?, - elevatedButtonTheme: freezed == elevatedButtonTheme - ? _self.elevatedButtonTheme - : elevatedButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - filledButtonTheme: freezed == filledButtonTheme - ? _self.filledButtonTheme - : filledButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - floatingActionButtonTheme: freezed == floatingActionButtonTheme - ? _self.floatingActionButtonTheme - : floatingActionButtonTheme // ignore: cast_nullable_to_non_nullable - as StacFloatingActionButtonThemeData?, - iconButtonTheme: freezed == iconButtonTheme - ? _self.iconButtonTheme - : iconButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - listTileTheme: freezed == listTileTheme - ? _self.listTileTheme - : listTileTheme // ignore: cast_nullable_to_non_nullable - as StacListTileThemeData?, - menuButtonTheme: freezed == menuButtonTheme - ? _self.menuButtonTheme - : menuButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - navigationBarTheme: freezed == navigationBarTheme - ? _self.navigationBarTheme - : navigationBarTheme // ignore: cast_nullable_to_non_nullable - as StacNavigationBarThemeData?, - navigationDrawerTheme: freezed == navigationDrawerTheme - ? _self.navigationDrawerTheme - : navigationDrawerTheme // ignore: cast_nullable_to_non_nullable - as StacNavigationDrawerThemeData?, - outlinedButtonTheme: freezed == outlinedButtonTheme - ? _self.outlinedButtonTheme - : outlinedButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - segmentedButtonTheme: freezed == segmentedButtonTheme - ? _self.segmentedButtonTheme - : segmentedButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - snackBarTheme: freezed == snackBarTheme - ? _self.snackBarTheme - : snackBarTheme // ignore: cast_nullable_to_non_nullable - as StacSnackBarThemeData?, - tabBarTheme: freezed == tabBarTheme - ? _self.tabBarTheme - : tabBarTheme // ignore: cast_nullable_to_non_nullable - as StacTabBarThemeData?, - textButtonTheme: freezed == textButtonTheme - ? _self.textButtonTheme - : textButtonTheme // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - )); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacScrollbarThemeDataCopyWith<$Res>? get scrollbarTheme { - if (_self.scrollbarTheme == null) { - return null; - } - - return $StacScrollbarThemeDataCopyWith<$Res>(_self.scrollbarTheme!, - (value) { - return _then(_self.copyWith(scrollbarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacColorSchemeCopyWith<$Res>? get colorScheme { - if (_self.colorScheme == null) { - return null; - } - - return $StacColorSchemeCopyWith<$Res>(_self.colorScheme!, (value) { - return _then(_self.copyWith(colorScheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacMaterialColorCopyWith<$Res>? get primarySwatch { - if (_self.primarySwatch == null) { - return null; - } - - return $StacMaterialColorCopyWith<$Res>(_self.primarySwatch!, (value) { - return _then(_self.copyWith(primarySwatch: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get iconTheme { - if (_self.iconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.iconTheme!, (value) { - return _then(_self.copyWith(iconTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacIconThemeDataCopyWith<$Res>? get primaryIconTheme { - if (_self.primaryIconTheme == null) { - return null; - } - - return $StacIconThemeDataCopyWith<$Res>(_self.primaryIconTheme!, (value) { - return _then(_self.copyWith(primaryIconTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacTextThemeCopyWith<$Res>? get primaryTextTheme { - if (_self.primaryTextTheme == null) { - return null; - } - - return $StacTextThemeCopyWith<$Res>(_self.primaryTextTheme!, (value) { - return _then(_self.copyWith(primaryTextTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacTextThemeCopyWith<$Res>? get textTheme { - if (_self.textTheme == null) { - return null; - } - - return $StacTextThemeCopyWith<$Res>(_self.textTheme!, (value) { - return _then(_self.copyWith(textTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacAppBarThemeCopyWith<$Res>? get appBarTheme { - if (_self.appBarTheme == null) { - return null; - } - - return $StacAppBarThemeCopyWith<$Res>(_self.appBarTheme!, (value) { - return _then(_self.copyWith(appBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacBadgeThemeDataCopyWith<$Res>? get badgeTheme { - if (_self.badgeTheme == null) { - return null; - } - - return $StacBadgeThemeDataCopyWith<$Res>(_self.badgeTheme!, (value) { - return _then(_self.copyWith(badgeTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacMaterialBannerThemeDataCopyWith<$Res>? get bannerTheme { - if (_self.bannerTheme == null) { - return null; - } - - return $StacMaterialBannerThemeDataCopyWith<$Res>(_self.bannerTheme!, - (value) { - return _then(_self.copyWith(bannerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacBottomAppBarThemeCopyWith<$Res>? get bottomAppBarTheme { - if (_self.bottomAppBarTheme == null) { - return null; - } - - return $StacBottomAppBarThemeCopyWith<$Res>(_self.bottomAppBarTheme!, - (value) { - return _then(_self.copyWith(bottomAppBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacBottomNavBarThemeDataCopyWith<$Res>? get bottomNavigationBarTheme { - if (_self.bottomNavigationBarTheme == null) { - return null; - } - - return $StacBottomNavBarThemeDataCopyWith<$Res>( - _self.bottomNavigationBarTheme!, (value) { - return _then(_self.copyWith(bottomNavigationBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacBottomSheetThemeDataCopyWith<$Res>? get bottomSheetTheme { - if (_self.bottomSheetTheme == null) { - return null; - } - - return $StacBottomSheetThemeDataCopyWith<$Res>(_self.bottomSheetTheme!, - (value) { - return _then(_self.copyWith(bottomSheetTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonThemeDataCopyWith<$Res>? get buttonTheme { - if (_self.buttonTheme == null) { - return null; - } - - return $StacButtonThemeDataCopyWith<$Res>(_self.buttonTheme!, (value) { - return _then(_self.copyWith(buttonTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacCardThemeDataCopyWith<$Res>? get cardTheme { - if (_self.cardTheme == null) { - return null; - } - - return $StacCardThemeDataCopyWith<$Res>(_self.cardTheme!, (value) { - return _then(_self.copyWith(cardTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacCheckboxThemeDataCopyWith<$Res>? get checkboxTheme { - if (_self.checkboxTheme == null) { - return null; - } - - return $StacCheckboxThemeDataCopyWith<$Res>(_self.checkboxTheme!, (value) { - return _then(_self.copyWith(checkboxTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacChipThemeDataCopyWith<$Res>? get chipTheme { - if (_self.chipTheme == null) { - return null; - } - - return $StacChipThemeDataCopyWith<$Res>(_self.chipTheme!, (value) { - return _then(_self.copyWith(chipTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacDatePickerThemeDataCopyWith<$Res>? get datePickerTheme { - if (_self.datePickerTheme == null) { - return null; - } - - return $StacDatePickerThemeDataCopyWith<$Res>(_self.datePickerTheme!, - (value) { - return _then(_self.copyWith(datePickerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacDialogThemeCopyWith<$Res>? get dialogTheme { - if (_self.dialogTheme == null) { - return null; - } - - return $StacDialogThemeCopyWith<$Res>(_self.dialogTheme!, (value) { - return _then(_self.copyWith(dialogTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacDividerThemeDataCopyWith<$Res>? get dividerTheme { - if (_self.dividerTheme == null) { - return null; - } - - return $StacDividerThemeDataCopyWith<$Res>(_self.dividerTheme!, (value) { - return _then(_self.copyWith(dividerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacDrawerThemeDataCopyWith<$Res>? get drawerTheme { - if (_self.drawerTheme == null) { - return null; - } - - return $StacDrawerThemeDataCopyWith<$Res>(_self.drawerTheme!, (value) { - return _then(_self.copyWith(drawerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacFloatingActionButtonThemeDataCopyWith<$Res>? - get floatingActionButtonTheme { - if (_self.floatingActionButtonTheme == null) { - return null; - } - - return $StacFloatingActionButtonThemeDataCopyWith<$Res>( - _self.floatingActionButtonTheme!, (value) { - return _then(_self.copyWith(floatingActionButtonTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacListTileThemeDataCopyWith<$Res>? get listTileTheme { - if (_self.listTileTheme == null) { - return null; - } - - return $StacListTileThemeDataCopyWith<$Res>(_self.listTileTheme!, (value) { - return _then(_self.copyWith(listTileTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacNavigationBarThemeDataCopyWith<$Res>? get navigationBarTheme { - if (_self.navigationBarTheme == null) { - return null; - } - - return $StacNavigationBarThemeDataCopyWith<$Res>(_self.navigationBarTheme!, - (value) { - return _then(_self.copyWith(navigationBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacNavigationDrawerThemeDataCopyWith<$Res>? get navigationDrawerTheme { - if (_self.navigationDrawerTheme == null) { - return null; - } - - return $StacNavigationDrawerThemeDataCopyWith<$Res>( - _self.navigationDrawerTheme!, (value) { - return _then(_self.copyWith(navigationDrawerTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSnackBarThemeDataCopyWith<$Res>? get snackBarTheme { - if (_self.snackBarTheme == null) { - return null; - } - - return $StacSnackBarThemeDataCopyWith<$Res>(_self.snackBarTheme!, (value) { - return _then(_self.copyWith(snackBarTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacTabBarThemeDataCopyWith<$Res>? get tabBarTheme { - if (_self.tabBarTheme == null) { - return null; - } - - return $StacTabBarThemeDataCopyWith<$Res>(_self.tabBarTheme!, (value) { - return _then(_self.copyWith(tabBarTheme: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.g.dart b/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.g.dart deleted file mode 100644 index 57d355055..000000000 --- a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.g.dart +++ /dev/null @@ -1,261 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_theme.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacTheme _$StacThemeFromJson(Map json) => _StacTheme( - applyElevationOverlayColor: json['applyElevationOverlayColor'] as bool?, - inputDecorationTheme: json['inputDecorationTheme'] == null - ? null - : StacInputDecorationTheme.fromJson( - json['inputDecorationTheme'] as Map), - materialTapTargetSize: $enumDecodeNullable( - _$MaterialTapTargetSizeEnumMap, json['materialTapTargetSize']), - platform: $enumDecodeNullable(_$TargetPlatformEnumMap, json['platform']), - scrollbarTheme: json['scrollbarTheme'] == null - ? null - : StacScrollbarThemeData.fromJson( - json['scrollbarTheme'] as Map), - useMaterial3: json['useMaterial3'] as bool?, - colorScheme: json['colorScheme'] == null - ? null - : StacColorScheme.fromJson( - json['colorScheme'] as Map), - brightness: $enumDecodeNullable(_$BrightnessEnumMap, json['brightness']), - colorSchemeSeed: json['colorSchemeSeed'] as String?, - canvasColor: json['canvasColor'] as String?, - cardColor: json['cardColor'] as String?, - disabledColor: json['disabledColor'] as String?, - dividerColor: json['dividerColor'] as String?, - focusColor: json['focusColor'] as String?, - highlightColor: json['highlightColor'] as String?, - hintColor: json['hintColor'] as String?, - hoverColor: json['hoverColor'] as String?, - primaryColor: json['primaryColor'] as String?, - primaryColorDark: json['primaryColorDark'] as String?, - primaryColorLight: json['primaryColorLight'] as String?, - primarySwatch: json['primarySwatch'] == null - ? null - : StacMaterialColor.fromJson( - json['primarySwatch'] as Map), - scaffoldBackgroundColor: json['scaffoldBackgroundColor'] as String?, - secondaryHeaderColor: json['secondaryHeaderColor'] as String?, - shadowColor: json['shadowColor'] as String?, - splashColor: json['splashColor'] as String?, - unselectedWidgetColor: json['unselectedWidgetColor'] as String?, - fontFamily: json['fontFamily'] as String?, - fontFamilyFallback: (json['fontFamilyFallback'] as List?) - ?.map((e) => e as String) - .toList(), - package: json['package'] as String?, - iconTheme: json['iconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['iconTheme'] as Map), - primaryIconTheme: json['primaryIconTheme'] == null - ? null - : StacIconThemeData.fromJson( - json['primaryIconTheme'] as Map), - primaryTextTheme: json['primaryTextTheme'] == null - ? null - : StacTextTheme.fromJson( - json['primaryTextTheme'] as Map), - textTheme: json['textTheme'] == null - ? null - : StacTextTheme.fromJson(json['textTheme'] as Map), - appBarTheme: json['appBarTheme'] == null - ? null - : StacAppBarTheme.fromJson( - json['appBarTheme'] as Map), - badgeTheme: json['badgeTheme'] == null - ? null - : StacBadgeThemeData.fromJson( - json['badgeTheme'] as Map), - bannerTheme: json['bannerTheme'] == null - ? null - : StacMaterialBannerThemeData.fromJson( - json['bannerTheme'] as Map), - bottomAppBarTheme: json['bottomAppBarTheme'] == null - ? null - : StacBottomAppBarTheme.fromJson( - json['bottomAppBarTheme'] as Map), - bottomNavigationBarTheme: json['bottomNavigationBarTheme'] == null - ? null - : StacBottomNavBarThemeData.fromJson( - json['bottomNavigationBarTheme'] as Map), - bottomSheetTheme: json['bottomSheetTheme'] == null - ? null - : StacBottomSheetThemeData.fromJson( - json['bottomSheetTheme'] as Map), - buttonTheme: json['buttonTheme'] == null - ? null - : StacButtonThemeData.fromJson( - json['buttonTheme'] as Map), - cardTheme: json['cardTheme'] == null - ? null - : StacCardThemeData.fromJson( - json['cardTheme'] as Map), - checkboxTheme: json['checkboxTheme'] == null - ? null - : StacCheckboxThemeData.fromJson( - json['checkboxTheme'] as Map), - chipTheme: json['chipTheme'] == null - ? null - : StacChipThemeData.fromJson( - json['chipTheme'] as Map), - datePickerTheme: json['datePickerTheme'] == null - ? null - : StacDatePickerThemeData.fromJson( - json['datePickerTheme'] as Map), - dialogTheme: json['dialogTheme'] == null - ? null - : StacDialogTheme.fromJson( - json['dialogTheme'] as Map), - dividerTheme: json['dividerTheme'] == null - ? null - : StacDividerThemeData.fromJson( - json['dividerTheme'] as Map), - drawerTheme: json['drawerTheme'] == null - ? null - : StacDrawerThemeData.fromJson( - json['drawerTheme'] as Map), - elevatedButtonTheme: json['elevatedButtonTheme'] == null - ? null - : StacButtonStyle.fromJson( - json['elevatedButtonTheme'] as Map), - filledButtonTheme: json['filledButtonTheme'] == null - ? null - : StacButtonStyle.fromJson( - json['filledButtonTheme'] as Map), - floatingActionButtonTheme: json['floatingActionButtonTheme'] == null - ? null - : StacFloatingActionButtonThemeData.fromJson( - json['floatingActionButtonTheme'] as Map), - iconButtonTheme: json['iconButtonTheme'] == null - ? null - : StacButtonStyle.fromJson( - json['iconButtonTheme'] as Map), - listTileTheme: json['listTileTheme'] == null - ? null - : StacListTileThemeData.fromJson( - json['listTileTheme'] as Map), - menuButtonTheme: json['menuButtonTheme'] == null - ? null - : StacButtonStyle.fromJson( - json['menuButtonTheme'] as Map), - navigationBarTheme: json['navigationBarTheme'] == null - ? null - : StacNavigationBarThemeData.fromJson( - json['navigationBarTheme'] as Map), - navigationDrawerTheme: json['navigationDrawerTheme'] == null - ? null - : StacNavigationDrawerThemeData.fromJson( - json['navigationDrawerTheme'] as Map), - outlinedButtonTheme: json['outlinedButtonTheme'] == null - ? null - : StacButtonStyle.fromJson( - json['outlinedButtonTheme'] as Map), - segmentedButtonTheme: json['segmentedButtonTheme'] == null - ? null - : StacButtonStyle.fromJson( - json['segmentedButtonTheme'] as Map), - snackBarTheme: json['snackBarTheme'] == null - ? null - : StacSnackBarThemeData.fromJson( - json['snackBarTheme'] as Map), - tabBarTheme: json['tabBarTheme'] == null - ? null - : StacTabBarThemeData.fromJson( - json['tabBarTheme'] as Map), - textButtonTheme: json['textButtonTheme'] == null - ? null - : StacButtonStyle.fromJson( - json['textButtonTheme'] as Map), - ); - -Map _$StacThemeToJson(_StacTheme instance) => - { - 'applyElevationOverlayColor': instance.applyElevationOverlayColor, - 'inputDecorationTheme': instance.inputDecorationTheme, - 'materialTapTargetSize': - _$MaterialTapTargetSizeEnumMap[instance.materialTapTargetSize], - 'platform': _$TargetPlatformEnumMap[instance.platform], - 'scrollbarTheme': instance.scrollbarTheme, - 'useMaterial3': instance.useMaterial3, - 'colorScheme': instance.colorScheme, - 'brightness': _$BrightnessEnumMap[instance.brightness], - 'colorSchemeSeed': instance.colorSchemeSeed, - 'canvasColor': instance.canvasColor, - 'cardColor': instance.cardColor, - 'disabledColor': instance.disabledColor, - 'dividerColor': instance.dividerColor, - 'focusColor': instance.focusColor, - 'highlightColor': instance.highlightColor, - 'hintColor': instance.hintColor, - 'hoverColor': instance.hoverColor, - 'primaryColor': instance.primaryColor, - 'primaryColorDark': instance.primaryColorDark, - 'primaryColorLight': instance.primaryColorLight, - 'primarySwatch': instance.primarySwatch, - 'scaffoldBackgroundColor': instance.scaffoldBackgroundColor, - 'secondaryHeaderColor': instance.secondaryHeaderColor, - 'shadowColor': instance.shadowColor, - 'splashColor': instance.splashColor, - 'unselectedWidgetColor': instance.unselectedWidgetColor, - 'fontFamily': instance.fontFamily, - 'fontFamilyFallback': instance.fontFamilyFallback, - 'package': instance.package, - 'iconTheme': instance.iconTheme, - 'primaryIconTheme': instance.primaryIconTheme, - 'primaryTextTheme': instance.primaryTextTheme, - 'textTheme': instance.textTheme, - 'appBarTheme': instance.appBarTheme, - 'badgeTheme': instance.badgeTheme, - 'bannerTheme': instance.bannerTheme, - 'bottomAppBarTheme': instance.bottomAppBarTheme, - 'bottomNavigationBarTheme': instance.bottomNavigationBarTheme, - 'bottomSheetTheme': instance.bottomSheetTheme, - 'buttonTheme': instance.buttonTheme, - 'cardTheme': instance.cardTheme, - 'checkboxTheme': instance.checkboxTheme, - 'chipTheme': instance.chipTheme, - 'datePickerTheme': instance.datePickerTheme, - 'dialogTheme': instance.dialogTheme, - 'dividerTheme': instance.dividerTheme, - 'drawerTheme': instance.drawerTheme, - 'elevatedButtonTheme': instance.elevatedButtonTheme, - 'filledButtonTheme': instance.filledButtonTheme, - 'floatingActionButtonTheme': instance.floatingActionButtonTheme, - 'iconButtonTheme': instance.iconButtonTheme, - 'listTileTheme': instance.listTileTheme, - 'menuButtonTheme': instance.menuButtonTheme, - 'navigationBarTheme': instance.navigationBarTheme, - 'navigationDrawerTheme': instance.navigationDrawerTheme, - 'outlinedButtonTheme': instance.outlinedButtonTheme, - 'segmentedButtonTheme': instance.segmentedButtonTheme, - 'snackBarTheme': instance.snackBarTheme, - 'tabBarTheme': instance.tabBarTheme, - 'textButtonTheme': instance.textButtonTheme, - }; - -const _$MaterialTapTargetSizeEnumMap = { - MaterialTapTargetSize.padded: 'padded', - MaterialTapTargetSize.shrinkWrap: 'shrinkWrap', -}; - -const _$TargetPlatformEnumMap = { - TargetPlatform.android: 'android', - TargetPlatform.fuchsia: 'fuchsia', - TargetPlatform.iOS: 'iOS', - TargetPlatform.linux: 'linux', - TargetPlatform.macOS: 'macOS', - TargetPlatform.windows: 'windows', -}; - -const _$BrightnessEnumMap = { - Brightness.dark: 'dark', - Brightness.light: 'light', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_theme_parser.dart b/packages/stac/lib/src/parsers/theme/stac_theme_parser.dart new file mode 100644 index 000000000..c075924e5 --- /dev/null +++ b/packages/stac/lib/src/parsers/theme/stac_theme_parser.dart @@ -0,0 +1,131 @@ +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/foundation/colors/stac_brightness_parser.dart'; +import 'package:stac/src/parsers/foundation/layout/stac_material_tap_target_size_parser.dart'; +import 'package:stac/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart'; +import 'package:stac/src/parsers/theme/stac_app_bar_theme_parser.dart'; +import 'package:stac/src/parsers/theme/stac_bottom_app_bar_theme_parser.dart'; +import 'package:stac/src/parsers/theme/stac_bottom_nav_bar_theme_parser.dart'; +import 'package:stac/src/parsers/theme/stac_bottom_sheet_theme_parser.dart'; +import 'package:stac/src/parsers/theme/stac_button_style_parser.dart'; +import 'package:stac/src/parsers/theme/stac_button_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_card_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_checkbox_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_chip_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_color_scheme_parser.dart'; +import 'package:stac/src/parsers/theme/stac_date_picker_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_dialog_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_divider_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_drawer_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_floating_action_button_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_icon_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_list_tile_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_material_banner_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_material_color_parser.dart'; +import 'package:stac/src/parsers/theme/stac_navigation_bar_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_navigation_drawer_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_scrollbar_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_snack_bar_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_tab_bar_theme_data_parser.dart'; +import 'package:stac/src/parsers/theme/stac_text_theme_parser.dart'; +import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; + +/// Parser extension for [StacTheme]. +/// +/// Converts [StacTheme] to Flutter's [ThemeData]. +extension StacThemeParser on StacTheme { + ThemeData? parse(BuildContext context) { + return ThemeData( + // GENERAL CONFIGURATION + applyElevationOverlayColor: applyElevationOverlayColor, + inputDecorationTheme: inputDecorationTheme?.parse(context), + materialTapTargetSize: materialTapTargetSize?.parse, + scrollbarTheme: scrollbarTheme?.parse(context), + useMaterial3: useMaterial3, + // COLOR + colorScheme: colorScheme?.parse(context), + brightness: brightness?.parse, + colorSchemeSeed: colorSchemeSeed?.toColor(context), + canvasColor: canvasColor?.toColor(context), + cardColor: cardColor?.toColor(context), + disabledColor: disabledColor?.toColor(context), + dividerColor: dividerColor?.toColor(context), + focusColor: focusColor?.toColor(context), + highlightColor: highlightColor?.toColor(context), + hintColor: hintColor?.toColor(context), + hoverColor: hoverColor?.toColor(context), + primaryColor: primaryColor?.toColor(context), + primaryColorDark: primaryColorDark?.toColor(context), + primaryColorLight: primaryColorLight?.toColor(context), + primarySwatch: primarySwatch?.parse(context), + scaffoldBackgroundColor: scaffoldBackgroundColor?.toColor(context), + secondaryHeaderColor: secondaryHeaderColor?.toColor(context), + shadowColor: shadowColor?.toColor(context), + splashColor: splashColor?.toColor(context), + unselectedWidgetColor: unselectedWidgetColor?.toColor(context), + // TYPOGRAPHY & ICONOGRAPHY + fontFamily: fontFamily, + fontFamilyFallback: fontFamilyFallback, + package: package, + iconTheme: iconTheme?.parse(context), + primaryIconTheme: primaryIconTheme?.parse(context), + primaryTextTheme: primaryTextTheme?.parse(context), + textTheme: textTheme?.parse(context), + // COMPONENT THEMES + appBarTheme: appBarTheme?.parse(context), + bannerTheme: bannerTheme?.parse(context), + bottomAppBarTheme: bottomAppBarTheme?.parse(context), + bottomNavigationBarTheme: bottomNavigationBarTheme?.parse(context), + bottomSheetTheme: bottomSheetTheme?.parse(context), + buttonTheme: buttonTheme?.parse(context), + cardTheme: cardTheme?.parse(context), + checkboxTheme: checkboxTheme?.parse(context), + chipTheme: chipTheme?.parse(context), + datePickerTheme: datePickerTheme?.parse(context), + dialogTheme: dialogTheme?.parse(context), + dividerTheme: dividerTheme?.parse(context), + drawerTheme: drawerTheme?.parse(context), + // DropdownMenuThemeData? dropdownMenuTheme, + elevatedButtonTheme: ElevatedButtonThemeData( + style: elevatedButtonTheme?.parseElevatedButton(context), + ), + // ExpansionTileThemeData? expansionTileTheme, + filledButtonTheme: FilledButtonThemeData( + style: filledButtonTheme?.parseFilledButton(context), + ), + floatingActionButtonTheme: floatingActionButtonTheme?.parse(context), + iconButtonTheme: IconButtonThemeData( + style: iconButtonTheme?.parseIconButton(context), + ), + listTileTheme: listTileTheme?.parse(context), + // MenuBarThemeData? menuBarTheme, + menuButtonTheme: MenuButtonThemeData( + style: menuButtonTheme?.parseElevatedButton(context), + ), + // MenuThemeData? menuTheme, + navigationBarTheme: navigationBarTheme?.parse(context), + navigationDrawerTheme: navigationDrawerTheme?.parse(context), + // NavigationRailThemeData? navigationRailTheme, + outlinedButtonTheme: OutlinedButtonThemeData( + style: outlinedButtonTheme?.parseOutlinedButton(context), + ), + // PopupMenuThemeData? popupMenuTheme, + // ProgressIndicatorThemeData? progressIndicatorTheme, + // RadioThemeData? radioTheme, + // SearchBarThemeData? searchBarTheme, + // SearchViewThemeData? searchViewTheme, + // SegmentedButtonThemeData? segmentedButtonTheme, + // SliderThemeData? sliderTheme, + snackBarTheme: snackBarTheme?.parse(context), + // SwitchThemeData? switchTheme, + tabBarTheme: tabBarTheme?.parse(context), + textButtonTheme: TextButtonThemeData( + style: textButtonTheme?.parseTextButton(context), + ), + // TextSelectionThemeData? textSelectionTheme, + // TimePickerThemeData? timePickerTheme, + // ToggleButtonsThemeData? toggleButtonsTheme, + // TooltipThemeData? tooltipTheme, + ); + } +} diff --git a/packages/stac/lib/src/parsers/theme/themes.dart b/packages/stac/lib/src/parsers/theme/themes.dart index 8c1f90cf4..7bbdd8d8a 100644 --- a/packages/stac/lib/src/parsers/theme/themes.dart +++ b/packages/stac/lib/src/parsers/theme/themes.dart @@ -1,13 +1,57 @@ -export 'package:stac/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart'; -export 'package:stac/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart'; -export 'package:stac/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart'; -export 'package:stac/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart'; -export 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; -export 'package:stac/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart'; -export 'package:stac/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart'; -export 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; -export 'package:stac/src/parsers/theme/stac_material_color/stac_material_color.dart'; -export 'package:stac/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart'; -export 'package:stac/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart'; -export 'package:stac/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart'; -export 'package:stac/src/parsers/theme/stac_theme/stac_theme.dart'; +// All theme classes migrated to stac_core - export data class from stac_core and parser from stac package +export 'package:stac_core/stac_core.dart' + show + StacAppBarTheme, + StacBottomAppBarThemeData, + StacBottomNavBarThemeData, + StacBottomSheetThemeData, + StacButtonStyle, + StacButtonThemeData, + StacCardThemeData, + StacCheckboxThemeData, + StacChipThemeData, + StacColorScheme, + StacDatePickerThemeData, + StacDialogTheme, + StacDividerThemeData, + StacDrawerThemeData, + StacFloatingActionButtonThemeData, + StacIconThemeData, + StacListTileThemeData, + StacMaterialBannerThemeData, + StacMaterialColor, + StacNavigationBarThemeData, + StacNavigationDrawerThemeData, + StacScrollbarThemeData, + StacSnackBarThemeData, + StacTabBarThemeData, + StacTextTheme, + StacTheme; + +// Export parsers +export 'stac_app_bar_theme_parser.dart'; +export 'stac_bottom_app_bar_theme_parser.dart'; +export 'stac_bottom_nav_bar_theme_parser.dart'; +export 'stac_bottom_sheet_theme_parser.dart'; +export 'stac_button_style_parser.dart'; +export 'stac_button_theme_data_parser.dart'; +export 'stac_card_theme_data_parser.dart'; +export 'stac_checkbox_theme_data_parser.dart'; +export 'stac_chip_theme_data_parser.dart'; +export 'stac_color_scheme_parser.dart'; +export 'stac_date_picker_theme_data_parser.dart'; +export 'stac_dialog_theme_parser.dart'; +export 'stac_divider_theme_data_parser.dart'; +export 'stac_drawer_theme_data_parser.dart'; +export 'stac_floating_action_button_theme_data_parser.dart'; +export 'stac_icon_theme_data_parser.dart'; +export 'stac_list_tile_theme_data_parser.dart'; +export 'stac_material_banner_theme_data_parser.dart'; +export 'stac_material_color_parser.dart'; +export 'stac_navigation_bar_theme_data_parser.dart'; +export 'stac_navigation_drawer_theme_data_parser.dart'; +export 'stac_scrollbar_theme_data_parser.dart'; +export 'stac_snack_bar_theme_data_parser.dart'; +export 'stac_tab_bar_theme_data_parser.dart'; +export 'stac_text_theme_parser.dart'; +export 'stac_theme_parser.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart index 55ee90340..3d12fce0c 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart @@ -47,7 +47,8 @@ class StacAlertDialogParser extends StacParser { shadowColor: model.shadowColor.toColor(context), surfaceTintColor: model.surfaceTintColor.toColor(context), semanticLabel: model.semanticLabel, - insetPadding: model.insetPadding?.parse ?? + insetPadding: + model.insetPadding?.parse ?? const EdgeInsets.fromLTRB(40, 24, 40, 24), clipBehavior: model.clipBehavior?.parse ?? Clip.none, shape: model.shape?.parse(context), diff --git a/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar_parser.dart index 375933e63..63b096a67 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar_parser.dart @@ -36,13 +36,15 @@ class _BottomNavigationBarWidget extends StatelessWidget { return BottomNavigationBar( items: model.items - .map((item) => BottomNavigationBarItem( - icon: item.icon.parse(context)!, - activeIcon: item.activeIcon?.parse(context), - label: item.label, - backgroundColor: item.backgroundColor?.toColor(context), - tooltip: item.tooltip, - )) + .map( + (item) => BottomNavigationBarItem( + icon: item.icon.parse(context)!, + activeIcon: item.activeIcon?.parse(context), + label: item.label, + backgroundColor: item.backgroundColor?.toColor(context), + tooltip: item.tooltip, + ), + ) .toList(), onTap: (index) => controller?.index = index, currentIndex: controller?.index ?? 0, diff --git a/packages/stac/lib/src/parsers/widgets/stac_carousel_view/stac_carousel_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_carousel_view/stac_carousel_view_parser.dart index f0c1d4b5b..ff2a6c065 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_carousel_view/stac_carousel_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_carousel_view/stac_carousel_view_parser.dart @@ -27,8 +27,9 @@ class StacCarouselViewParser extends StacParser { padding: model.padding?.parse, backgroundColor: model.backgroundColor.toColor(context), elevation: model.elevation, - overlayColor: - WidgetStateProperty.all(model.overlayColor.toColor(context)), + overlayColor: WidgetStateProperty.all( + model.overlayColor.toColor(context), + ), itemSnapping: model.itemSnapping ?? false, shrinkExtent: model.shrinkExtent ?? 0.0, scrollDirection: model.scrollDirection?.parse ?? Axis.horizontal, @@ -43,8 +44,9 @@ class StacCarouselViewParser extends StacParser { padding: model.padding?.parse, backgroundColor: model.backgroundColor.toColor(context), elevation: model.elevation, - overlayColor: - WidgetStateProperty.all(model.overlayColor.toColor(context)), + overlayColor: WidgetStateProperty.all( + model.overlayColor.toColor(context), + ), itemSnapping: model.itemSnapping ?? false, shrinkExtent: model.shrinkExtent ?? 0.0, scrollDirection: model.scrollDirection?.parse ?? Axis.horizontal, diff --git a/packages/stac/lib/src/parsers/widgets/stac_check_box/stac_check_box_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_check_box/stac_check_box_parser.dart index 37d5509cb..35cdd107f 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_check_box/stac_check_box_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_check_box/stac_check_box_parser.dart @@ -64,17 +64,13 @@ class _StacCheckBoxState extends State<_StacCheckBox> { mouseCursor: widget.model.mouseCursor?.parse, activeColor: widget.model.activeColor?.toColor(context), fillColor: widget.model.fillColor != null - ? WidgetStateProperty.all( - widget.model.fillColor!.toColor(context), - ) + ? WidgetStateProperty.all(widget.model.fillColor!.toColor(context)) : null, checkColor: widget.model.checkColor?.toColor(context), focusColor: widget.model.focusColor?.toColor(context), hoverColor: widget.model.hoverColor?.toColor(context), overlayColor: widget.model.overlayColor != null - ? WidgetStateProperty.all( - widget.model.overlayColor!.toColor(context), - ) + ? WidgetStateProperty.all(widget.model.overlayColor!.toColor(context)) : null, splashRadius: widget.model.splashRadius, materialTapTargetSize: widget.model.materialTapTargetSize?.parse, diff --git a/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart index 1296aeefb..9ce11d7af 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart @@ -21,7 +21,8 @@ class StacCustomScrollViewParser extends StacParser { @override Widget parse(BuildContext context, StacCustomScrollView model) { return CustomScrollView( - slivers: model.slivers + slivers: + model.slivers ?.map((e) => e.parse(context) ?? const SizedBox()) .toList() ?? const [], @@ -35,9 +36,10 @@ class StacCustomScrollViewParser extends StacParser { semanticChildCount: model.semanticChildCount, dragStartBehavior: (model.dragStartBehavior ?? StacDragStartBehavior.start).parse, - keyboardDismissBehavior: (model.keyboardDismissBehavior ?? - StacScrollViewKeyboardDismissBehavior.manual) - .parse, + keyboardDismissBehavior: + (model.keyboardDismissBehavior ?? + StacScrollViewKeyboardDismissBehavior.manual) + .parse, restorationId: model.restorationId, clipBehavior: (model.clipBehavior ?? StacClip.hardEdge).parse, hitTestBehavior: diff --git a/packages/stac/lib/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller_parser.dart index a501bea6e..8e3b46830 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller_parser.dart @@ -25,9 +25,7 @@ class StacDefaultBottomNavigationControllerParser } class _DefaultBottomNavigationControllerWidget extends StatefulWidget { - const _DefaultBottomNavigationControllerWidget({ - required this.model, - }); + const _DefaultBottomNavigationControllerWidget({required this.model}); final StacDefaultBottomNavigationController model; @@ -90,8 +88,8 @@ class BottomNavigationScope extends InheritedWidget { /// /// Returns null if no [BottomNavigationScope] is found in the widget tree. static BottomNavigationScope? of(BuildContext context) { - final BottomNavigationScope? result = - context.dependOnInheritedWidgetOfExactType(); + final BottomNavigationScope? result = context + .dependOnInheritedWidgetOfExactType(); if (result != null) { return result; @@ -117,7 +115,7 @@ class BottomNavigationScope extends InheritedWidget { class BottomNavigationController extends ChangeNotifier { /// Creates a [BottomNavigationController] with the specified properties. BottomNavigationController({this.initialIndex = 0, required this.length}) - : _index = initialIndex; + : _index = initialIndex; /// The initial index when the controller is created. final int initialIndex; diff --git a/packages/stac/lib/src/parsers/widgets/stac_double/stac_double.dart b/packages/stac/lib/src/parsers/widgets/stac_double/stac_double.dart index c2ec04fb1..61a8a1b33 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_double/stac_double.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_double/stac_double.dart @@ -8,8 +8,9 @@ class StacDouble { static const StacDouble maxFinite = StacDouble(double.maxFinite); static const StacDouble minPositive = StacDouble(double.minPositive); static const StacDouble nan = StacDouble(double.nan); - static const StacDouble negativeInfinity = - StacDouble(double.negativeInfinity); + static const StacDouble negativeInfinity = StacDouble( + double.negativeInfinity, + ); factory StacDouble.fromJson(dynamic json) => _fromJson(json); diff --git a/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart index 863aa8566..77b6e2203 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart @@ -54,7 +54,8 @@ class _DropDownMenuWidgetState extends State<_DropDownMenuWidget> { initialSelection: model.initialSelection, focusNode: _focusNode, controller: _controller, - dropdownMenuEntries: model.dropdownMenuEntries + dropdownMenuEntries: + model.dropdownMenuEntries ?.map((e) => e.parse(context)) .whereType() .toList() ?? @@ -80,13 +81,14 @@ class _DropDownMenuWidgetState extends State<_DropDownMenuWidget> { alignmentOffset: model.alignmentOffset?.parse, inputFormatters: (model.inputFormatters ?? const []) .map((StacInputFormatter formatter) { - switch (formatter.type) { - case StacInputFormatterType.allow: - return InputFormatterType.allow.format(formatter.rule ?? ''); - case StacInputFormatterType.deny: - return InputFormatterType.deny.format(formatter.rule ?? ''); - } - }).toList(), + switch (formatter.type) { + case StacInputFormatterType.allow: + return InputFormatterType.allow.format(formatter.rule ?? ''); + case StacInputFormatterType.deny: + return InputFormatterType.deny.format(formatter.rule ?? ''); + } + }) + .toList(), ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart index eeed4c20a..aa72e3dcf 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart @@ -64,8 +64,8 @@ class StacDynamicViewParser extends StacParser { // Prepare data for template based on resultTarget final dataForTemplate = (model.resultTarget?.isNotEmpty ?? false) - ? {model.resultTarget: data} - : data; + ? {model.resultTarget: data} + : data; // Apply the data to the template final renderedTemplate = _applyDataToTemplate( @@ -181,15 +181,17 @@ class StacDynamicViewParser extends StacParser { // Check if the list is empty if (listForIteration is List && listForIteration.isEmpty) { Log.d( - "List for iteration is empty, removing itemTemplate and children"); + "List for iteration is empty, removing itemTemplate and children", + ); resolvedTemplateJson.remove(itemTemplateKey); // Clear children or set to empty list resolvedTemplateJson['children'] = []; return resolvedTemplateJson; } - resolvedTemplateJson - .remove(itemTemplateKey); // Remove from outer template structure + resolvedTemplateJson.remove( + itemTemplateKey, + ); // Remove from outer template structure final processedChildItems = >[]; for (final singleRawItem in listForIteration) { @@ -199,8 +201,10 @@ class StacDynamicViewParser extends StacParser { ? {resultTarget: singleRawItem} : singleRawItem; - final processedChild = - _applyDataToItem(itemTemplateActual, itemSpecificDataContext); + final processedChild = _applyDataToItem( + itemTemplateActual, + itemSpecificDataContext, + ); processedChildItems.add(processedChild); } else { Log.w("Item in list is not a Map, skipping: $singleRawItem"); @@ -211,16 +215,19 @@ class StacDynamicViewParser extends StacParser { resolvedTemplateJson['children'] = []; } if (resolvedTemplateJson['children'] is List) { - (resolvedTemplateJson['children'] as List) - .addAll(processedChildItems); + (resolvedTemplateJson['children'] as List).addAll( + processedChildItems, + ); } else { Log.w( - "Template has 'children' but it's not a List. Overwriting with processed items."); + "Template has 'children' but it's not a List. Overwriting with processed items.", + ); resolvedTemplateJson['children'] = processedChildItems; } } else { Log.d( - "itemTemplate found but no list to iterate in dataContext. Template: $currentTemplate, DataContext: $data"); + "itemTemplate found but no list to iterate in dataContext. Template: $currentTemplate, DataContext: $data", + ); } } @@ -228,12 +235,14 @@ class StacDynamicViewParser extends StacParser { // using the original overall dataContext. if (data is Map) { // Ensure it's Map for _processTemplateRecursively - final Map mapDataContext = - Map.from(data); + final Map mapDataContext = Map.from( + data, + ); _processTemplateRecursively(resolvedTemplateJson, mapDataContext); } else { Log.d( - "Overall dataContext is not a Map, skipping final placeholder processing for the main template structure. DataContext: $data"); + "Overall dataContext is not a Map, skipping final placeholder processing for the main template structure. DataContext: $data", + ); } return resolvedTemplateJson; @@ -277,7 +286,9 @@ class StacDynamicViewParser extends StacParser { if (dataValue != null) { processedValue = processedValue.replaceAll( - placeholder, dataValue.toString()); + placeholder, + dataValue.toString(), + ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart index a42b429e6..31b7324e9 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/foundation/layout/stac_clip_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; +import 'package:stac/src/parsers/theme/themes.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; @@ -28,11 +28,11 @@ class StacElevatedButtonParser extends StacParser { onHover: model.onHover == null ? null : (bool value) => - value == false ? null : model.onHover?.parse(context), + value == false ? null : model.onHover?.parse(context), onFocusChange: model.onFocusChange == null ? null : (bool value) => - value == false ? null : model.onFocusChange?.parse(context), + value == false ? null : model.onFocusChange?.parse(context), style: model.style?.parseElevatedButton(context), autofocus: model.autofocus ?? false, clipBehavior: model.clipBehavior?.parse, diff --git a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart index f1dda5974..b1b8b8f7b 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/foundation/layout/stac_clip_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; +import 'package:stac/src/parsers/theme/themes.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_form/stac_form_scope.dart b/packages/stac/lib/src/parsers/widgets/stac_form/stac_form_scope.dart index 699144646..f997a5fc3 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_form/stac_form_scope.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_form/stac_form_scope.dart @@ -13,14 +13,15 @@ class StacFormScope extends InheritedWidget { final GlobalKey formKey; static StacFormScope? of(BuildContext context) { - final StacFormScope? result = - context.dependOnInheritedWidgetOfExactType(); + final StacFormScope? result = context + .dependOnInheritedWidgetOfExactType(); if (result != null) { return result; } else { Log.e( - "StacFormScope.of() called with a context that does not contain a StacFormScope."); + "StacFormScope.of() called with a context that does not contain a StacFormScope.", + ); return null; } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart index 7978bfce1..521dac453 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart @@ -23,8 +23,9 @@ class StacGestureDetectorParser extends StacParser { onTapDown: model.onTapDown != null ? (_) => model.onTapDown!.parse(context) : null, - onTapUp: - model.onTapUp != null ? (_) => model.onTapUp!.parse(context) : null, + onTapUp: model.onTapUp != null + ? (_) => model.onTapUp!.parse(context) + : null, onTap: model.onTap != null ? () => model.onTap!.parse(context) : null, onTapCancel: model.onTapCancel != null ? () => model.onTapCancel!.parse(context) @@ -94,8 +95,8 @@ class StacGestureDetectorParser extends StacParser { : null, onSecondaryLongPressMoveUpdate: model.onSecondaryLongPressMoveUpdate != null - ? (_) => model.onSecondaryLongPressMoveUpdate!.parse(context) - : null, + ? (_) => model.onSecondaryLongPressMoveUpdate!.parse(context) + : null, onSecondaryLongPressUp: model.onSecondaryLongPressUp != null ? () => model.onSecondaryLongPressUp!.parse(context) : null, @@ -174,8 +175,9 @@ class StacGestureDetectorParser extends StacParser { onPanUpdate: model.onPanUpdate != null ? (_) => model.onPanUpdate!.parse(context) : null, - onPanEnd: - model.onPanEnd != null ? (_) => model.onPanEnd!.parse(context) : null, + onPanEnd: model.onPanEnd != null + ? (_) => model.onPanEnd!.parse(context) + : null, onPanCancel: model.onPanCancel != null ? () => model.onPanCancel!.parse(context) : null, diff --git a/packages/stac/lib/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.dart index 1dcbb6b5a..180f10a5e 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.dart @@ -51,7 +51,8 @@ class StacGridViewParser extends StacParser { semanticChildCount: model.semanticChildCount, dragStartBehavior: model.dragStartBehavior?.parse ?? DragStartBehavior.start, - keyboardDismissBehavior: model.keyboardDismissBehavior?.parse ?? + keyboardDismissBehavior: + model.keyboardDismissBehavior?.parse ?? ScrollViewKeyboardDismissBehavior.manual, restorationId: model.restorationId, clipBehavior: model.clipBehavior?.parse ?? Clip.hardEdge, diff --git a/packages/stac/lib/src/parsers/widgets/stac_hero/stac_hero_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_hero/stac_hero_parser.dart index d28547bd0..c89986147 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_hero/stac_hero_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_hero/stac_hero_parser.dart @@ -18,11 +18,16 @@ class StacHeroParser extends StacParser { return Hero( tag: model.tag, createRectTween: model.createRectTween != null - ? (_, __) => model.createRectTween!.parse(context) + ? (_, _) => model.createRectTween!.parse(context) : null, flightShuttleBuilder: model.flightShuttleBuilder != null - ? (flightContext, animation, flightDirection, fromHeroContext, - toHeroContext) { + ? ( + flightContext, + animation, + flightDirection, + fromHeroContext, + toHeroContext, + ) { final widget = model.flightShuttleBuilder!.parse(flightContext); return widget ?? const SizedBox(); } diff --git a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart index 147f01dcb..0edce3527 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart @@ -5,7 +5,7 @@ import 'package:stac/src/parsers/foundation/alignment/stac_alignment_parser.dart import 'package:stac/src/parsers/foundation/geometry/stac_box_constraints_parser.dart'; import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/foundation/interaction/stac_mouse_cursor_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; +import 'package:stac/src/parsers/theme/themes.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; @@ -39,7 +39,7 @@ class StacIconButtonParser extends StacParser { onHover: model.onHover == null ? null : (bool value) => - Stac.onCallFromJson(model.onHover?.toJson(), context), + Stac.onCallFromJson(model.onHover?.toJson(), context), onLongPress: model.onLongPress == null ? null : () => Stac.onCallFromJson(model.onLongPress?.toJson(), context), diff --git a/packages/stac/lib/src/parsers/widgets/stac_list_view/stac_list_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_list_view/stac_list_view_parser.dart index 07d1b7641..08d6990f0 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_list_view/stac_list_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_list_view/stac_list_view_parser.dart @@ -38,7 +38,8 @@ class StacListViewParser extends StacParser { cacheExtent: model.cacheExtent, dragStartBehavior: model.dragStartBehavior?.parse ?? DragStartBehavior.start, - keyboardDismissBehavior: model.keyboardDismissBehavior?.parse ?? + keyboardDismissBehavior: + model.keyboardDismissBehavior?.parse ?? ScrollViewKeyboardDismissBehavior.manual, restorationId: model.restorationId, clipBehavior: model.clipBehavior?.parse ?? Clip.hardEdge, diff --git a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart index 42d3a6c10..1aeef69e3 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/foundation/layout/stac_clip_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; +import 'package:stac/src/parsers/theme/themes.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; @@ -28,11 +28,11 @@ class StacOutlinedButtonParser extends StacParser { onHover: model.onHover == null ? null : (bool value) => - Stac.onCallFromJson(model.onHover?.toJson(), context), + Stac.onCallFromJson(model.onHover?.toJson(), context), onFocusChange: model.onFocusChange == null ? null : (bool value) => - Stac.onCallFromJson(model.onFocusChange?.toJson(), context), + Stac.onCallFromJson(model.onFocusChange?.toJson(), context), style: model.style?.parseOutlinedButton(context), autofocus: model.autofocus ?? false, clipBehavior: model.clipBehavior?.parse, diff --git a/packages/stac/lib/src/parsers/widgets/stac_page_view/stac_page_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_page_view/stac_page_view_parser.dart index fda4c1529..1e094b96e 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_page_view/stac_page_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_page_view/stac_page_view_parser.dart @@ -26,9 +26,7 @@ class StacPageViewParser extends StacParser { } class _StacPageViewWidget extends StatefulWidget { - const _StacPageViewWidget({ - required this.model, - }); + const _StacPageViewWidget({required this.model}); final StacPageView model; diff --git a/packages/stac/lib/src/parsers/widgets/stac_positioned/stac_positioned_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_positioned/stac_positioned_parser.dart index 2aa763fb5..dfcb23b90 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_positioned/stac_positioned_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_positioned/stac_positioned_parser.dart @@ -16,12 +16,13 @@ class StacPositionedParser extends StacParser { @override Widget parse(BuildContext context, StacPositioned model) { return Positioned( - left: model.left, - top: model.top, - right: model.right, - bottom: model.bottom, - height: model.height, - width: model.width, - child: model.child.parse(context) ?? const SizedBox()); + left: model.left, + top: model.top, + right: model.right, + bottom: model.bottom, + height: model.height, + width: model.width, + child: model.child.parse(context) ?? const SizedBox(), + ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_refresh_indicator/stac_refresh_indicator_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_refresh_indicator/stac_refresh_indicator_parser.dart index 67c15a0d4..effc4cd4d 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_refresh_indicator/stac_refresh_indicator_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_refresh_indicator/stac_refresh_indicator_parser.dart @@ -69,7 +69,8 @@ class _RefreshIndicatorWidgetState extends State<_RefreshIndicatorWidget> { backgroundColor: widget.model.backgroundColor.toColor(context), semanticsLabel: widget.model.semanticsLabel, semanticsValue: widget.model.semanticsValue, - strokeWidth: widget.model.strokeWidth ?? + strokeWidth: + widget.model.strokeWidth ?? RefreshProgressIndicator.defaultStrokeWidth, triggerMode: widget.model.triggerMode?.parse ?? RefreshIndicatorTriggerMode.onEdge, diff --git a/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart b/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart deleted file mode 100644 index ae73d1516..000000000 --- a/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_border_radius_parser.dart'; -import 'package:stac/src/parsers/foundation/borders/stac_border_side_parser.dart'; -import 'package:stac_core/foundation/borders/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; - -part 'stac_rounded_rectangle_border.freezed.dart'; -part 'stac_rounded_rectangle_border.g.dart'; - -@freezed -abstract class StacRoundedRectangleBorder with _$StacRoundedRectangleBorder { - const factory StacRoundedRectangleBorder({ - StacBorderSide? side, - StacBorderRadius? borderRadius, - }) = _StacRoundedRectangleBorder; - - factory StacRoundedRectangleBorder.fromJson(Map json) => - _$StacRoundedRectangleBorderFromJson(json); -} - -extension StacRoundedRectangleBorderParser on StacRoundedRectangleBorder? { - RoundedRectangleBorder parse(BuildContext context) { - return RoundedRectangleBorder( - side: this?.side?.parse(context) ?? BorderSide.none, - borderRadius: this!.borderRadius?.parse ?? BorderRadius.zero, - ); - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.freezed.dart deleted file mode 100644 index 468bac0e7..000000000 --- a/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.freezed.dart +++ /dev/null @@ -1,339 +0,0 @@ -// 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 - -part of 'stac_rounded_rectangle_border.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacRoundedRectangleBorder { - StacBorderSide? get side; - StacBorderRadius? get borderRadius; - - /// Create a copy of StacRoundedRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacRoundedRectangleBorderCopyWith - get copyWith => - _$StacRoundedRectangleBorderCopyWithImpl( - this as StacRoundedRectangleBorder, _$identity); - - /// Serializes this StacRoundedRectangleBorder to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacRoundedRectangleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.borderRadius, borderRadius) || - other.borderRadius == borderRadius)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, borderRadius); - - @override - String toString() { - return 'StacRoundedRectangleBorder(side: $side, borderRadius: $borderRadius)'; - } -} - -/// @nodoc -abstract mixin class $StacRoundedRectangleBorderCopyWith<$Res> { - factory $StacRoundedRectangleBorderCopyWith(StacRoundedRectangleBorder value, - $Res Function(StacRoundedRectangleBorder) _then) = - _$StacRoundedRectangleBorderCopyWithImpl; - @useResult - $Res call({StacBorderSide? side, StacBorderRadius? borderRadius}); -} - -/// @nodoc -class _$StacRoundedRectangleBorderCopyWithImpl<$Res> - implements $StacRoundedRectangleBorderCopyWith<$Res> { - _$StacRoundedRectangleBorderCopyWithImpl(this._self, this._then); - - final StacRoundedRectangleBorder _self; - final $Res Function(StacRoundedRectangleBorder) _then; - - /// Create a copy of StacRoundedRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? side = freezed, - Object? borderRadius = freezed, - }) { - return _then(_self.copyWith( - side: freezed == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - borderRadius: freezed == borderRadius - ? _self.borderRadius - : borderRadius // ignore: cast_nullable_to_non_nullable - as StacBorderRadius?, - )); - } -} - -/// Adds pattern-matching-related methods to [StacRoundedRectangleBorder]. -extension StacRoundedRectangleBorderPatterns on StacRoundedRectangleBorder { - /// 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(_StacRoundedRectangleBorder value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacRoundedRectangleBorder() 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(_StacRoundedRectangleBorder value) $default, - ) { - final _that = this; - switch (_that) { - case _StacRoundedRectangleBorder(): - 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(_StacRoundedRectangleBorder value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacRoundedRectangleBorder() 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(StacBorderSide? side, StacBorderRadius? borderRadius)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacRoundedRectangleBorder() when $default != null: - return $default(_that.side, _that.borderRadius); - 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(StacBorderSide? side, StacBorderRadius? borderRadius) - $default, - ) { - final _that = this; - switch (_that) { - case _StacRoundedRectangleBorder(): - return $default(_that.side, _that.borderRadius); - 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(StacBorderSide? side, StacBorderRadius? borderRadius)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacRoundedRectangleBorder() when $default != null: - return $default(_that.side, _that.borderRadius); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacRoundedRectangleBorder implements StacRoundedRectangleBorder { - const _StacRoundedRectangleBorder({this.side, this.borderRadius}); - factory _StacRoundedRectangleBorder.fromJson(Map json) => - _$StacRoundedRectangleBorderFromJson(json); - - @override - final StacBorderSide? side; - @override - final StacBorderRadius? borderRadius; - - /// Create a copy of StacRoundedRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacRoundedRectangleBorderCopyWith<_StacRoundedRectangleBorder> - get copyWith => __$StacRoundedRectangleBorderCopyWithImpl< - _StacRoundedRectangleBorder>(this, _$identity); - - @override - Map toJson() { - return _$StacRoundedRectangleBorderToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacRoundedRectangleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.borderRadius, borderRadius) || - other.borderRadius == borderRadius)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, borderRadius); - - @override - String toString() { - return 'StacRoundedRectangleBorder(side: $side, borderRadius: $borderRadius)'; - } -} - -/// @nodoc -abstract mixin class _$StacRoundedRectangleBorderCopyWith<$Res> - implements $StacRoundedRectangleBorderCopyWith<$Res> { - factory _$StacRoundedRectangleBorderCopyWith( - _StacRoundedRectangleBorder value, - $Res Function(_StacRoundedRectangleBorder) _then) = - __$StacRoundedRectangleBorderCopyWithImpl; - @override - @useResult - $Res call({StacBorderSide? side, StacBorderRadius? borderRadius}); -} - -/// @nodoc -class __$StacRoundedRectangleBorderCopyWithImpl<$Res> - implements _$StacRoundedRectangleBorderCopyWith<$Res> { - __$StacRoundedRectangleBorderCopyWithImpl(this._self, this._then); - - final _StacRoundedRectangleBorder _self; - final $Res Function(_StacRoundedRectangleBorder) _then; - - /// Create a copy of StacRoundedRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? side = freezed, - Object? borderRadius = freezed, - }) { - return _then(_StacRoundedRectangleBorder( - side: freezed == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - borderRadius: freezed == borderRadius - ? _self.borderRadius - : borderRadius // ignore: cast_nullable_to_non_nullable - as StacBorderRadius?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart b/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart deleted file mode 100644 index 9c0252c0b..000000000 --- a/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart +++ /dev/null @@ -1,25 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_rounded_rectangle_border.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacRoundedRectangleBorder _$StacRoundedRectangleBorderFromJson( - Map json) => - _StacRoundedRectangleBorder( - side: json['side'] == null - ? null - : StacBorderSide.fromJson(json['side'] as Map), - borderRadius: json['borderRadius'] == null - ? null - : StacBorderRadius.fromJson(json['borderRadius']), - ); - -Map _$StacRoundedRectangleBorderToJson( - _StacRoundedRectangleBorder instance) => - { - 'side': instance.side, - 'borderRadius': instance.borderRadius, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_row/stac_row_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_row/stac_row_parser.dart index ef59403d2..39efa8213 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_row/stac_row_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_row/stac_row_parser.dart @@ -20,15 +20,16 @@ class StacRowParser extends StacParser { @override Widget parse(BuildContext context, StacRow model) { return Row( - mainAxisAlignment: - model.mainAxisAlignment?.parse ?? MainAxisAlignment.start, - crossAxisAlignment: - model.crossAxisAlignment?.parse ?? CrossAxisAlignment.center, - mainAxisSize: model.mainAxisSize?.parse ?? MainAxisSize.max, - textDirection: model.textDirection?.parse, - verticalDirection: - model.verticalDirection?.parse ?? VerticalDirection.down, - spacing: model.spacing ?? 0, - children: model.children.parseList(context) ?? []); + mainAxisAlignment: + model.mainAxisAlignment?.parse ?? MainAxisAlignment.start, + crossAxisAlignment: + model.crossAxisAlignment?.parse ?? CrossAxisAlignment.center, + mainAxisSize: model.mainAxisSize?.parse ?? MainAxisSize.max, + textDirection: model.textDirection?.parse, + verticalDirection: + model.verticalDirection?.parse ?? VerticalDirection.down, + spacing: model.spacing ?? 0, + children: model.children.parseList(context) ?? [], + ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart index 406cb0778..a935dc616 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart @@ -25,9 +25,11 @@ class StacScaffoldParser extends StacParser { body: model.body.parse(context), floatingActionButton: model.floatingActionButton?.parse(context), floatingActionButtonLocation: model.floatingActionButtonLocation?.parse, - persistentFooterButtons: - model.persistentFooterButtons?.parseList(context), - persistentFooterAlignment: model.persistentFooterAlignment?.parse ?? + persistentFooterButtons: model.persistentFooterButtons?.parseList( + context, + ), + persistentFooterAlignment: + model.persistentFooterAlignment?.parse ?? AlignmentDirectional.centerEnd, drawer: model.drawer?.parse(context), // onDrawerChanged: model.onDrawerChanged?.parse(context), diff --git a/packages/stac/lib/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart index 8a436a7d8..180f6f190 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart @@ -58,10 +58,7 @@ class _SetValueWidgetState extends State<_SetValueWidget> { // Convert the StacWidget to JSON, resolve variables, then parse it back final childJson = widget.model.child!.toJson(); - final resolvedJson = resolveVariablesInJson( - childJson, - _stacRegistry, - ); + final resolvedJson = resolveVariablesInJson(childJson, _stacRegistry); return Stac.fromJson(resolvedJson, context) ?? const SizedBox(); } diff --git a/packages/stac/lib/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view_parser.dart index 3a43c9d3c..1a1499cc9 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view_parser.dart @@ -33,7 +33,8 @@ class StacSingleChildScrollViewParser model.dragStartBehavior?.parse ?? DragStartBehavior.start, clipBehavior: model.clipBehavior?.parse ?? Clip.hardEdge, restorationId: model.restorationId, - keyboardDismissBehavior: model.keyboardDismissBehavior?.parse ?? + keyboardDismissBehavior: + model.keyboardDismissBehavior?.parse ?? ScrollViewKeyboardDismissBehavior.manual, child: model.child?.parse(context), ); diff --git a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart index 9bf7bce80..8e6484f5d 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart @@ -27,8 +27,9 @@ class StacTabBarParser extends StacParser { Widget parse(BuildContext context, StacTabBar model) { return TabBar( controller: controller, - tabs: - model.tabs.map((t) => t.parse(context) ?? const SizedBox()).toList(), + tabs: model.tabs + .map((t) => t.parse(context) ?? const SizedBox()) + .toList(), isScrollable: model.isScrollable ?? false, padding: model.padding?.parse, indicatorColor: model.indicatorColor?.toColor(context), diff --git a/packages/stac/lib/src/parsers/widgets/stac_table/stac_table_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_table/stac_table_parser.dart index 19bd7811f..5c2f6b01a 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_table/stac_table_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_table/stac_table_parser.dart @@ -21,8 +21,9 @@ class StacTableParser extends StacParser { Widget parse(BuildContext context, StacTable model) { return Table( children: model.children.map((row) => row.parse(context)).toList(), - columnWidths: - model.columnWidths?.map((key, value) => MapEntry(key, value.parse)), + columnWidths: model.columnWidths?.map( + (key, value) => MapEntry(key, value.parse), + ), defaultColumnWidth: model.defaultColumnWidth != null ? model.defaultColumnWidth!.parse : const FlexColumnWidth(), @@ -30,7 +31,8 @@ class StacTableParser extends StacParser { border: model.border != null ? StacTableBorderParser(model.border!).parse(context) : null, - defaultVerticalAlignment: model.defaultVerticalAlignment?.parse ?? + defaultVerticalAlignment: + model.defaultVerticalAlignment?.parse ?? TableCellVerticalAlignment.top, textBaseline: model.textBaseline?.parse, ); diff --git a/packages/stac/lib/src/parsers/widgets/stac_text/stac_text_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_text/stac_text_parser.dart index b52186c21..457c905d1 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text/stac_text_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_text/stac_text_parser.dart @@ -50,7 +50,7 @@ class StacTextParser extends StacParser { style: child.style?.parse(context), recognizer: child.onTap != null ? (TapGestureRecognizer() - ..onTap = () => Stac.onCallFromJson(child.onTap, context)) + ..onTap = () => Stac.onCallFromJson(child.onTap, context)) : null, ); }).toList(), diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart index 8003bac31..aa846d218 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/foundation/layout/stac_clip_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; +import 'package:stac/src/parsers/theme/themes.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; @@ -28,11 +28,11 @@ class StacTextButtonParser extends StacParser { onHover: model.onHover == null ? null : (bool value) => - Stac.onCallFromJson(model.onHover?.toJson(), context), + Stac.onCallFromJson(model.onHover?.toJson(), context), onFocusChange: model.onFocusChange == null ? null : (bool value) => - Stac.onCallFromJson(model.onFocusChange?.toJson(), context), + Stac.onCallFromJson(model.onFocusChange?.toJson(), context), style: model.style?.parseTextButton(context), autofocus: model.autofocus ?? false, clipBehavior: model.clipBehavior?.parse, diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_field/stac_text_field_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_text_field/stac_text_field_parser.dart index 95ff46c45..8f1a9639c 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text_field/stac_text_field_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_text_field/stac_text_field_parser.dart @@ -18,10 +18,7 @@ import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacTextFieldParser extends StacParser { - const StacTextFieldParser({ - this.controller, - this.focusNode, - }); + const StacTextFieldParser({this.controller, this.focusNode}); final TextEditingController? controller; final FocusNode? focusNode; diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_form_field/stac_text_form_field_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_text_form_field/stac_text_form_field_parser.dart index 5c6a7bb28..041769458 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text_form_field/stac_text_form_field_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_text_form_field/stac_text_form_field_parser.dart @@ -107,14 +107,13 @@ class _TextFormFieldWidgetState extends State<_TextFormFieldWidget> { style: widget.model.style?.parse(context), decoration: widget.model.decoration?.parse(context), inputFormatters: widget.model.inputFormatters - ?.map((inputFormatter) => - inputFormatter.type.parse.format(inputFormatter.rule ?? "")) + ?.map( + (inputFormatter) => + inputFormatter.type.parse.format(inputFormatter.rule ?? ""), + ) .toList(), validator: (value) { - return _validate( - value, - widget.model, - ); + return _validate(value, widget.model); }, ); } diff --git a/packages/stac/lib/src/parsers/widgets/stac_visibility/stac_visibility_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_visibility/stac_visibility_parser.dart index 775b37a2b..661114be8 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_visibility/stac_visibility_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_visibility/stac_visibility_parser.dart @@ -17,7 +17,8 @@ class StacVisibilityParser extends StacParser { Widget parse(BuildContext context, StacVisibility model) { final child = model.child?.parse(context) ?? const SizedBox.shrink(); - bool shouldUseMaintainConstructor = (model.maintainState ?? false) || + bool shouldUseMaintainConstructor = + (model.maintainState ?? false) || (model.maintainAnimation ?? false) || (model.maintainSize ?? false) || (model.maintainSemantics ?? false) || @@ -34,10 +35,7 @@ class StacVisibilityParser extends StacParser { } if (shouldUseMaintainConstructor) { - return Visibility.maintain( - visible: model.visible ?? true, - child: child, - ); + return Visibility.maintain(visible: model.visible ?? true, child: child); } final replacement = diff --git a/packages/stac/lib/src/parsers/widgets/stac_wrap/stac_wrap_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_wrap/stac_wrap_parser.dart index caca83c53..1ae74631d 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_wrap/stac_wrap_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_wrap/stac_wrap_parser.dart @@ -21,17 +21,18 @@ class StacWrapParser extends StacParser { @override Widget parse(BuildContext context, StacWrap model) { return Wrap( - direction: model.direction?.parse ?? Axis.horizontal, - alignment: model.alignment?.parse ?? WrapAlignment.start, - spacing: model.spacing ?? 0.0, - runAlignment: model.runAlignment?.parse ?? WrapAlignment.start, - runSpacing: model.runSpacing ?? 0.0, - crossAxisAlignment: - model.crossAxisAlignment?.parse ?? WrapCrossAlignment.start, - textDirection: model.textDirection?.parse, - verticalDirection: - model.verticalDirection?.parse ?? VerticalDirection.down, - clipBehavior: model.clipBehavior?.parse ?? Clip.hardEdge, - children: model.children?.parseList(context) ?? const []); + direction: model.direction?.parse ?? Axis.horizontal, + alignment: model.alignment?.parse ?? WrapAlignment.start, + spacing: model.spacing ?? 0.0, + runAlignment: model.runAlignment?.parse ?? WrapAlignment.start, + runSpacing: model.runSpacing ?? 0.0, + crossAxisAlignment: + model.crossAxisAlignment?.parse ?? WrapCrossAlignment.start, + textDirection: model.textDirection?.parse, + verticalDirection: + model.verticalDirection?.parse ?? VerticalDirection.down, + clipBehavior: model.clipBehavior?.parse ?? Clip.hardEdge, + children: model.children?.parseList(context) ?? const [], + ); } } diff --git a/packages/stac/lib/src/parsers/widgets/widgets.dart b/packages/stac/lib/src/parsers/widgets/widgets.dart index 5db5dcea1..02879d0d3 100644 --- a/packages/stac/lib/src/parsers/widgets/widgets.dart +++ b/packages/stac/lib/src/parsers/widgets/widgets.dart @@ -1,5 +1,3 @@ -export 'package:stac/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart'; -export 'package:stac/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart'; export 'package:stac/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart'; export 'package:stac/src/parsers/widgets/stac_align/stac_align_parser.dart'; export 'package:stac/src/parsers/widgets/stac_aspect_ratio/stac_aspect_ratio_parser.dart'; diff --git a/packages/stac/lib/src/services/stac_network_service.dart b/packages/stac/lib/src/services/stac_network_service.dart index 706d1c506..bca2fc634 100644 --- a/packages/stac/lib/src/services/stac_network_service.dart +++ b/packages/stac/lib/src/services/stac_network_service.dart @@ -14,8 +14,9 @@ class StacNetworkService { BuildContext context, StacNetworkRequest request, ) async { - Map headers = - Map.from(request.headers ?? {}); + Map headers = Map.from( + request.headers ?? {}, + ); _dio.options.headers = headers; _dio.options.contentType = request.contentType; @@ -68,10 +69,7 @@ class StacNetworkService { ); } - static Future _updateBody( - BuildContext context, - dynamic body, - ) async { + static Future _updateBody(BuildContext context, dynamic body) async { Map bodyMap = {}; if (body is Map) { diff --git a/packages/stac/lib/src/utils/button_utils.dart b/packages/stac/lib/src/utils/button_utils.dart index 8138380ca..916620464 100644 --- a/packages/stac/lib/src/utils/button_utils.dart +++ b/packages/stac/lib/src/utils/button_utils.dart @@ -1,6 +1 @@ -enum FloatingActionButtonType { - extended, - large, - medium, - small, -} +enum FloatingActionButtonType { extended, large, medium, small } diff --git a/packages/stac/lib/src/utils/expression_resolver.dart b/packages/stac/lib/src/utils/expression_resolver.dart index 6ba9c26e3..711ac8359 100644 --- a/packages/stac/lib/src/utils/expression_resolver.dart +++ b/packages/stac/lib/src/utils/expression_resolver.dart @@ -142,15 +142,17 @@ class ExpressionResolver { // Simple string concatenation if (expression.contains('+')) { List parts = _splitStringExpression(expression, '+'); - return parts.map((part) { - part = part.trim(); - // Remove quotes from string literals - if ((part.startsWith('"') && part.endsWith('"')) || - (part.startsWith("'") && part.endsWith("'"))) { - return part.substring(1, part.length - 1); - } - return part; - }).join(''); + return parts + .map((part) { + part = part.trim(); + // Remove quotes from string literals + if ((part.startsWith('"') && part.endsWith('"')) || + (part.startsWith("'") && part.endsWith("'"))) { + return part.substring(1, part.length - 1); + } + return part; + }) + .join(''); } // If no operation, just return the string without quotes @@ -165,7 +167,9 @@ class ExpressionResolver { /// Splits a string expression while respecting string literals. static List _splitStringExpression( - String expression, String delimiter) { + String expression, + String delimiter, + ) { List result = []; bool inString = false; String currentQuote = ''; diff --git a/packages/stac/lib/src/utils/icon_utils.dart b/packages/stac/lib/src/utils/icon_utils.dart index 3a5bd489f..cc56096d5 100644 --- a/packages/stac/lib/src/utils/icon_utils.dart +++ b/packages/stac/lib/src/utils/icon_utils.dart @@ -1,10 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -enum IconType { - material, - cupertino, -} +enum IconType { material, cupertino } final Map cupertinoIconsMap = { 'left_chevron': CupertinoIcons.left_chevron, diff --git a/packages/stac/lib/src/utils/input_validations.dart b/packages/stac/lib/src/utils/input_validations.dart index a113bad5f..d311ef8db 100644 --- a/packages/stac/lib/src/utils/input_validations.dart +++ b/packages/stac/lib/src/utils/input_validations.dart @@ -7,10 +7,12 @@ enum InputValidationType { general; RegExp get _emailRegExp => RegExp( - r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'); + r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$', + ); RegExp get _nameRegExp => RegExp(r"^[A-Za-z .`'/-]{2,32}$"); RegExp get _passwordRegExp => RegExp( - r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@#$!%*?&])[A-Za-z\d@#$%^&£*\-_+=[\]{}|\\:,?\/`~""()<>;!]*$'); + r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@#$!%*?&])[A-Za-z\d@#$%^&£*\-_+=[\]{}|\\:,?\/`~""()<>;!]*$', + ); RegExp get _isNotEmptyRegExp => RegExp("^[0-9a-zA-Z .`'/-]{1,50}\$"); bool validate(String value, String rule, {String? compareValue}) { diff --git a/packages/stac/lib/src/utils/variable_resolver.dart b/packages/stac/lib/src/utils/variable_resolver.dart index 827d146d2..86cac0fa2 100644 --- a/packages/stac/lib/src/utils/variable_resolver.dart +++ b/packages/stac/lib/src/utils/variable_resolver.dart @@ -15,7 +15,8 @@ dynamic resolveVariablesInJson(dynamic json, StacRegistry registry) { // return json; // } return json.map( - (key, value) => MapEntry(key, resolveVariablesInJson(value, registry))); + (key, value) => MapEntry(key, resolveVariablesInJson(value, registry)), + ); } else if (json is List) { return json.map((item) => resolveVariablesInJson(item, registry)).toList(); } diff --git a/packages/stac/lib/stac.dart b/packages/stac/lib/stac.dart index daea0b476..1f3b5e094 100644 --- a/packages/stac/lib/stac.dart +++ b/packages/stac/lib/stac.dart @@ -1,6 +1,8 @@ -export 'package:stac/src/parsers/actions/actions.dart'; export 'package:stac/src/framework/framework.dart'; +export 'package:stac/src/parsers/actions/actions.dart'; export 'package:stac/src/parsers/parsers.dart'; export 'package:stac/src/services/services.dart'; export 'package:stac/src/utils/utils.dart'; +// Theme exports +export 'package:stac_core/stac_core.dart' show StacTheme; export 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/pubspec.yaml b/packages/stac/pubspec.yaml index 6dd11a73b..21d713c15 100644 --- a/packages/stac/pubspec.yaml +++ b/packages/stac/pubspec.yaml @@ -5,8 +5,8 @@ repository: https://github.com/StacDev/stac homepage: https://stac.dev/ environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.35.0" + sdk: ^3.9.2 + flutter: ">=1.17.0" topics: - ui @@ -17,7 +17,6 @@ topics: dependencies: flutter: sdk: flutter - freezed_annotation: ^3.0.0 json_annotation: ^4.9.0 logger: ^2.5.0 dio: ^5.8.0+1 @@ -32,5 +31,4 @@ dev_dependencies: sdk: flutter flutter_lints: ^6.0.0 build_runner: ^2.5.4 - freezed: ^3.0.6 json_serializable: ^6.9.5 \ No newline at end of file diff --git a/packages/stac_core/.gitignore b/packages/stac_core/.gitignore index eb6c05cd3..8df109ec5 100644 --- a/packages/stac_core/.gitignore +++ b/packages/stac_core/.gitignore @@ -29,3 +29,6 @@ migrate_working_dir/ .flutter-plugins .flutter-plugins-dependencies build/ + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/packages/stac_core/lib/foundation/foundation.dart b/packages/stac_core/lib/foundation/foundation.dart index 429f40c84..0effe4683 100644 --- a/packages/stac_core/lib/foundation/foundation.dart +++ b/packages/stac_core/lib/foundation/foundation.dart @@ -69,6 +69,7 @@ export 'layout/stac_wrap_cross_alignment.dart'; export 'navigation/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart'; export 'navigation/stac_floating_action_button_location.dart'; export 'navigation/stac_floating_action_button_type.dart'; +export 'navigation/stac_navigation_destination_label_behavior.dart'; export 'navigation/stac_tab_alignment.dart'; export 'navigation/stac_tab_bar_indicator_size.dart'; // Specifications @@ -83,11 +84,9 @@ export 'text/stac_text_span/stac_text_span.dart'; export 'text/stac_text_style/stac_text_style.dart'; export 'text/stac_text_types.dart'; // Theme and styling -export 'theme/stac_button_style/stac_button_style.dart'; -export 'theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; +export 'theme/theme.dart'; // UI components and behavior export 'ui_components/stac_carousel_view_type.dart'; -export 'ui_components/stac_traversal_edge_behavior.dart'; export 'ui_components/stac_dismiss_direction.dart'; export 'ui_components/stac_dropdown_menu_close_behavior.dart'; export 'ui_components/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; @@ -106,3 +105,4 @@ export 'ui_components/stac_snack_bar_behavior.dart'; export 'ui_components/stac_switch_type.dart'; export 'ui_components/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; export 'ui_components/stac_table_column_width/stac_table_column_width.dart'; +export 'ui_components/stac_traversal_edge_behavior.dart'; diff --git a/packages/stac_core/lib/foundation/navigation/stac_navigation_destination_label_behavior.dart b/packages/stac_core/lib/foundation/navigation/stac_navigation_destination_label_behavior.dart new file mode 100644 index 000000000..2f3c746a7 --- /dev/null +++ b/packages/stac_core/lib/foundation/navigation/stac_navigation_destination_label_behavior.dart @@ -0,0 +1,23 @@ +/// Navigation destination label behavior options. +/// +/// Defines how labels are displayed for navigation bar destinations. +/// +/// Maps to Flutter's [NavigationDestinationLabelBehavior]. +enum StacNavigationDestinationLabelBehavior { + /// Always shows all of the labels under each navigation bar destination, + /// selected and unselected. + alwaysShow, + + /// Never shows any of the labels under the navigation bar destinations, + /// regardless of selected vs unselected. + alwaysHide, + + /// Only shows the labels of the selected navigation bar destination. + /// + /// When a destination is unselected, the label will be faded out, and the + /// icon will be centered. + /// + /// When a destination is selected, the label will fade in and the label and + /// icon will slide up so that they are both centered. + onlyShowSelected, +} diff --git a/packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.dart b/packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.dart index 7fd0d354b..9a5a2d2d6 100644 --- a/packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.dart +++ b/packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.dart @@ -106,15 +106,9 @@ enum StacMaterialTextStyle { /// /// Example: /// ```dart -/// final style = StacTheme.textTheme.displayLarge; -/// final bodyStyle = StacTheme.textTheme.bodyMedium; +/// final style = StacThemeData.textTheme.displayLarge; +/// final bodyStyle = StacThemeData.textTheme.bodyMedium; /// ``` -class StacTheme { - const StacTheme._(); - - /// Access to all theme text styles. - static const StacThemeTextStyles textTheme = StacThemeTextStyles(); -} /// A collection of all available theme text styles. class StacThemeTextStyles { @@ -187,7 +181,7 @@ abstract class StacTextStyle implements StacElement { /// Creates a custom text style with the given properties. /// /// This is a convenience factory constructor that returns a [StacCustomTextStyle]. - /// For theme-based styles, use [StacTheme.textTheme] or [StacTextStyle.fromTheme]. + /// For theme-based styles, use [StacThemeData.textTheme] or [StacTextStyle.fromTheme]. /// /// Example: /// ```dart diff --git a/packages/stac_core/lib/foundation/theme/stac_app_bar_theme/stac_app_bar_theme.dart b/packages/stac_core/lib/foundation/theme/stac_app_bar_theme/stac_app_bar_theme.dart new file mode 100644 index 000000000..bab6be9c7 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_app_bar_theme/stac_app_bar_theme.dart @@ -0,0 +1,130 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.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'; +import 'package:stac_core/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; +import 'package:stac_core/foundation/ui_components/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; + +part 'stac_app_bar_theme.g.dart'; + +/// A Stac model representing Flutter's [AppBarTheme]. +/// +/// Defines the theme for app bars, including colors, elevation, text styles, +/// icon themes, and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacAppBarTheme( +/// backgroundColor: '#2196F3', +/// foregroundColor: '#FFFFFF', +/// elevation: 4.0, +/// centerTitle: true, +/// titleTextStyle: StacTextStyle( +/// fontSize: 20.0, +/// fontWeight: 'bold', +/// ), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#2196F3", +/// "foregroundColor": "#FFFFFF", +/// "elevation": 4.0, +/// "scrolledUnderElevation": 0.0, +/// "shadowColor": "#000000", +/// "surfaceTintColor": "#000000", +/// "centerTitle": true, +/// "titleSpacing": 16.0, +/// "toolbarHeight": 56.0, +/// "leadingWidth": 56.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacAppBarTheme implements StacElement { + /// Creates a [StacAppBarTheme] with the given properties. + const StacAppBarTheme({ + this.backgroundColor, + this.foregroundColor, + this.elevation, + this.scrolledUnderElevation, + this.shadowColor, + this.surfaceTintColor, + this.shape, + this.iconTheme, + this.actionsIconTheme, + this.centerTitle, + this.titleSpacing, + this.leadingWidth, + this.toolbarHeight, + this.toolbarTextStyle, + this.titleTextStyle, + this.systemOverlayStyle, + this.actionsPadding, + }); + + /// The background color of the app bar. + final String? backgroundColor; + + /// The default color for [AppBar] icons and text. + final String? foregroundColor; + + /// The z-coordinate at which to place this app bar relative to its parent. + final double? elevation; + + /// The z-coordinate at which to place this app bar when it's scrolled under. + final double? scrolledUnderElevation; + + /// The color of the shadow below the app bar. + final String? shadowColor; + + /// The color used as an overlay on the app bar's surface color. + final String? surfaceTintColor; + + /// The shape of the app bar's [Material]. + final StacShapeBorder? shape; + + /// The color, opacity, and size to use for app bar icons. + final StacIconThemeData? iconTheme; + + /// The color, opacity, and size to use for the app bar's action icons. + final StacIconThemeData? actionsIconTheme; + + /// Whether the title should be centered. + final bool? centerTitle; + + /// The spacing around the title content on the app bar. + final double? titleSpacing; + + /// The width of the leading widget. + final double? leadingWidth; + + /// The height of the app bar's toolbar. + final double? toolbarHeight; + + /// The default text style for the app bar's toolbar. + final StacTextStyle? toolbarTextStyle; + + /// The default text style for the app bar's title. + final StacTextStyle? titleTextStyle; + + /// The system UI overlay style for the app bar. + final StacSystemUIOverlayStyle? systemOverlayStyle; + + /// The padding around the action buttons. + final StacEdgeInsets? actionsPadding; + + /// Creates a [StacAppBarTheme] from JSON. + factory StacAppBarTheme.fromJson(Map json) => + _$StacAppBarThemeFromJson(json); + + /// Converts this app bar theme to JSON. + @override + Map toJson() => _$StacAppBarThemeToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_app_bar_theme/stac_app_bar_theme.g.dart b/packages/stac_core/lib/foundation/theme/stac_app_bar_theme/stac_app_bar_theme.g.dart new file mode 100644 index 000000000..11bba286b --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_app_bar_theme/stac_app_bar_theme.g.dart @@ -0,0 +1,68 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_app_bar_theme.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacAppBarTheme _$StacAppBarThemeFromJson( + Map json, +) => StacAppBarTheme( + backgroundColor: json['backgroundColor'] as String?, + foregroundColor: json['foregroundColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + scrolledUnderElevation: (json['scrolledUnderElevation'] as num?)?.toDouble(), + shadowColor: json['shadowColor'] as String?, + surfaceTintColor: json['surfaceTintColor'] as String?, + shape: json['shape'] == null + ? null + : StacShapeBorder.fromJson(json['shape'] as Map), + iconTheme: json['iconTheme'] == null + ? null + : StacIconThemeData.fromJson(json['iconTheme'] as Map), + actionsIconTheme: json['actionsIconTheme'] == null + ? null + : StacIconThemeData.fromJson( + json['actionsIconTheme'] as Map, + ), + centerTitle: json['centerTitle'] as bool?, + titleSpacing: (json['titleSpacing'] as num?)?.toDouble(), + leadingWidth: (json['leadingWidth'] as num?)?.toDouble(), + toolbarHeight: (json['toolbarHeight'] as num?)?.toDouble(), + toolbarTextStyle: json['toolbarTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['toolbarTextStyle']), + titleTextStyle: json['titleTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['titleTextStyle']), + systemOverlayStyle: json['systemOverlayStyle'] == null + ? null + : StacSystemUIOverlayStyle.fromJson( + json['systemOverlayStyle'] as Map, + ), + actionsPadding: json['actionsPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['actionsPadding']), +); + +Map _$StacAppBarThemeToJson(StacAppBarTheme instance) => + { + 'backgroundColor': instance.backgroundColor, + 'foregroundColor': instance.foregroundColor, + 'elevation': instance.elevation, + 'scrolledUnderElevation': instance.scrolledUnderElevation, + 'shadowColor': instance.shadowColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'shape': instance.shape?.toJson(), + 'iconTheme': instance.iconTheme?.toJson(), + 'actionsIconTheme': instance.actionsIconTheme?.toJson(), + 'centerTitle': instance.centerTitle, + 'titleSpacing': instance.titleSpacing, + 'leadingWidth': instance.leadingWidth, + 'toolbarHeight': instance.toolbarHeight, + 'toolbarTextStyle': instance.toolbarTextStyle?.toJson(), + 'titleTextStyle': instance.titleTextStyle?.toJson(), + 'systemOverlayStyle': instance.systemOverlayStyle?.toJson(), + 'actionsPadding': instance.actionsPadding?.toJson(), + }; diff --git a/packages/stac_core/lib/foundation/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart b/packages/stac_core/lib/foundation/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart new file mode 100644 index 000000000..dd71656fc --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart @@ -0,0 +1,72 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; + +part 'stac_bottom_app_bar_theme.g.dart'; + +/// A Stac model representing Flutter's [BottomAppBarTheme]. +/// +/// Defines the theme for bottom app bars, including colors, elevation, and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacBottomAppBarThemeData( +/// color: '#FFFFFF', +/// elevation: 8.0, +/// height: 56.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#FFFFFF", +/// "elevation": 8.0, +/// "height": 56.0, +/// "surfaceTintColor": "#000000", +/// "shadowColor": "#000000", +/// "padding": {"all": 8.0} +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBottomAppBarThemeData implements StacElement { + /// Creates a [StacBottomAppBarThemeData] with the given properties. + const StacBottomAppBarThemeData({ + this.color, + this.elevation, + this.height, + this.surfaceTintColor, + this.shadowColor, + this.padding, + }); + + /// The background color of the bottom app bar. + final String? color; + + /// The z-coordinate at which to place this bottom app bar relative to its parent. + final double? elevation; + + /// The height of the bottom app bar. + final double? height; + + /// The color used to tint the surface of this bottom app bar. + final String? surfaceTintColor; + + /// The color of the shadow below the bottom app bar. + final String? shadowColor; + + /// The padding around the bottom app bar's content. + final StacEdgeInsets? padding; + + /// Creates a [StacBottomAppBarThemeData] from JSON. + factory StacBottomAppBarThemeData.fromJson(Map json) => + _$StacBottomAppBarThemeDataFromJson(json); + + /// Converts this bottom app bar theme to JSON. + @override + Map toJson() => _$StacBottomAppBarThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.g.dart b/packages/stac_core/lib/foundation/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.g.dart new file mode 100644 index 000000000..b5a5c0e73 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_bottom_app_bar_theme.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacBottomAppBarThemeData _$StacBottomAppBarThemeDataFromJson( + Map json, +) => StacBottomAppBarThemeData( + color: json['color'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + height: (json['height'] as num?)?.toDouble(), + surfaceTintColor: json['surfaceTintColor'] as String?, + shadowColor: json['shadowColor'] as String?, + padding: json['padding'] == null + ? null + : StacEdgeInsets.fromJson(json['padding']), +); + +Map _$StacBottomAppBarThemeDataToJson( + StacBottomAppBarThemeData instance, +) => { + 'color': instance.color, + 'elevation': instance.elevation, + 'height': instance.height, + 'surfaceTintColor': instance.surfaceTintColor, + 'shadowColor': instance.shadowColor, + 'padding': instance.padding?.toJson(), +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_bottom_nav_bar_theme_data/stac_bottom_nav_bar_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_bottom_nav_bar_theme_data/stac_bottom_nav_bar_theme_data.dart new file mode 100644 index 000000000..326389116 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_bottom_nav_bar_theme_data/stac_bottom_nav_bar_theme_data.dart @@ -0,0 +1,105 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/navigation/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; + +part 'stac_bottom_nav_bar_theme_data.g.dart'; + +/// A Stac model representing Flutter's [BottomNavigationBarThemeData]. +/// +/// Defines the theme for bottom navigation bars, including colors, icon themes, +/// text styles, and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacBottomNavBarThemeData( +/// backgroundColor: '#FFFFFF', +/// selectedItemColor: '#2196F3', +/// unselectedItemColor: '#757575', +/// type: BottomNavigationBarType.fixed, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 8.0, +/// "selectedItemColor": "#2196F3", +/// "unselectedItemColor": "#757575", +/// "type": "fixed", +/// "showSelectedLabels": true, +/// "showUnselectedLabels": true +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBottomNavBarThemeData implements StacElement { + /// Creates a [StacBottomNavBarThemeData] with the given properties. + const StacBottomNavBarThemeData({ + this.backgroundColor, + this.elevation, + this.selectedIconTheme, + this.unselectedIconTheme, + this.selectedItemColor, + this.unselectedItemColor, + this.selectedLabelStyle, + this.unselectedLabelStyle, + this.showSelectedLabels, + this.showUnselectedLabels, + this.type, + this.enableFeedback, + this.landscapeLayout, + }); + + /// The background color of the bottom navigation bar. + final String? backgroundColor; + + /// The z-coordinate at which to place this bottom navigation bar relative to its parent. + final double? elevation; + + /// The icon theme for selected items. + final StacIconThemeData? selectedIconTheme; + + /// The icon theme for unselected items. + final StacIconThemeData? unselectedIconTheme; + + /// The color of the selected item. + final String? selectedItemColor; + + /// The color of the unselected items. + final String? unselectedItemColor; + + /// The text style for selected labels. + final StacTextStyle? selectedLabelStyle; + + /// The text style for unselected labels. + final StacTextStyle? unselectedLabelStyle; + + /// Whether to show labels for selected items. + final bool? showSelectedLabels; + + /// Whether to show labels for unselected items. + final bool? showUnselectedLabels; + + /// The type of bottom navigation bar. + final StacBottomNavigationBarType? type; + + /// Whether detected gestures should provide acoustic and/or haptic feedback. + final bool? enableFeedback; + + /// The layout behavior in landscape orientation. + final StacBottomNavigationBarLandscapeLayout? landscapeLayout; + + /// Creates a [StacBottomNavBarThemeData] from JSON. + factory StacBottomNavBarThemeData.fromJson(Map json) => + _$StacBottomNavBarThemeDataFromJson(json); + + /// Converts this bottom navigation bar theme to JSON. + @override + Map toJson() => _$StacBottomNavBarThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_bottom_nav_bar_theme_data/stac_bottom_nav_bar_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_bottom_nav_bar_theme_data/stac_bottom_nav_bar_theme_data.g.dart new file mode 100644 index 000000000..e1f16f42a --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_bottom_nav_bar_theme_data/stac_bottom_nav_bar_theme_data.g.dart @@ -0,0 +1,70 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_bottom_nav_bar_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacBottomNavBarThemeData _$StacBottomNavBarThemeDataFromJson( + Map json, +) => StacBottomNavBarThemeData( + backgroundColor: json['backgroundColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + selectedIconTheme: json['selectedIconTheme'] == null + ? null + : StacIconThemeData.fromJson( + json['selectedIconTheme'] as Map, + ), + unselectedIconTheme: json['unselectedIconTheme'] == null + ? null + : StacIconThemeData.fromJson( + json['unselectedIconTheme'] as Map, + ), + selectedItemColor: json['selectedItemColor'] as String?, + unselectedItemColor: json['unselectedItemColor'] as String?, + selectedLabelStyle: json['selectedLabelStyle'] == null + ? null + : StacTextStyle.fromJson(json['selectedLabelStyle']), + unselectedLabelStyle: json['unselectedLabelStyle'] == null + ? null + : StacTextStyle.fromJson(json['unselectedLabelStyle']), + showSelectedLabels: json['showSelectedLabels'] as bool?, + showUnselectedLabels: json['showUnselectedLabels'] as bool?, + type: $enumDecodeNullable(_$StacBottomNavigationBarTypeEnumMap, json['type']), + enableFeedback: json['enableFeedback'] as bool?, + landscapeLayout: $enumDecodeNullable( + _$StacBottomNavigationBarLandscapeLayoutEnumMap, + json['landscapeLayout'], + ), +); + +Map _$StacBottomNavBarThemeDataToJson( + StacBottomNavBarThemeData instance, +) => { + 'backgroundColor': instance.backgroundColor, + 'elevation': instance.elevation, + 'selectedIconTheme': instance.selectedIconTheme?.toJson(), + 'unselectedIconTheme': instance.unselectedIconTheme?.toJson(), + 'selectedItemColor': instance.selectedItemColor, + 'unselectedItemColor': instance.unselectedItemColor, + 'selectedLabelStyle': instance.selectedLabelStyle?.toJson(), + 'unselectedLabelStyle': instance.unselectedLabelStyle?.toJson(), + 'showSelectedLabels': instance.showSelectedLabels, + 'showUnselectedLabels': instance.showUnselectedLabels, + 'type': _$StacBottomNavigationBarTypeEnumMap[instance.type], + 'enableFeedback': instance.enableFeedback, + 'landscapeLayout': + _$StacBottomNavigationBarLandscapeLayoutEnumMap[instance.landscapeLayout], +}; + +const _$StacBottomNavigationBarTypeEnumMap = { + StacBottomNavigationBarType.fixed: 'fixed', + StacBottomNavigationBarType.shifting: 'shifting', +}; + +const _$StacBottomNavigationBarLandscapeLayoutEnumMap = { + StacBottomNavigationBarLandscapeLayout.spread: 'spread', + StacBottomNavigationBarLandscapeLayout.centered: 'centered', + StacBottomNavigationBarLandscapeLayout.linear: 'linear', +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_bottom_sheet_theme_data/stac_bottom_sheet_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_bottom_sheet_theme_data/stac_bottom_sheet_theme_data.dart new file mode 100644 index 000000000..3aff400aa --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_bottom_sheet_theme_data/stac_bottom_sheet_theme_data.dart @@ -0,0 +1,105 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/geometry/stac_box_constraints/stac_box_constraints.dart'; +import 'package:stac_core/foundation/geometry/stac_size/stac_size.dart'; +import 'package:stac_core/foundation/layout/stac_clip.dart'; + +part 'stac_bottom_sheet_theme_data.g.dart'; + +/// A Stac model representing Flutter's [BottomSheetThemeData]. +/// +/// Defines the theme for bottom sheets, including colors, elevation, shape, +/// drag handle, and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacBottomSheetThemeData( +/// backgroundColor: '#FFFFFF', +/// elevation: 8.0, +/// showDragHandle: true, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 8.0, +/// "modalElevation": 16.0, +/// "shadowColor": "#000000", +/// "showDragHandle": true, +/// "dragHandleColor": "#757575", +/// "clipBehavior": "antiAlias" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBottomSheetThemeData implements StacElement { + /// Creates a [StacBottomSheetThemeData] with the given properties. + const StacBottomSheetThemeData({ + this.backgroundColor, + this.surfaceTintColor, + this.elevation, + this.modalBackgroundColor, + this.modalBarrierColor, + this.shadowColor, + this.modalElevation, + this.shape, + this.showDragHandle, + this.dragHandleColor, + this.dragHandleSize, + this.clipBehavior, + this.constraints, + }); + + /// The background color of the bottom sheet. + final String? backgroundColor; + + /// The color used to tint the surface of this bottom sheet. + final String? surfaceTintColor; + + /// The z-coordinate at which to place this bottom sheet relative to its parent. + final double? elevation; + + /// The background color of the modal bottom sheet. + final String? modalBackgroundColor; + + /// The color of the modal barrier. + final String? modalBarrierColor; + + /// The color of the shadow below the bottom sheet. + final String? shadowColor; + + /// The z-coordinate at which to place the modal bottom sheet. + final double? modalElevation; + + /// The shape of the bottom sheet's border. + final StacBorder? shape; + + /// Whether to show a drag handle on the bottom sheet. + final bool? showDragHandle; + + /// The color of the drag handle. + final String? dragHandleColor; + + /// The size of the drag handle. + final StacSize? dragHandleSize; + + /// How to clip the bottom sheet's content. + final StacClip? clipBehavior; + + /// Constraints on the size of the bottom sheet. + final StacBoxConstraints? constraints; + + /// Creates a [StacBottomSheetThemeData] from JSON. + factory StacBottomSheetThemeData.fromJson(Map json) => + _$StacBottomSheetThemeDataFromJson(json); + + /// Converts this bottom sheet theme to JSON. + @override + Map toJson() => _$StacBottomSheetThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_bottom_sheet_theme_data/stac_bottom_sheet_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_bottom_sheet_theme_data/stac_bottom_sheet_theme_data.g.dart new file mode 100644 index 000000000..e4e817de4 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_bottom_sheet_theme_data/stac_bottom_sheet_theme_data.g.dart @@ -0,0 +1,58 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_bottom_sheet_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacBottomSheetThemeData _$StacBottomSheetThemeDataFromJson( + Map json, +) => StacBottomSheetThemeData( + backgroundColor: json['backgroundColor'] as String?, + surfaceTintColor: json['surfaceTintColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + modalBackgroundColor: json['modalBackgroundColor'] as String?, + modalBarrierColor: json['modalBarrierColor'] as String?, + shadowColor: json['shadowColor'] as String?, + modalElevation: (json['modalElevation'] as num?)?.toDouble(), + shape: json['shape'] == null + ? null + : StacBorder.fromJson(json['shape'] as Map), + showDragHandle: json['showDragHandle'] as bool?, + dragHandleColor: json['dragHandleColor'] as String?, + dragHandleSize: json['dragHandleSize'] == null + ? null + : StacSize.fromJson(json['dragHandleSize'] as Map), + clipBehavior: $enumDecodeNullable(_$StacClipEnumMap, json['clipBehavior']), + constraints: json['constraints'] == null + ? null + : StacBoxConstraints.fromJson( + json['constraints'] as Map, + ), +); + +Map _$StacBottomSheetThemeDataToJson( + StacBottomSheetThemeData instance, +) => { + 'backgroundColor': instance.backgroundColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'elevation': instance.elevation, + 'modalBackgroundColor': instance.modalBackgroundColor, + 'modalBarrierColor': instance.modalBarrierColor, + 'shadowColor': instance.shadowColor, + 'modalElevation': instance.modalElevation, + 'shape': instance.shape?.toJson(), + 'showDragHandle': instance.showDragHandle, + 'dragHandleColor': instance.dragHandleColor, + 'dragHandleSize': instance.dragHandleSize?.toJson(), + 'clipBehavior': _$StacClipEnumMap[instance.clipBehavior], + 'constraints': instance.constraints?.toJson(), +}; + +const _$StacClipEnumMap = { + StacClip.none: 'none', + StacClip.hardEdge: 'hardEdge', + StacClip.antiAlias: 'antiAlias', + StacClip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_button_theme_data/stac_button_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_button_theme_data/stac_button_theme_data.dart new file mode 100644 index 000000000..32208c543 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_button_theme_data/stac_button_theme_data.dart @@ -0,0 +1,140 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/stac_core.dart'; + +part 'stac_button_theme_data.g.dart'; + +/// Button text theme options. +/// +/// Defines how button text colors are determined. +enum StacButtonTextTheme { + /// Button text is black or white depending on the theme brightness. + normal, + + /// Button text uses the secondary color from the color scheme. + accent, + + /// Button text is based on the primary color. + primary, +} + +/// Button bar layout behavior options. +/// +/// Defines how button bars are laid out. +enum StacButtonBarLayoutBehavior { + /// Button bars will be constrained to a minimum height of 52. + /// + /// This setting is required to create button bars which conform to the + /// Material Design specification. + constrained, + + /// Button bars will be padded. + /// + /// This is the default behavior. + padded, +} + +/// A Stac model representing Flutter's [ButtonThemeData]. +/// +/// Defines the theme for Material buttons, including colors, dimensions, shapes, +/// and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacButtonThemeData( +/// minWidth: 88.0, +/// height: 36.0, +/// buttonColor: '#2196F3', +/// textTheme: StacButtonTextTheme.primary, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "minWidth": 88.0, +/// "height": 36.0, +/// "buttonColor": "#2196F3", +/// "disabledColor": "#BDBDBD", +/// "textTheme": "primary", +/// "layoutBehavior": "padded", +/// "alignedDropdown": false +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacButtonThemeData implements StacElement { + /// Creates a [StacButtonThemeData] with the given properties. + const StacButtonThemeData({ + this.textTheme, + this.minWidth, + this.height, + this.padding, + this.shape, + this.layoutBehavior, + this.alignedDropdown, + this.buttonColor, + this.disabledColor, + this.focusColor, + this.hoverColor, + this.highlightColor, + this.splashColor, + this.colorScheme, + this.materialTapTargetSize, + }); + + /// The text theme for button labels. + final StacButtonTextTheme? textTheme; + + /// The minimum width of the button. + final double? minWidth; + + /// The height of the button. + final double? height; + + /// The internal padding for the button's content. + final StacEdgeInsets? padding; + + /// The shape of the button's border. + final StacShapeBorder? shape; + + /// The layout behavior for button bars. + final StacButtonBarLayoutBehavior? layoutBehavior; + + /// Whether dropdown buttons should be aligned. + final bool? alignedDropdown; + + /// The default background color for buttons. + final String? buttonColor; + + /// The color to use for disabled buttons. + final String? disabledColor; + + /// The color to use when the button has input focus. + final String? focusColor; + + /// The color to use when the button is being hovered over. + final String? hoverColor; + + /// The highlight color for the button. + final String? highlightColor; + + /// The splash color for the button. + final String? splashColor; + + /// The color scheme to use for buttons. + final StacColorScheme? colorScheme; + + /// The minimum size of the tap target. + final StacMaterialTapTargetSize? materialTapTargetSize; + + /// Creates a [StacButtonThemeData] from JSON. + factory StacButtonThemeData.fromJson(Map json) => + _$StacButtonThemeDataFromJson(json); + + /// Converts this button theme to JSON. + @override + Map toJson() => _$StacButtonThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_button_theme_data/stac_button_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_button_theme_data/stac_button_theme_data.g.dart new file mode 100644 index 000000000..df5713b24 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_button_theme_data/stac_button_theme_data.g.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_button_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacButtonThemeData _$StacButtonThemeDataFromJson(Map json) => + StacButtonThemeData( + textTheme: $enumDecodeNullable( + _$StacButtonTextThemeEnumMap, + json['textTheme'], + ), + minWidth: (json['minWidth'] as num?)?.toDouble(), + height: (json['height'] as num?)?.toDouble(), + padding: json['padding'] == null + ? null + : StacEdgeInsets.fromJson(json['padding']), + shape: json['shape'] == null + ? null + : StacShapeBorder.fromJson(json['shape'] as Map), + layoutBehavior: $enumDecodeNullable( + _$StacButtonBarLayoutBehaviorEnumMap, + json['layoutBehavior'], + ), + alignedDropdown: json['alignedDropdown'] as bool?, + buttonColor: json['buttonColor'] as String?, + disabledColor: json['disabledColor'] as String?, + focusColor: json['focusColor'] as String?, + hoverColor: json['hoverColor'] as String?, + highlightColor: json['highlightColor'] as String?, + splashColor: json['splashColor'] as String?, + colorScheme: json['colorScheme'] == null + ? null + : StacColorScheme.fromJson( + json['colorScheme'] as Map, + ), + materialTapTargetSize: $enumDecodeNullable( + _$StacMaterialTapTargetSizeEnumMap, + json['materialTapTargetSize'], + ), + ); + +Map _$StacButtonThemeDataToJson( + StacButtonThemeData instance, +) => { + 'textTheme': _$StacButtonTextThemeEnumMap[instance.textTheme], + 'minWidth': instance.minWidth, + 'height': instance.height, + 'padding': instance.padding?.toJson(), + 'shape': instance.shape?.toJson(), + 'layoutBehavior': + _$StacButtonBarLayoutBehaviorEnumMap[instance.layoutBehavior], + 'alignedDropdown': instance.alignedDropdown, + 'buttonColor': instance.buttonColor, + 'disabledColor': instance.disabledColor, + 'focusColor': instance.focusColor, + 'hoverColor': instance.hoverColor, + 'highlightColor': instance.highlightColor, + 'splashColor': instance.splashColor, + 'colorScheme': instance.colorScheme?.toJson(), + 'materialTapTargetSize': + _$StacMaterialTapTargetSizeEnumMap[instance.materialTapTargetSize], +}; + +const _$StacButtonTextThemeEnumMap = { + StacButtonTextTheme.normal: 'normal', + StacButtonTextTheme.accent: 'accent', + StacButtonTextTheme.primary: 'primary', +}; + +const _$StacButtonBarLayoutBehaviorEnumMap = { + StacButtonBarLayoutBehavior.constrained: 'constrained', + StacButtonBarLayoutBehavior.padded: 'padded', +}; + +const _$StacMaterialTapTargetSizeEnumMap = { + StacMaterialTapTargetSize.padded: 'padded', + StacMaterialTapTargetSize.shrinkWrap: 'shrinkWrap', +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_card_theme_data/stac_card_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_card_theme_data/stac_card_theme_data.dart new file mode 100644 index 000000000..7141c9ee0 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_card_theme_data/stac_card_theme_data.dart @@ -0,0 +1,79 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/layout/stac_clip.dart'; + +part 'stac_card_theme_data.g.dart'; + +/// A Stac model representing Flutter's [CardThemeData]. +/// +/// Defines the theme for cards, including colors, elevation, shape, and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacCardThemeData( +/// color: '#FFFFFF', +/// elevation: 2.0, +/// shadowColor: '#000000', +/// shape: StacBorder(...), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#FFFFFF", +/// "elevation": 2.0, +/// "shadowColor": "#000000", +/// "surfaceTintColor": "#000000", +/// "clipBehavior": "antiAlias", +/// "margin": {"all": 8.0} +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacCardThemeData implements StacElement { + /// Creates a [StacCardThemeData] with the given properties. + const StacCardThemeData({ + this.clipBehavior, + this.color, + this.shadowColor, + this.surfaceTintColor, + this.elevation, + this.margin, + this.shape, + }); + + /// How to clip the card's content. + final StacClip? clipBehavior; + + /// The background color of the card. + final String? color; + + /// The color of the card's shadow. + final String? shadowColor; + + /// The color used to tint the surface of this card. + final String? surfaceTintColor; + + /// The z-coordinate at which to place this card relative to its parent. + final double? elevation; + + /// Empty space to surround the card. + final StacEdgeInsets? margin; + + /// The shape of the card's [Material]. + final StacBorder? shape; + + /// Creates a [StacCardThemeData] from JSON. + factory StacCardThemeData.fromJson(Map json) => + _$StacCardThemeDataFromJson(json); + + /// Converts this card theme to JSON. + @override + Map toJson() => _$StacCardThemeDataToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_card_theme_data/stac_card_theme_data.g.dart similarity index 59% rename from packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.g.dart rename to packages/stac_core/lib/foundation/theme/stac_card_theme_data/stac_card_theme_data.g.dart index 87408233e..0f1be32e6 100644 --- a/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_card_theme_data/stac_card_theme_data.g.dart @@ -6,9 +6,12 @@ part of 'stac_card_theme_data.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacCardThemeData _$StacCardThemeDataFromJson(Map json) => - _StacCardThemeData( - clipBehavior: $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']), +StacCardThemeData _$StacCardThemeDataFromJson(Map json) => + StacCardThemeData( + clipBehavior: $enumDecodeNullable( + _$StacClipEnumMap, + json['clipBehavior'], + ), color: json['color'] as String?, shadowColor: json['shadowColor'] as String?, surfaceTintColor: json['surfaceTintColor'] as String?, @@ -21,20 +24,20 @@ _StacCardThemeData _$StacCardThemeDataFromJson(Map json) => : StacBorder.fromJson(json['shape'] as Map), ); -Map _$StacCardThemeDataToJson(_StacCardThemeData instance) => +Map _$StacCardThemeDataToJson(StacCardThemeData instance) => { - 'clipBehavior': _$ClipEnumMap[instance.clipBehavior], + 'clipBehavior': _$StacClipEnumMap[instance.clipBehavior], 'color': instance.color, 'shadowColor': instance.shadowColor, 'surfaceTintColor': instance.surfaceTintColor, 'elevation': instance.elevation, - 'margin': instance.margin, - 'shape': instance.shape, + 'margin': instance.margin?.toJson(), + 'shape': instance.shape?.toJson(), }; -const _$ClipEnumMap = { - Clip.none: 'none', - Clip.hardEdge: 'hardEdge', - Clip.antiAlias: 'antiAlias', - Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', +const _$StacClipEnumMap = { + StacClip.none: 'none', + StacClip.hardEdge: 'hardEdge', + StacClip.antiAlias: 'antiAlias', + StacClip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', }; diff --git a/packages/stac_core/lib/foundation/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart new file mode 100644 index 000000000..a0afc8948 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart @@ -0,0 +1,88 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/geometry/stac_visual_density/stac_visual_density.dart'; +import 'package:stac_core/foundation/interaction/stac_mouse_cursor.dart'; +import 'package:stac_core/foundation/theme/stac_button_style/stac_button_style.dart'; + +part 'stac_checkbox_theme_data.g.dart'; + +/// A Stac model representing Flutter's [CheckboxThemeData]. +/// +/// Defines the theme for checkboxes, including colors, shape, size, and interaction properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacCheckboxThemeData( +/// fillColor: '#2196F3', +/// checkColor: '#FFFFFF', +/// shape: StacRoundedRectangleBorder(...), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "fillColor": "#2196F3", +/// "checkColor": "#FFFFFF", +/// "overlayColor": "#E3F2FD", +/// "splashRadius": 20.0, +/// "materialTapTargetSize": "padded", +/// "visualDensity": "standard" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacCheckboxThemeData implements StacElement { + /// Creates a [StacCheckboxThemeData] with the given properties. + const StacCheckboxThemeData({ + this.mouseCursor, + this.fillColor, + this.checkColor, + this.overlayColor, + this.splashRadius, + this.materialTapTargetSize, + this.visualDensity, + this.shape, + this.side, + }); + + /// The mouse cursor to use when hovering over the checkbox. + final StacMouseCursor? mouseCursor; + + /// The color to fill the checkbox with. + final String? fillColor; + + /// The color of the check icon. + final String? checkColor; + + /// The color of the overlay shown when the checkbox is pressed. + final String? overlayColor; + + /// The radius of the splash effect. + final double? splashRadius; + + /// The minimum size of the tap target. + final StacMaterialTapTargetSize? materialTapTargetSize; + + /// The visual density of the checkbox. + final StacVisualDensity? visualDensity; + + /// The shape of the checkbox's border. + final StacShapeBorder? shape; + + /// The border side of the checkbox. + final StacBorderSide? side; + + /// Creates a [StacCheckboxThemeData] from JSON. + factory StacCheckboxThemeData.fromJson(Map json) => + _$StacCheckboxThemeDataFromJson(json); + + /// Converts this checkbox theme to JSON. + @override + Map toJson() => _$StacCheckboxThemeDataToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart similarity index 53% rename from packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart rename to packages/stac_core/lib/foundation/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart index dd0cdf0e7..8d4c11cdb 100644 --- a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart @@ -6,43 +6,48 @@ part of 'stac_checkbox_theme_data.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacCheckboxThemeData _$StacCheckboxThemeDataFromJson( - Map json) => - _StacCheckboxThemeData( - mouseCursor: - $enumDecodeNullable(_$StacMouseCursorEnumMap, json['mouseCursor']), - fillColor: json['fillColor'] as String?, - checkColor: json['checkColor'] as String?, - overlayColor: json['overlayColor'] as String?, - splashRadius: (json['splashRadius'] as num?)?.toDouble(), - materialTapTargetSize: $enumDecodeNullable( - _$MaterialTapTargetSizeEnumMap, json['materialTapTargetSize']), - visualDensity: json['visualDensity'] == null - ? null - : StacVisualDensity.fromJson( - json['visualDensity'] as Map), - shape: json['shape'] == null - ? null - : StacShapeBorder.fromJson(json['shape'] as Map), - side: json['side'] == null - ? null - : StacBorderSide.fromJson(json['side'] as Map), - ); +StacCheckboxThemeData _$StacCheckboxThemeDataFromJson( + Map json, +) => StacCheckboxThemeData( + mouseCursor: $enumDecodeNullable( + _$StacMouseCursorEnumMap, + json['mouseCursor'], + ), + fillColor: json['fillColor'] as String?, + checkColor: json['checkColor'] as String?, + overlayColor: json['overlayColor'] as String?, + splashRadius: (json['splashRadius'] as num?)?.toDouble(), + materialTapTargetSize: $enumDecodeNullable( + _$StacMaterialTapTargetSizeEnumMap, + json['materialTapTargetSize'], + ), + visualDensity: json['visualDensity'] == null + ? null + : StacVisualDensity.fromJson( + json['visualDensity'] as Map, + ), + shape: json['shape'] == null + ? null + : StacShapeBorder.fromJson(json['shape'] as Map), + side: json['side'] == null + ? null + : StacBorderSide.fromJson(json['side'] as Map), +); Map _$StacCheckboxThemeDataToJson( - _StacCheckboxThemeData instance) => - { - 'mouseCursor': _$StacMouseCursorEnumMap[instance.mouseCursor], - 'fillColor': instance.fillColor, - 'checkColor': instance.checkColor, - 'overlayColor': instance.overlayColor, - 'splashRadius': instance.splashRadius, - 'materialTapTargetSize': - _$MaterialTapTargetSizeEnumMap[instance.materialTapTargetSize], - 'visualDensity': instance.visualDensity, - 'shape': instance.shape, - 'side': instance.side, - }; + StacCheckboxThemeData instance, +) => { + 'mouseCursor': _$StacMouseCursorEnumMap[instance.mouseCursor], + 'fillColor': instance.fillColor, + 'checkColor': instance.checkColor, + 'overlayColor': instance.overlayColor, + 'splashRadius': instance.splashRadius, + 'materialTapTargetSize': + _$StacMaterialTapTargetSizeEnumMap[instance.materialTapTargetSize], + 'visualDensity': instance.visualDensity?.toJson(), + 'shape': instance.shape?.toJson(), + 'side': instance.side?.toJson(), +}; const _$StacMouseCursorEnumMap = { StacMouseCursor.none: 'none', @@ -83,7 +88,7 @@ const _$StacMouseCursorEnumMap = { StacMouseCursor.zoomOut: 'zoomOut', }; -const _$MaterialTapTargetSizeEnumMap = { - MaterialTapTargetSize.padded: 'padded', - MaterialTapTargetSize.shrinkWrap: 'shrinkWrap', +const _$StacMaterialTapTargetSizeEnumMap = { + StacMaterialTapTargetSize.padded: 'padded', + StacMaterialTapTargetSize.shrinkWrap: 'shrinkWrap', }; diff --git a/packages/stac_core/lib/foundation/theme/stac_chip_theme_data/stac_chip_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_chip_theme_data/stac_chip_theme_data.dart new file mode 100644 index 000000000..7377364d4 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_chip_theme_data/stac_chip_theme_data.dart @@ -0,0 +1,147 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/colors/stac_brightness.dart'; +import 'package:stac_core/foundation/geometry/stac_box_constraints/stac_box_constraints.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'; +import 'package:stac_core/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; + +part 'stac_chip_theme_data.g.dart'; + +/// A Stac model representing Flutter's [ChipThemeData]. +/// +/// Defines the theme for chips, including colors, elevation, shape, text styles, +/// icon themes, and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacChipThemeData( +/// backgroundColor: '#E3F2FD', +/// labelStyle: StacTextStyle(color: '#1976D2'), +/// elevation: 0.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#E3F2FD", +/// "labelStyle": {"color": "#1976D2"}, +/// "elevation": 0.0, +/// "pressElevation": 2.0, +/// "showCheckmark": true, +/// "checkmarkColor": "#1976D2" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacChipThemeData implements StacElement { + /// Creates a [StacChipThemeData] with the given properties. + const StacChipThemeData({ + this.color, + this.backgroundColor, + this.deleteIconColor, + this.disabledColor, + this.selectedColor, + this.secondarySelectedColor, + this.shadowColor, + this.surfaceTintColor, + this.selectedShadowColor, + this.showCheckmark, + this.checkmarkColor, + this.labelPadding, + this.padding, + this.side, + this.shape, + this.labelStyle, + this.secondaryLabelStyle, + this.brightness, + this.elevation, + this.pressElevation, + this.iconTheme, + this.avatarBoxConstraints, + this.deleteIconBoxConstraints, + }); + + /// The default color for chip content. + final String? color; + + /// The background color of the chip. + final String? backgroundColor; + + /// The color of the delete icon. + final String? deleteIconColor; + + /// The color to use for disabled chips. + final String? disabledColor; + + /// The color to use for selected chips. + final String? selectedColor; + + /// The color to use for secondary selected chips. + final String? secondarySelectedColor; + + /// The color of the chip's shadow. + final String? shadowColor; + + /// The color used to tint the surface of this chip. + final String? surfaceTintColor; + + /// The color of the shadow for selected chips. + final String? selectedShadowColor; + + /// Whether to show a checkmark for selected chips. + final bool? showCheckmark; + + /// The color of the checkmark. + final String? checkmarkColor; + + /// The padding around the chip's label. + final StacEdgeInsets? labelPadding; + + /// The internal padding for the chip's content. + final StacEdgeInsets? padding; + + /// The border side of the chip. + final StacBorderSide? side; + + /// The shape of the chip's border. + final StacShapeBorder? shape; + + /// The text style for the chip's label. + final StacTextStyle? labelStyle; + + /// The text style for secondary chip labels. + final StacTextStyle? secondaryLabelStyle; + + /// The brightness of the chip theme. + final StacBrightness? brightness; + + /// The z-coordinate at which to place this chip relative to its parent. + final double? elevation; + + /// The z-coordinate at which to place this chip when pressed. + final double? pressElevation; + + /// The icon theme for chip icons. + final StacIconThemeData? iconTheme; + + /// Constraints on the size of chip avatars. + final StacBoxConstraints? avatarBoxConstraints; + + /// Constraints on the size of the delete icon. + final StacBoxConstraints? deleteIconBoxConstraints; + + /// Creates a [StacChipThemeData] from JSON. + factory StacChipThemeData.fromJson(Map json) => + _$StacChipThemeDataFromJson(json); + + /// Converts this chip theme to JSON. + @override + Map toJson() => _$StacChipThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_chip_theme_data/stac_chip_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_chip_theme_data/stac_chip_theme_data.g.dart new file mode 100644 index 000000000..e388b6276 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_chip_theme_data/stac_chip_theme_data.g.dart @@ -0,0 +1,90 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_chip_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacChipThemeData _$StacChipThemeDataFromJson( + Map json, +) => StacChipThemeData( + color: json['color'] as String?, + backgroundColor: json['backgroundColor'] as String?, + deleteIconColor: json['deleteIconColor'] as String?, + disabledColor: json['disabledColor'] as String?, + selectedColor: json['selectedColor'] as String?, + secondarySelectedColor: json['secondarySelectedColor'] as String?, + shadowColor: json['shadowColor'] as String?, + surfaceTintColor: json['surfaceTintColor'] as String?, + selectedShadowColor: json['selectedShadowColor'] as String?, + showCheckmark: json['showCheckmark'] as bool?, + checkmarkColor: json['checkmarkColor'] as String?, + labelPadding: json['labelPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['labelPadding']), + padding: json['padding'] == null + ? null + : StacEdgeInsets.fromJson(json['padding']), + side: json['side'] == null + ? null + : StacBorderSide.fromJson(json['side'] as Map), + shape: json['shape'] == null + ? null + : StacShapeBorder.fromJson(json['shape'] as Map), + labelStyle: json['labelStyle'] == null + ? null + : StacTextStyle.fromJson(json['labelStyle']), + secondaryLabelStyle: json['secondaryLabelStyle'] == null + ? null + : StacTextStyle.fromJson(json['secondaryLabelStyle']), + brightness: $enumDecodeNullable(_$StacBrightnessEnumMap, json['brightness']), + elevation: (json['elevation'] as num?)?.toDouble(), + pressElevation: (json['pressElevation'] as num?)?.toDouble(), + iconTheme: json['iconTheme'] == null + ? null + : StacIconThemeData.fromJson(json['iconTheme'] as Map), + avatarBoxConstraints: json['avatarBoxConstraints'] == null + ? null + : StacBoxConstraints.fromJson( + json['avatarBoxConstraints'] as Map, + ), + deleteIconBoxConstraints: json['deleteIconBoxConstraints'] == null + ? null + : StacBoxConstraints.fromJson( + json['deleteIconBoxConstraints'] as Map, + ), +); + +Map _$StacChipThemeDataToJson(StacChipThemeData instance) => + { + 'color': instance.color, + 'backgroundColor': instance.backgroundColor, + 'deleteIconColor': instance.deleteIconColor, + 'disabledColor': instance.disabledColor, + 'selectedColor': instance.selectedColor, + 'secondarySelectedColor': instance.secondarySelectedColor, + 'shadowColor': instance.shadowColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'selectedShadowColor': instance.selectedShadowColor, + 'showCheckmark': instance.showCheckmark, + 'checkmarkColor': instance.checkmarkColor, + 'labelPadding': instance.labelPadding?.toJson(), + 'padding': instance.padding?.toJson(), + 'side': instance.side?.toJson(), + 'shape': instance.shape?.toJson(), + 'labelStyle': instance.labelStyle?.toJson(), + 'secondaryLabelStyle': instance.secondaryLabelStyle?.toJson(), + 'brightness': _$StacBrightnessEnumMap[instance.brightness], + 'elevation': instance.elevation, + 'pressElevation': instance.pressElevation, + 'iconTheme': instance.iconTheme?.toJson(), + 'avatarBoxConstraints': instance.avatarBoxConstraints?.toJson(), + 'deleteIconBoxConstraints': instance.deleteIconBoxConstraints?.toJson(), + }; + +const _$StacBrightnessEnumMap = { + StacBrightness.light: 'light', + StacBrightness.dark: 'dark', + StacBrightness.system: 'system', +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_color_scheme/stac_color_scheme.dart b/packages/stac_core/lib/foundation/theme/stac_color_scheme/stac_color_scheme.dart new file mode 100644 index 000000000..4d926376c --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_color_scheme/stac_color_scheme.dart @@ -0,0 +1,246 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/colors/stac_brightness.dart'; + +part 'stac_color_scheme.g.dart'; + +/// A Stac model representing Flutter's [ColorScheme]. +/// +/// Defines the color scheme for the application theme, including primary, +/// secondary, tertiary, error, surface, and outline colors with their variants. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacColorScheme( +/// brightness: Brightness.light, +/// primary: '#2196F3', +/// onPrimary: '#FFFFFF', +/// secondary: '#03DAC6', +/// onSecondary: '#000000', +/// error: '#B00020', +/// onError: '#FFFFFF', +/// surface: '#FFFFFF', +/// onSurface: '#000000', +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "brightness": "light", +/// "primary": "#2196F3", +/// "onPrimary": "#FFFFFF", +/// "secondary": "#03DAC6", +/// "onSecondary": "#000000", +/// "error": "#B00020", +/// "onError": "#FFFFFF", +/// "surface": "#FFFFFF", +/// "onSurface": "#000000" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacColorScheme implements StacElement { + /// Creates a [StacColorScheme] with the given properties. + const StacColorScheme({ + required this.brightness, + required this.primary, + required this.onPrimary, + this.primaryContainer, + this.onPrimaryContainer, + this.primaryFixed, + this.primaryFixedDim, + this.onPrimaryFixed, + this.onPrimaryFixedVariant, + required this.secondary, + required this.onSecondary, + this.secondaryContainer, + this.onSecondaryContainer, + this.secondaryFixed, + this.secondaryFixedDim, + this.onSecondaryFixed, + this.onSecondaryFixedVariant, + this.tertiary, + this.onTertiary, + this.tertiaryContainer, + this.onTertiaryContainer, + this.tertiaryFixed, + this.tertiaryFixedDim, + this.onTertiaryFixed, + this.onTertiaryFixedVariant, + required this.error, + required this.onError, + this.errorContainer, + this.onErrorContainer, + required this.surface, + required this.onSurface, + this.surfaceDim, + this.surfaceBright, + this.surfaceContainerLowest, + this.surfaceContainerLow, + this.surfaceContainer, + this.surfaceContainerHigh, + this.surfaceContainerHighest, + this.onSurfaceVariant, + this.outline, + this.outlineVariant, + this.shadow, + this.scrim, + this.inverseSurface, + this.onInverseSurface, + this.inversePrimary, + this.surfaceTint, + }); + + /// The brightness of the color scheme (light or dark). + final StacBrightness brightness; + + /// The primary color of the theme. + final String primary; + + /// The color to use for content on top of the primary color. + final String onPrimary; + + /// The container color for primary content. + final String? primaryContainer; + + /// The color to use for content on top of the primary container. + final String? onPrimaryContainer; + + /// The fixed primary color. + final String? primaryFixed; + + /// The dimmed fixed primary color. + final String? primaryFixedDim; + + /// The color to use for content on top of the fixed primary color. + final String? onPrimaryFixed; + + /// The color to use for content on top of the fixed primary variant. + final String? onPrimaryFixedVariant; + + /// The secondary color of the theme. + final String secondary; + + /// The color to use for content on top of the secondary color. + final String onSecondary; + + /// The container color for secondary content. + final String? secondaryContainer; + + /// The color to use for content on top of the secondary container. + final String? onSecondaryContainer; + + /// The fixed secondary color. + final String? secondaryFixed; + + /// The dimmed fixed secondary color. + final String? secondaryFixedDim; + + /// The color to use for content on top of the fixed secondary color. + final String? onSecondaryFixed; + + /// The color to use for content on top of the fixed secondary variant. + final String? onSecondaryFixedVariant; + + /// The tertiary color of the theme. + final String? tertiary; + + /// The color to use for content on top of the tertiary color. + final String? onTertiary; + + /// The container color for tertiary content. + final String? tertiaryContainer; + + /// The color to use for content on top of the tertiary container. + final String? onTertiaryContainer; + + /// The fixed tertiary color. + final String? tertiaryFixed; + + /// The dimmed fixed tertiary color. + final String? tertiaryFixedDim; + + /// The color to use for content on top of the fixed tertiary color. + final String? onTertiaryFixed; + + /// The color to use for content on top of the fixed tertiary variant. + final String? onTertiaryFixedVariant; + + /// The error color of the theme. + final String error; + + /// The color to use for content on top of the error color. + final String onError; + + /// The container color for error content. + final String? errorContainer; + + /// The color to use for content on top of the error container. + final String? onErrorContainer; + + /// The surface color of the theme. + final String surface; + + /// The color to use for content on top of the surface color. + final String onSurface; + + /// A dimmed version of the surface color. + final String? surfaceDim; + + /// A bright version of the surface color. + final String? surfaceBright; + + /// The lowest surface container color. + final String? surfaceContainerLowest; + + /// A low surface container color. + final String? surfaceContainerLow; + + /// The standard surface container color. + final String? surfaceContainer; + + /// A high surface container color. + final String? surfaceContainerHigh; + + /// The highest surface container color. + final String? surfaceContainerHighest; + + /// The color to use for variant content on top of the surface. + final String? onSurfaceVariant; + + /// The outline color. + final String? outline; + + /// The variant outline color. + final String? outlineVariant; + + /// The shadow color. + final String? shadow; + + /// The scrim color. + final String? scrim; + + /// The inverse surface color. + final String? inverseSurface; + + /// The color to use for content on top of the inverse surface. + final String? onInverseSurface; + + /// The inverse primary color. + final String? inversePrimary; + + /// The surface tint color. + final String? surfaceTint; + + /// Creates a [StacColorScheme] from JSON. + factory StacColorScheme.fromJson(Map json) => + _$StacColorSchemeFromJson(json); + + /// Converts this color scheme to JSON. + @override + Map toJson() => _$StacColorSchemeToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.g.dart b/packages/stac_core/lib/foundation/theme/stac_color_scheme/stac_color_scheme.g.dart similarity index 92% rename from packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.g.dart rename to packages/stac_core/lib/foundation/theme/stac_color_scheme/stac_color_scheme.g.dart index 71f2616d6..f128117e3 100644 --- a/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_color_scheme/stac_color_scheme.g.dart @@ -6,9 +6,9 @@ part of 'stac_color_scheme.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacColorScheme _$StacColorSchemeFromJson(Map json) => - _StacColorScheme( - brightness: $enumDecode(_$BrightnessEnumMap, json['brightness']), +StacColorScheme _$StacColorSchemeFromJson(Map json) => + StacColorScheme( + brightness: $enumDecode(_$StacBrightnessEnumMap, json['brightness']), primary: json['primary'] as String, onPrimary: json['onPrimary'] as String, primaryContainer: json['primaryContainer'] as String?, @@ -57,9 +57,9 @@ _StacColorScheme _$StacColorSchemeFromJson(Map json) => surfaceTint: json['surfaceTint'] as String?, ); -Map _$StacColorSchemeToJson(_StacColorScheme instance) => +Map _$StacColorSchemeToJson(StacColorScheme instance) => { - 'brightness': _$BrightnessEnumMap[instance.brightness]!, + 'brightness': _$StacBrightnessEnumMap[instance.brightness]!, 'primary': instance.primary, 'onPrimary': instance.onPrimary, 'primaryContainer': instance.primaryContainer, @@ -108,7 +108,8 @@ Map _$StacColorSchemeToJson(_StacColorScheme instance) => 'surfaceTint': instance.surfaceTint, }; -const _$BrightnessEnumMap = { - Brightness.dark: 'dark', - Brightness.light: 'light', +const _$StacBrightnessEnumMap = { + StacBrightness.light: 'light', + StacBrightness.dark: 'dark', + StacBrightness.system: 'system', }; diff --git a/packages/stac_core/lib/foundation/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart new file mode 100644 index 000000000..ef572967a --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart @@ -0,0 +1,200 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/foundation/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_core/foundation/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; + +part 'stac_date_picker_theme_data.g.dart'; + +/// A Stac model representing Flutter's [DatePickerThemeData]. +/// +/// Defines the theme for date pickers, including colors, elevation, shapes, +/// text styles for headers, days, years, and range picker properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacDatePickerThemeData( +/// backgroundColor: '#FFFFFF', +/// elevation: 24.0, +/// headerBackgroundColor: '#2196F3', +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 24.0, +/// "shadowColor": "#000000", +/// "headerBackgroundColor": "#2196F3", +/// "headerForegroundColor": "#FFFFFF" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacDatePickerThemeData implements StacElement { + /// Creates a [StacDatePickerThemeData] with the given properties. + const StacDatePickerThemeData({ + this.backgroundColor, + this.elevation, + this.shadowColor, + this.surfaceTintColor, + this.shape, + this.headerBackgroundColor, + this.headerForegroundColor, + this.headerHeadlineStyle, + this.headerHelpStyle, + this.weekdayStyle, + this.dayStyle, + this.dayForegroundColor, + this.dayBackgroundColor, + this.dayOverlayColor, + this.dayShape, + this.todayForegroundColor, + this.todayBackgroundColor, + this.todayBorder, + this.yearStyle, + this.yearForegroundColor, + this.yearBackgroundColor, + this.yearOverlayColor, + this.rangePickerBackgroundColor, + this.rangePickerElevation, + this.rangePickerShadowColor, + this.rangePickerSurfaceTintColor, + this.rangePickerShape, + this.rangePickerHeaderBackgroundColor, + this.rangePickerHeaderForegroundColor, + this.rangePickerHeaderHeadlineStyle, + this.rangePickerHeaderHelpStyle, + this.rangeSelectionBackgroundColor, + this.rangeSelectionOverlayColor, + this.dividerColor, + this.inputDecorationTheme, + this.cancelButtonStyle, + this.confirmButtonStyle, + }); + + /// The background color of the date picker. + final String? backgroundColor; + + /// The z-coordinate at which to place this date picker relative to its parent. + final double? elevation; + + /// The color of the shadow below the date picker. + final String? shadowColor; + + /// The color used to tint the surface of this date picker. + final String? surfaceTintColor; + + /// The shape of the date picker's border. + final StacShapeBorder? shape; + + /// The background color of the date picker header. + final String? headerBackgroundColor; + + /// The foreground color of the date picker header. + final String? headerForegroundColor; + + /// The text style for the date picker header headline. + final StacTextStyle? headerHeadlineStyle; + + /// The text style for the date picker header help text. + final StacTextStyle? headerHelpStyle; + + /// The text style for weekday labels. + final StacTextStyle? weekdayStyle; + + /// The text style for day labels. + final StacTextStyle? dayStyle; + + /// The foreground color for day cells. + final String? dayForegroundColor; + + /// The background color for day cells. + final String? dayBackgroundColor; + + /// The overlay color for day cells. + final String? dayOverlayColor; + + /// The shape of day cell borders. + final StacShapeBorder? dayShape; + + /// The foreground color for today's date. + final String? todayForegroundColor; + + /// The background color for today's date. + final String? todayBackgroundColor; + + /// The border for today's date. + final StacBorderSide? todayBorder; + + /// The text style for year labels. + final StacTextStyle? yearStyle; + + /// The foreground color for year cells. + final String? yearForegroundColor; + + /// The background color for year cells. + final String? yearBackgroundColor; + + /// The overlay color for year cells. + final String? yearOverlayColor; + + /// The background color of the range picker. + final String? rangePickerBackgroundColor; + + /// The z-coordinate at which to place the range picker. + final double? rangePickerElevation; + + /// The color of the shadow below the range picker. + final String? rangePickerShadowColor; + + /// The color used to tint the surface of the range picker. + final String? rangePickerSurfaceTintColor; + + /// The shape of the range picker's border. + final StacShapeBorder? rangePickerShape; + + /// The background color of the range picker header. + final String? rangePickerHeaderBackgroundColor; + + /// The foreground color of the range picker header. + final String? rangePickerHeaderForegroundColor; + + /// The text style for the range picker header headline. + final StacTextStyle? rangePickerHeaderHeadlineStyle; + + /// The text style for the range picker header help text. + final StacTextStyle? rangePickerHeaderHelpStyle; + + /// The background color for range selection. + final String? rangeSelectionBackgroundColor; + + /// The overlay color for range selection. + final String? rangeSelectionOverlayColor; + + /// The color of dividers in the date picker. + final String? dividerColor; + + /// The input decoration theme for date picker inputs. + final StacInputDecorationTheme? inputDecorationTheme; + + /// The button style for the cancel button. + final StacButtonStyle? cancelButtonStyle; + + /// The button style for the confirm button. + final StacButtonStyle? confirmButtonStyle; + + /// Creates a [StacDatePickerThemeData] from JSON. + factory StacDatePickerThemeData.fromJson(Map json) => + _$StacDatePickerThemeDataFromJson(json); + + /// Converts this date picker theme to JSON. + @override + Map toJson() => _$StacDatePickerThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.g.dart new file mode 100644 index 000000000..398d7a62d --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.g.dart @@ -0,0 +1,131 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_date_picker_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacDatePickerThemeData _$StacDatePickerThemeDataFromJson( + Map json, +) => StacDatePickerThemeData( + backgroundColor: json['backgroundColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + shadowColor: json['shadowColor'] as String?, + surfaceTintColor: json['surfaceTintColor'] as String?, + shape: json['shape'] == null + ? null + : StacShapeBorder.fromJson(json['shape'] as Map), + headerBackgroundColor: json['headerBackgroundColor'] as String?, + headerForegroundColor: json['headerForegroundColor'] as String?, + headerHeadlineStyle: json['headerHeadlineStyle'] == null + ? null + : StacTextStyle.fromJson(json['headerHeadlineStyle']), + headerHelpStyle: json['headerHelpStyle'] == null + ? null + : StacTextStyle.fromJson(json['headerHelpStyle']), + weekdayStyle: json['weekdayStyle'] == null + ? null + : StacTextStyle.fromJson(json['weekdayStyle']), + dayStyle: json['dayStyle'] == null + ? null + : StacTextStyle.fromJson(json['dayStyle']), + dayForegroundColor: json['dayForegroundColor'] as String?, + dayBackgroundColor: json['dayBackgroundColor'] as String?, + dayOverlayColor: json['dayOverlayColor'] as String?, + dayShape: json['dayShape'] == null + ? null + : StacShapeBorder.fromJson(json['dayShape'] as Map), + todayForegroundColor: json['todayForegroundColor'] as String?, + todayBackgroundColor: json['todayBackgroundColor'] as String?, + todayBorder: json['todayBorder'] == null + ? null + : StacBorderSide.fromJson(json['todayBorder'] as Map), + yearStyle: json['yearStyle'] == null + ? null + : StacTextStyle.fromJson(json['yearStyle']), + yearForegroundColor: json['yearForegroundColor'] as String?, + yearBackgroundColor: json['yearBackgroundColor'] as String?, + yearOverlayColor: json['yearOverlayColor'] as String?, + rangePickerBackgroundColor: json['rangePickerBackgroundColor'] as String?, + rangePickerElevation: (json['rangePickerElevation'] as num?)?.toDouble(), + rangePickerShadowColor: json['rangePickerShadowColor'] as String?, + rangePickerSurfaceTintColor: json['rangePickerSurfaceTintColor'] as String?, + rangePickerShape: json['rangePickerShape'] == null + ? null + : StacShapeBorder.fromJson( + json['rangePickerShape'] as Map, + ), + rangePickerHeaderBackgroundColor: + json['rangePickerHeaderBackgroundColor'] as String?, + rangePickerHeaderForegroundColor: + json['rangePickerHeaderForegroundColor'] as String?, + rangePickerHeaderHeadlineStyle: json['rangePickerHeaderHeadlineStyle'] == null + ? null + : StacTextStyle.fromJson(json['rangePickerHeaderHeadlineStyle']), + rangePickerHeaderHelpStyle: json['rangePickerHeaderHelpStyle'] == null + ? null + : StacTextStyle.fromJson(json['rangePickerHeaderHelpStyle']), + rangeSelectionBackgroundColor: + json['rangeSelectionBackgroundColor'] as String?, + rangeSelectionOverlayColor: json['rangeSelectionOverlayColor'] as String?, + dividerColor: json['dividerColor'] as String?, + inputDecorationTheme: json['inputDecorationTheme'] == null + ? null + : StacInputDecorationTheme.fromJson( + json['inputDecorationTheme'] as Map, + ), + cancelButtonStyle: json['cancelButtonStyle'] == null + ? null + : StacButtonStyle.fromJson( + json['cancelButtonStyle'] as Map, + ), + confirmButtonStyle: json['confirmButtonStyle'] == null + ? null + : StacButtonStyle.fromJson( + json['confirmButtonStyle'] as Map, + ), +); + +Map _$StacDatePickerThemeDataToJson( + StacDatePickerThemeData instance, +) => { + 'backgroundColor': instance.backgroundColor, + 'elevation': instance.elevation, + 'shadowColor': instance.shadowColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'shape': instance.shape?.toJson(), + 'headerBackgroundColor': instance.headerBackgroundColor, + 'headerForegroundColor': instance.headerForegroundColor, + 'headerHeadlineStyle': instance.headerHeadlineStyle?.toJson(), + 'headerHelpStyle': instance.headerHelpStyle?.toJson(), + 'weekdayStyle': instance.weekdayStyle?.toJson(), + 'dayStyle': instance.dayStyle?.toJson(), + 'dayForegroundColor': instance.dayForegroundColor, + 'dayBackgroundColor': instance.dayBackgroundColor, + 'dayOverlayColor': instance.dayOverlayColor, + 'dayShape': instance.dayShape?.toJson(), + 'todayForegroundColor': instance.todayForegroundColor, + 'todayBackgroundColor': instance.todayBackgroundColor, + 'todayBorder': instance.todayBorder?.toJson(), + 'yearStyle': instance.yearStyle?.toJson(), + 'yearForegroundColor': instance.yearForegroundColor, + 'yearBackgroundColor': instance.yearBackgroundColor, + 'yearOverlayColor': instance.yearOverlayColor, + 'rangePickerBackgroundColor': instance.rangePickerBackgroundColor, + 'rangePickerElevation': instance.rangePickerElevation, + 'rangePickerShadowColor': instance.rangePickerShadowColor, + 'rangePickerSurfaceTintColor': instance.rangePickerSurfaceTintColor, + 'rangePickerShape': instance.rangePickerShape?.toJson(), + 'rangePickerHeaderBackgroundColor': instance.rangePickerHeaderBackgroundColor, + 'rangePickerHeaderForegroundColor': instance.rangePickerHeaderForegroundColor, + 'rangePickerHeaderHeadlineStyle': instance.rangePickerHeaderHeadlineStyle + ?.toJson(), + 'rangePickerHeaderHelpStyle': instance.rangePickerHeaderHelpStyle?.toJson(), + 'rangeSelectionBackgroundColor': instance.rangeSelectionBackgroundColor, + 'rangeSelectionOverlayColor': instance.rangeSelectionOverlayColor, + 'dividerColor': instance.dividerColor, + 'inputDecorationTheme': instance.inputDecorationTheme?.toJson(), + 'cancelButtonStyle': instance.cancelButtonStyle?.toJson(), + 'confirmButtonStyle': instance.confirmButtonStyle?.toJson(), +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_dialog_theme/stac_dialog_theme.dart b/packages/stac_core/lib/foundation/theme/stac_dialog_theme/stac_dialog_theme.dart new file mode 100644 index 000000000..9388c04a0 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_dialog_theme/stac_dialog_theme.dart @@ -0,0 +1,92 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/alignment/stac_alignment_geometry/stac_alignment_geometry.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.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'; + +part 'stac_dialog_theme.g.dart'; + +/// A Stac model representing Flutter's [DialogTheme]. +/// +/// Defines the theme for dialogs, including colors, elevation, shape, alignment, +/// and text styles. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacDialogTheme( +/// backgroundColor: '#FFFFFF', +/// elevation: 24.0, +/// titleTextStyle: StacTextStyle(...), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 24.0, +/// "shadowColor": "#000000", +/// "surfaceTintColor": "#000000", +/// "alignment": {...}, +/// "iconColor": "#2196F3" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacDialogTheme implements StacElement { + /// Creates a [StacDialogTheme] with the given properties. + const StacDialogTheme({ + this.backgroundColor, + this.elevation, + this.shadowColor, + this.surfaceTintColor, + this.shape, + this.alignment, + this.titleTextStyle, + this.contentTextStyle, + this.actionsPadding, + this.iconColor, + }); + + /// The background color of the dialog. + final String? backgroundColor; + + /// The z-coordinate at which to place this dialog relative to its parent. + final double? elevation; + + /// The color of the shadow below the dialog. + final String? shadowColor; + + /// The color used to tint the surface of this dialog. + final String? surfaceTintColor; + + /// The shape of the dialog's border. + final StacBorder? shape; + + /// The alignment of the dialog. + final StacAlignmentGeometry? alignment; + + /// The text style for the dialog's title. + final StacTextStyle? titleTextStyle; + + /// The text style for the dialog's content. + final StacTextStyle? contentTextStyle; + + /// The padding around the dialog's action buttons. + final StacEdgeInsets? actionsPadding; + + /// The color of the dialog's icon. + final String? iconColor; + + /// Creates a [StacDialogTheme] from JSON. + factory StacDialogTheme.fromJson(Map json) => + _$StacDialogThemeFromJson(json); + + /// Converts this dialog theme to JSON. + @override + Map toJson() => _$StacDialogThemeToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.g.dart b/packages/stac_core/lib/foundation/theme/stac_dialog_theme/stac_dialog_theme.g.dart similarity index 73% rename from packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.g.dart rename to packages/stac_core/lib/foundation/theme/stac_dialog_theme/stac_dialog_theme.g.dart index f442db021..08fb34f93 100644 --- a/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_dialog_theme/stac_dialog_theme.g.dart @@ -6,8 +6,8 @@ part of 'stac_dialog_theme.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacDialogTheme _$StacDialogThemeFromJson(Map json) => - _StacDialogTheme( +StacDialogTheme _$StacDialogThemeFromJson(Map json) => + StacDialogTheme( backgroundColor: json['backgroundColor'] as String?, elevation: (json['elevation'] as num?)?.toDouble(), shadowColor: json['shadowColor'] as String?, @@ -18,7 +18,8 @@ _StacDialogTheme _$StacDialogThemeFromJson(Map json) => alignment: json['alignment'] == null ? null : StacAlignmentGeometry.fromJson( - json['alignment'] as Map), + json['alignment'] as Map, + ), titleTextStyle: json['titleTextStyle'] == null ? null : StacTextStyle.fromJson(json['titleTextStyle']), @@ -31,16 +32,16 @@ _StacDialogTheme _$StacDialogThemeFromJson(Map json) => iconColor: json['iconColor'] as String?, ); -Map _$StacDialogThemeToJson(_StacDialogTheme instance) => +Map _$StacDialogThemeToJson(StacDialogTheme instance) => { 'backgroundColor': instance.backgroundColor, 'elevation': instance.elevation, 'shadowColor': instance.shadowColor, 'surfaceTintColor': instance.surfaceTintColor, - 'shape': instance.shape, - 'alignment': instance.alignment, - 'titleTextStyle': instance.titleTextStyle, - 'contentTextStyle': instance.contentTextStyle, - 'actionsPadding': instance.actionsPadding, + 'shape': instance.shape?.toJson(), + 'alignment': instance.alignment?.toJson(), + 'titleTextStyle': instance.titleTextStyle?.toJson(), + 'contentTextStyle': instance.contentTextStyle?.toJson(), + 'actionsPadding': instance.actionsPadding?.toJson(), 'iconColor': instance.iconColor, }; diff --git a/packages/stac_core/lib/foundation/theme/stac_dialog_theme_data/stac_dialog_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_dialog_theme_data/stac_dialog_theme_data.dart new file mode 100644 index 000000000..5780b75e1 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_dialog_theme_data/stac_dialog_theme_data.dart @@ -0,0 +1,117 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/alignment/stac_alignment_geometry/stac_alignment_geometry.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/geometry/stac_box_constraints/stac_box_constraints.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/layout/stac_clip.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; + +part 'stac_dialog_theme_data.g.dart'; + +/// A Stac model representing Flutter's [DialogThemeData]. +/// +/// Defines the theme for dialogs. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacDialogThemeData( +/// backgroundColor: '#FFFFFF', +/// elevation: 24.0, +/// shape: StacBorder(...), +/// titleTextStyle: StacTextStyle(...), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 24.0, +/// "shadowColor": "#000000", +/// "surfaceTintColor": "#FF0000", +/// "alignment": {...}, +/// "iconColor": "#2196F3", +/// "barrierColor": "#80000000", +/// "insetPadding": {...}, +/// "clipBehavior": "antiAlias" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacDialogThemeData implements StacElement { + /// Creates a [StacDialogThemeData] with the given properties. + const StacDialogThemeData({ + this.backgroundColor, + this.elevation, + this.shadowColor, + this.surfaceTintColor, + this.shape, + this.alignment, + this.iconColor, + this.titleTextStyle, + this.contentTextStyle, + this.actionsPadding, + this.barrierColor, + this.insetPadding, + this.clipBehavior, + this.constraints, + }); + + /// Overrides the default value for [Dialog.backgroundColor]. + final String? backgroundColor; + + /// Overrides the default value for [Dialog.elevation]. + final double? elevation; + + /// Overrides the default value for [Dialog.shadowColor]. + final String? shadowColor; + + /// Overrides the default value for [Dialog.surfaceTintColor]. + final String? surfaceTintColor; + + /// Overrides the default value for [Dialog.shape]. + final StacBorder? shape; + + /// Overrides the default value for [Dialog.alignment]. + final StacAlignmentGeometry? alignment; + + /// Used to configure the [IconTheme] for the [AlertDialog.icon] widget. + final String? iconColor; + + /// Overrides the default value for [DefaultTextStyle] for [SimpleDialog.title] and + /// [AlertDialog.title]. + final StacTextStyle? titleTextStyle; + + /// Overrides the default value for [DefaultTextStyle] for [SimpleDialog.children] and + /// [AlertDialog.content]. + final StacTextStyle? contentTextStyle; + + /// Overrides the default value for [AlertDialog.actionsPadding]. + final StacEdgeInsets? actionsPadding; + + /// Overrides the default value for [barrierColor] in [showDialog]. + final String? barrierColor; + + /// Overrides the default value for [Dialog.insetPadding]. + final StacEdgeInsets? insetPadding; + + /// Overrides the default value of [Dialog.clipBehavior]. + final StacClip? clipBehavior; + + /// Constrains the size of the [Dialog]. + /// + /// If null, the dialog's size will be unconstrained. + final StacBoxConstraints? constraints; + + /// Creates a [StacDialogThemeData] from JSON. + factory StacDialogThemeData.fromJson(Map json) => + _$StacDialogThemeDataFromJson(json); + + /// Converts this dialog theme to JSON. + @override + Map toJson() => _$StacDialogThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_dialog_theme_data/stac_dialog_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_dialog_theme_data/stac_dialog_theme_data.g.dart new file mode 100644 index 000000000..92c781d54 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_dialog_theme_data/stac_dialog_theme_data.g.dart @@ -0,0 +1,72 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_dialog_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacDialogThemeData _$StacDialogThemeDataFromJson(Map json) => + StacDialogThemeData( + backgroundColor: json['backgroundColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + shadowColor: json['shadowColor'] as String?, + surfaceTintColor: json['surfaceTintColor'] as String?, + shape: json['shape'] == null + ? null + : StacBorder.fromJson(json['shape'] as Map), + alignment: json['alignment'] == null + ? null + : StacAlignmentGeometry.fromJson( + json['alignment'] as Map, + ), + iconColor: json['iconColor'] as String?, + titleTextStyle: json['titleTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['titleTextStyle']), + contentTextStyle: json['contentTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['contentTextStyle']), + actionsPadding: json['actionsPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['actionsPadding']), + barrierColor: json['barrierColor'] as String?, + insetPadding: json['insetPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['insetPadding']), + clipBehavior: $enumDecodeNullable( + _$StacClipEnumMap, + json['clipBehavior'], + ), + constraints: json['constraints'] == null + ? null + : StacBoxConstraints.fromJson( + json['constraints'] as Map, + ), + ); + +Map _$StacDialogThemeDataToJson( + StacDialogThemeData instance, +) => { + 'backgroundColor': instance.backgroundColor, + 'elevation': instance.elevation, + 'shadowColor': instance.shadowColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'shape': instance.shape?.toJson(), + 'alignment': instance.alignment?.toJson(), + 'iconColor': instance.iconColor, + 'titleTextStyle': instance.titleTextStyle?.toJson(), + 'contentTextStyle': instance.contentTextStyle?.toJson(), + 'actionsPadding': instance.actionsPadding?.toJson(), + 'barrierColor': instance.barrierColor, + 'insetPadding': instance.insetPadding?.toJson(), + 'clipBehavior': _$StacClipEnumMap[instance.clipBehavior], + 'constraints': instance.constraints?.toJson(), +}; + +const _$StacClipEnumMap = { + StacClip.none: 'none', + StacClip.hardEdge: 'hardEdge', + StacClip.antiAlias: 'antiAlias', + StacClip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_divider_theme_data/stac_divider_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_divider_theme_data/stac_divider_theme_data.dart new file mode 100644 index 000000000..fb6334087 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_divider_theme_data/stac_divider_theme_data.dart @@ -0,0 +1,66 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; + +part 'stac_divider_theme_data.g.dart'; + +/// A Stac model representing Flutter's [DividerThemeData]. +/// +/// Defines the theme for dividers, including color, thickness, spacing, and indentation. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacDividerThemeData( +/// color: '#BDBDBD', +/// thickness: 1.0, +/// space: 16.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#BDBDBD", +/// "thickness": 1.0, +/// "space": 16.0, +/// "indent": 0.0, +/// "endIndent": 0.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacDividerThemeData implements StacElement { + /// Creates a [StacDividerThemeData] with the given properties. + const StacDividerThemeData({ + this.color, + this.space, + this.thickness, + this.indent, + this.endIndent, + }); + + /// The color of the divider. + final String? color; + + /// The vertical space around the divider. + final double? space; + + /// The thickness of the divider line. + final double? thickness; + + /// The amount of empty space to the leading edge of the divider. + final double? indent; + + /// The amount of empty space to the trailing edge of the divider. + final double? endIndent; + + /// Creates a [StacDividerThemeData] from JSON. + factory StacDividerThemeData.fromJson(Map json) => + _$StacDividerThemeDataFromJson(json); + + /// Converts this divider theme to JSON. + @override + Map toJson() => _$StacDividerThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_divider_theme_data/stac_divider_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_divider_theme_data/stac_divider_theme_data.g.dart new file mode 100644 index 000000000..4e68f8b67 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_divider_theme_data/stac_divider_theme_data.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_divider_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacDividerThemeData _$StacDividerThemeDataFromJson( + Map json, +) => StacDividerThemeData( + color: json['color'] as String?, + space: (json['space'] as num?)?.toDouble(), + thickness: (json['thickness'] as num?)?.toDouble(), + indent: (json['indent'] as num?)?.toDouble(), + endIndent: (json['endIndent'] as num?)?.toDouble(), +); + +Map _$StacDividerThemeDataToJson( + StacDividerThemeData instance, +) => { + 'color': instance.color, + 'space': instance.space, + 'thickness': instance.thickness, + 'indent': instance.indent, + 'endIndent': instance.endIndent, +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart new file mode 100644 index 000000000..e2788bd37 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart @@ -0,0 +1,86 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/layout/stac_clip.dart'; + +part 'stac_drawer_theme_data.g.dart'; + +/// A Stac model representing Flutter's [DrawerThemeData]. +/// +/// Defines the theme for drawers, including colors, elevation, shape, and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacDrawerThemeData( +/// backgroundColor: '#FFFFFF', +/// elevation: 16.0, +/// width: 304.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 16.0, +/// "shadowColor": "#000000", +/// "surfaceTintColor": "#000000", +/// "scrimColor": "#80000000", +/// "width": 304.0, +/// "clipBehavior": "antiAlias" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacDrawerThemeData implements StacElement { + /// Creates a [StacDrawerThemeData] with the given properties. + const StacDrawerThemeData({ + this.backgroundColor, + this.scrimColor, + this.elevation, + this.shadowColor, + this.surfaceTintColor, + this.shape, + this.endShape, + this.width, + this.clipBehavior, + }); + + /// The background color of the drawer. + final String? backgroundColor; + + /// The color of the scrim that appears behind the drawer. + final String? scrimColor; + + /// The z-coordinate at which to place this drawer relative to its parent. + final double? elevation; + + /// The color of the shadow below the drawer. + final String? shadowColor; + + /// The color used to tint the surface of this drawer. + final String? surfaceTintColor; + + /// The shape of the drawer's border. + final StacShapeBorder? shape; + + /// The shape of the end drawer's border. + final StacShapeBorder? endShape; + + /// The width of the drawer. + final double? width; + + /// How to clip the drawer's content. + final StacClip? clipBehavior; + + /// Creates a [StacDrawerThemeData] from JSON. + factory StacDrawerThemeData.fromJson(Map json) => + _$StacDrawerThemeDataFromJson(json); + + /// Converts this drawer theme to JSON. + @override + Map toJson() => _$StacDrawerThemeDataToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_drawer_theme_data/stac_drawer_theme_data.g.dart similarity index 52% rename from packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.g.dart rename to packages/stac_core/lib/foundation/theme/stac_drawer_theme_data/stac_drawer_theme_data.g.dart index 9a14b2672..97d111420 100644 --- a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_drawer_theme_data/stac_drawer_theme_data.g.dart @@ -6,8 +6,8 @@ part of 'stac_drawer_theme_data.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacDrawerThemeData _$StacDrawerThemeDataFromJson(Map json) => - _StacDrawerThemeData( +StacDrawerThemeData _$StacDrawerThemeDataFromJson(Map json) => + StacDrawerThemeData( backgroundColor: json['backgroundColor'] as String?, scrimColor: json['scrimColor'] as String?, elevation: (json['elevation'] as num?)?.toDouble(), @@ -20,26 +20,29 @@ _StacDrawerThemeData _$StacDrawerThemeDataFromJson(Map json) => ? null : StacShapeBorder.fromJson(json['endShape'] as Map), width: (json['width'] as num?)?.toDouble(), - clipBehavior: $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']), + clipBehavior: $enumDecodeNullable( + _$StacClipEnumMap, + json['clipBehavior'], + ), ); Map _$StacDrawerThemeDataToJson( - _StacDrawerThemeData instance) => - { - 'backgroundColor': instance.backgroundColor, - 'scrimColor': instance.scrimColor, - 'elevation': instance.elevation, - 'shadowColor': instance.shadowColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'shape': instance.shape, - 'endShape': instance.endShape, - 'width': instance.width, - 'clipBehavior': _$ClipEnumMap[instance.clipBehavior], - }; + StacDrawerThemeData instance, +) => { + 'backgroundColor': instance.backgroundColor, + 'scrimColor': instance.scrimColor, + 'elevation': instance.elevation, + 'shadowColor': instance.shadowColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'shape': instance.shape?.toJson(), + 'endShape': instance.endShape?.toJson(), + 'width': instance.width, + 'clipBehavior': _$StacClipEnumMap[instance.clipBehavior], +}; -const _$ClipEnumMap = { - Clip.none: 'none', - Clip.hardEdge: 'hardEdge', - Clip.antiAlias: 'antiAlias', - Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', +const _$StacClipEnumMap = { + StacClip.none: 'none', + StacClip.hardEdge: 'hardEdge', + StacClip.antiAlias: 'antiAlias', + StacClip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', }; diff --git a/packages/stac_core/lib/foundation/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart new file mode 100644 index 000000000..1975cc557 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart @@ -0,0 +1,113 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.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'; + +part 'stac_floating_action_button_theme_data.g.dart'; + +/// A Stac model representing Flutter's [FloatingActionButtonThemeData]. +/// +/// Defines the theme for floating action buttons, including colors, elevation, +/// size, and extended button properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacFloatingActionButtonThemeData( +/// backgroundColor: '#2196F3', +/// foregroundColor: '#FFFFFF', +/// elevation: 6.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#2196F3", +/// "foregroundColor": "#FFFFFF", +/// "elevation": 6.0, +/// "focusElevation": 8.0, +/// "hoverElevation": 4.0, +/// "iconSize": 24.0, +/// "enableFeedback": true +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacFloatingActionButtonThemeData implements StacElement { + /// Creates a [StacFloatingActionButtonThemeData] with the given properties. + const StacFloatingActionButtonThemeData({ + this.foregroundColor, + this.backgroundColor, + this.focusColor, + this.hoverColor, + this.splashColor, + this.elevation, + this.focusElevation, + this.hoverElevation, + this.disabledElevation, + this.highlightElevation, + this.enableFeedback, + this.iconSize, + this.extendedIconLabelSpacing, + this.extendedPadding, + this.extendedTextStyle, + }); + + /// The default color for the floating action button's icon. + final String? foregroundColor; + + /// The background color of the floating action button. + final String? backgroundColor; + + /// The color to use when the floating action button has input focus. + final String? focusColor; + + /// The color to use when the floating action button is being hovered over. + final String? hoverColor; + + /// The splash color for the floating action button. + final String? splashColor; + + /// The z-coordinate at which to place this floating action button relative to its parent. + final double? elevation; + + /// The z-coordinate at which to place this floating action button when it has focus. + final double? focusElevation; + + /// The z-coordinate at which to place this floating action button when it's being hovered over. + final double? hoverElevation; + + /// The z-coordinate at which to place this floating action button when it's disabled. + final double? disabledElevation; + + /// The z-coordinate at which to place this floating action button when it's highlighted. + final double? highlightElevation; + + /// Whether detected gestures should provide acoustic and/or haptic feedback. + final bool? enableFeedback; + + /// The size of the floating action button's icon. + final double? iconSize; + + /// The spacing between the icon and label in an extended floating action button. + final double? extendedIconLabelSpacing; + + /// The padding for an extended floating action button. + final StacEdgeInsets? extendedPadding; + + /// The text style for an extended floating action button's label. + final StacTextStyle? extendedTextStyle; + + /// Creates a [StacFloatingActionButtonThemeData] from JSON. + factory StacFloatingActionButtonThemeData.fromJson( + Map json, + ) => _$StacFloatingActionButtonThemeDataFromJson(json); + + /// Converts this floating action button theme to JSON. + @override + Map toJson() => + _$StacFloatingActionButtonThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.g.dart new file mode 100644 index 000000000..c785a274a --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.g.dart @@ -0,0 +1,52 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_floating_action_button_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacFloatingActionButtonThemeData _$StacFloatingActionButtonThemeDataFromJson( + Map json, +) => StacFloatingActionButtonThemeData( + foregroundColor: json['foregroundColor'] as String?, + backgroundColor: json['backgroundColor'] as String?, + focusColor: json['focusColor'] as String?, + hoverColor: json['hoverColor'] as String?, + splashColor: json['splashColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + focusElevation: (json['focusElevation'] as num?)?.toDouble(), + hoverElevation: (json['hoverElevation'] as num?)?.toDouble(), + disabledElevation: (json['disabledElevation'] as num?)?.toDouble(), + highlightElevation: (json['highlightElevation'] as num?)?.toDouble(), + enableFeedback: json['enableFeedback'] as bool?, + iconSize: (json['iconSize'] as num?)?.toDouble(), + extendedIconLabelSpacing: (json['extendedIconLabelSpacing'] as num?) + ?.toDouble(), + extendedPadding: json['extendedPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['extendedPadding']), + extendedTextStyle: json['extendedTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['extendedTextStyle']), +); + +Map _$StacFloatingActionButtonThemeDataToJson( + StacFloatingActionButtonThemeData instance, +) => { + 'foregroundColor': instance.foregroundColor, + 'backgroundColor': instance.backgroundColor, + 'focusColor': instance.focusColor, + 'hoverColor': instance.hoverColor, + 'splashColor': instance.splashColor, + 'elevation': instance.elevation, + 'focusElevation': instance.focusElevation, + 'hoverElevation': instance.hoverElevation, + 'disabledElevation': instance.disabledElevation, + 'highlightElevation': instance.highlightElevation, + 'enableFeedback': instance.enableFeedback, + 'iconSize': instance.iconSize, + 'extendedIconLabelSpacing': instance.extendedIconLabelSpacing, + 'extendedPadding': instance.extendedPadding?.toJson(), + 'extendedTextStyle': instance.extendedTextStyle?.toJson(), +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart new file mode 100644 index 000000000..8e2efb596 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart @@ -0,0 +1,81 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/effects/stac_shadow/stac_shadow.dart'; + +part 'stac_icon_theme_data.g.dart'; + +/// A Stac model representing Flutter's [IconThemeData]. +/// +/// Defines the theme for icons, including size, color, opacity, and visual properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacIconThemeData( +/// color: '#2196F3', +/// size: 24.0, +/// opacity: 1.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#2196F3", +/// "size": 24.0, +/// "opacity": 1.0, +/// "fill": 0.0, +/// "weight": 400.0, +/// "grade": 0.0, +/// "opticalSize": 24.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacIconThemeData implements StacElement { + /// Creates a [StacIconThemeData] with the given properties. + const StacIconThemeData({ + this.size, + this.fill, + this.weight, + this.grade, + this.opticalSize, + this.color, + this.opacity, + this.shadows, + }); + + /// The size of the icon in logical pixels. + final double? size; + + /// The fill value for the icon (0.0 to 1.0). + final double? fill; + + /// The weight value for the icon (100 to 900). + final double? weight; + + /// The grade value for the icon (-25 to 200). + final double? grade; + + /// The optical size for the icon in logical pixels. + final double? opticalSize; + + /// The color of the icon. + final String? color; + + /// The opacity of the icon (0.0 to 1.0). + final double? opacity; + + /// The list of shadows to apply to the icon. + final List? shadows; + + /// Creates a [StacIconThemeData] from JSON. + factory StacIconThemeData.fromJson(Map json) => + _$StacIconThemeDataFromJson(json); + + /// Converts this icon theme to JSON. + @override + Map toJson() => _$StacIconThemeDataToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.g.dart similarity index 80% rename from packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.g.dart rename to packages/stac_core/lib/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.g.dart index d76c608b3..32b9483d0 100644 --- a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.g.dart @@ -6,8 +6,8 @@ part of 'stac_icon_theme_data.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacIconThemeData _$StacIconThemeDataFromJson(Map json) => - _StacIconThemeData( +StacIconThemeData _$StacIconThemeDataFromJson(Map json) => + StacIconThemeData( size: (json['size'] as num?)?.toDouble(), fill: (json['fill'] as num?)?.toDouble(), weight: (json['weight'] as num?)?.toDouble(), @@ -20,7 +20,7 @@ _StacIconThemeData _$StacIconThemeDataFromJson(Map json) => .toList(), ); -Map _$StacIconThemeDataToJson(_StacIconThemeData instance) => +Map _$StacIconThemeDataToJson(StacIconThemeData instance) => { 'size': instance.size, 'fill': instance.fill, @@ -29,5 +29,5 @@ Map _$StacIconThemeDataToJson(_StacIconThemeData instance) => 'opticalSize': instance.opticalSize, 'color': instance.color, 'opacity': instance.opacity, - 'shadows': instance.shadows, + 'shadows': instance.shadows?.map((e) => e.toJson()).toList(), }; diff --git a/packages/stac_core/lib/foundation/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart new file mode 100644 index 000000000..acd834adf --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart @@ -0,0 +1,131 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/effects/stac_shadow/stac_shadow.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/geometry/stac_visual_density/stac_visual_density.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/foundation/ui_components/stac_list_tile_style.dart'; +import 'package:stac_core/foundation/ui_components/stac_list_tile_title_alignment.dart'; + +part 'stac_list_tile_theme_data.g.dart'; + +/// A Stac model representing Flutter's [ListTileThemeData]. +/// +/// Defines the theme for list tiles, including colors, text styles, layout, +/// and visual properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacListTileThemeData( +/// tileColor: '#FFFFFF', +/// selectedTileColor: '#E3F2FD', +/// dense: false, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "tileColor": "#FFFFFF", +/// "selectedTileColor": "#E3F2FD", +/// "dense": false, +/// "style": "list", +/// "iconColor": "#757575", +/// "textColor": "#212121" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacListTileThemeData implements StacElement { + /// Creates a [StacListTileThemeData] with the given properties. + const StacListTileThemeData({ + this.dense, + this.shape, + this.style, + this.selectedColor, + this.iconColor, + this.textColor, + this.titleTextStyle, + this.subtitleTextStyle, + this.leadingAndTrailingTextStyle, + this.contentPadding, + this.tileColor, + this.selectedTileColor, + this.horizontalTitleGap, + this.minVerticalPadding, + this.minLeadingWidth, + this.enableFeedback, + this.visualDensity, + this.titleAlignment, + this.shadows, + }); + + /// Whether to use a more compact layout for the list tile. + final bool? dense; + + /// The shape of the list tile's border. + final StacBorder? shape; + + /// The style of the list tile. + final StacListTileStyle? style; + + /// The color to use for selected list tiles. + final String? selectedColor; + + /// The color to use for list tile icons. + final String? iconColor; + + /// The color to use for list tile text. + final String? textColor; + + /// The text style for the list tile's title. + final StacTextStyle? titleTextStyle; + + /// The text style for the list tile's subtitle. + final StacTextStyle? subtitleTextStyle; + + /// The text style for leading and trailing widgets. + final StacTextStyle? leadingAndTrailingTextStyle; + + /// The padding around the list tile's content. + final StacEdgeInsets? contentPadding; + + /// The background color of the list tile. + final String? tileColor; + + /// The background color of the selected list tile. + final String? selectedTileColor; + + /// The horizontal gap between the leading widget and the title. + final double? horizontalTitleGap; + + /// The minimum vertical padding for the list tile. + final double? minVerticalPadding; + + /// The minimum width for the leading widget. + final double? minLeadingWidth; + + /// Whether detected gestures should provide acoustic and/or haptic feedback. + final bool? enableFeedback; + + /// The visual density of the list tile. + final StacVisualDensity? visualDensity; + + /// The alignment of the list tile's title. + final StacListTileTitleAlignment? titleAlignment; + + /// The list of shadows to apply to the list tile. + final List? shadows; + + /// Creates a [StacListTileThemeData] from JSON. + factory StacListTileThemeData.fromJson(Map json) => + _$StacListTileThemeDataFromJson(json); + + /// Converts this list tile theme to JSON. + @override + Map toJson() => _$StacListTileThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.g.dart new file mode 100644 index 000000000..5180809cb --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.g.dart @@ -0,0 +1,87 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_list_tile_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacListTileThemeData _$StacListTileThemeDataFromJson( + Map json, +) => StacListTileThemeData( + dense: json['dense'] as bool?, + shape: json['shape'] == null + ? null + : StacBorder.fromJson(json['shape'] as Map), + style: $enumDecodeNullable(_$StacListTileStyleEnumMap, json['style']), + selectedColor: json['selectedColor'] as String?, + iconColor: json['iconColor'] as String?, + textColor: json['textColor'] as String?, + titleTextStyle: json['titleTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['titleTextStyle']), + subtitleTextStyle: json['subtitleTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['subtitleTextStyle']), + leadingAndTrailingTextStyle: json['leadingAndTrailingTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['leadingAndTrailingTextStyle']), + contentPadding: json['contentPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['contentPadding']), + tileColor: json['tileColor'] as String?, + selectedTileColor: json['selectedTileColor'] as String?, + horizontalTitleGap: (json['horizontalTitleGap'] as num?)?.toDouble(), + minVerticalPadding: (json['minVerticalPadding'] as num?)?.toDouble(), + minLeadingWidth: (json['minLeadingWidth'] as num?)?.toDouble(), + enableFeedback: json['enableFeedback'] as bool?, + visualDensity: json['visualDensity'] == null + ? null + : StacVisualDensity.fromJson( + json['visualDensity'] as Map, + ), + titleAlignment: $enumDecodeNullable( + _$StacListTileTitleAlignmentEnumMap, + json['titleAlignment'], + ), + shadows: (json['shadows'] as List?) + ?.map((e) => StacShadow.fromJson(e as Map)) + .toList(), +); + +Map _$StacListTileThemeDataToJson( + StacListTileThemeData instance, +) => { + 'dense': instance.dense, + 'shape': instance.shape?.toJson(), + 'style': _$StacListTileStyleEnumMap[instance.style], + 'selectedColor': instance.selectedColor, + 'iconColor': instance.iconColor, + 'textColor': instance.textColor, + 'titleTextStyle': instance.titleTextStyle?.toJson(), + 'subtitleTextStyle': instance.subtitleTextStyle?.toJson(), + 'leadingAndTrailingTextStyle': instance.leadingAndTrailingTextStyle?.toJson(), + 'contentPadding': instance.contentPadding?.toJson(), + 'tileColor': instance.tileColor, + 'selectedTileColor': instance.selectedTileColor, + 'horizontalTitleGap': instance.horizontalTitleGap, + 'minVerticalPadding': instance.minVerticalPadding, + 'minLeadingWidth': instance.minLeadingWidth, + 'enableFeedback': instance.enableFeedback, + 'visualDensity': instance.visualDensity?.toJson(), + 'titleAlignment': + _$StacListTileTitleAlignmentEnumMap[instance.titleAlignment], + 'shadows': instance.shadows?.map((e) => e.toJson()).toList(), +}; + +const _$StacListTileStyleEnumMap = { + StacListTileStyle.list: 'list', + StacListTileStyle.drawer: 'drawer', +}; + +const _$StacListTileTitleAlignmentEnumMap = { + StacListTileTitleAlignment.titleHeight: 'titleHeight', + StacListTileTitleAlignment.threeLine: 'threeLine', + StacListTileTitleAlignment.bottom: 'bottom', + StacListTileTitleAlignment.center: 'center', +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart new file mode 100644 index 000000000..952af8f0d --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart @@ -0,0 +1,82 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.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'; + +part 'stac_material_banner_theme_data.g.dart'; + +/// A Stac model representing Flutter's [MaterialBannerThemeData]. +/// +/// Defines the theme for material banners, including colors, elevation, +/// text styles, and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacMaterialBannerThemeData( +/// backgroundColor: '#FFFFFF', +/// elevation: 3.0, +/// contentTextStyle: StacTextStyle(...), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 3.0, +/// "shadowColor": "#000000", +/// "surfaceTintColor": "#000000", +/// "dividerColor": "#BDBDBD", +/// "padding": {"all": 16.0} +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacMaterialBannerThemeData implements StacElement { + /// Creates a [StacMaterialBannerThemeData] with the given properties. + const StacMaterialBannerThemeData({ + this.backgroundColor, + this.surfaceTintColor, + this.shadowColor, + this.dividerColor, + this.contentTextStyle, + this.elevation, + this.padding, + this.leadingPadding, + }); + + /// The background color of the material banner. + final String? backgroundColor; + + /// The color used to tint the surface of this material banner. + final String? surfaceTintColor; + + /// The color of the shadow below the material banner. + final String? shadowColor; + + /// The color of the divider in the material banner. + final String? dividerColor; + + /// The text style for the material banner's content. + final StacTextStyle? contentTextStyle; + + /// The z-coordinate at which to place this material banner relative to its parent. + final double? elevation; + + /// The padding around the material banner's content. + final StacEdgeInsets? padding; + + /// The padding around the material banner's leading widget. + final StacEdgeInsets? leadingPadding; + + /// Creates a [StacMaterialBannerThemeData] from JSON. + factory StacMaterialBannerThemeData.fromJson(Map json) => + _$StacMaterialBannerThemeDataFromJson(json); + + /// Converts this material banner theme to JSON. + @override + Map toJson() => _$StacMaterialBannerThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.g.dart new file mode 100644 index 000000000..6d8614b04 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_material_banner_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacMaterialBannerThemeData _$StacMaterialBannerThemeDataFromJson( + Map json, +) => StacMaterialBannerThemeData( + backgroundColor: json['backgroundColor'] as String?, + surfaceTintColor: json['surfaceTintColor'] as String?, + shadowColor: json['shadowColor'] as String?, + dividerColor: json['dividerColor'] as String?, + contentTextStyle: json['contentTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['contentTextStyle']), + elevation: (json['elevation'] as num?)?.toDouble(), + padding: json['padding'] == null + ? null + : StacEdgeInsets.fromJson(json['padding']), + leadingPadding: json['leadingPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['leadingPadding']), +); + +Map _$StacMaterialBannerThemeDataToJson( + StacMaterialBannerThemeData instance, +) => { + 'backgroundColor': instance.backgroundColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'shadowColor': instance.shadowColor, + 'dividerColor': instance.dividerColor, + 'contentTextStyle': instance.contentTextStyle?.toJson(), + 'elevation': instance.elevation, + 'padding': instance.padding?.toJson(), + 'leadingPadding': instance.leadingPadding?.toJson(), +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_material_color/stac_material_color.dart b/packages/stac_core/lib/foundation/theme/stac_material_color/stac_material_color.dart new file mode 100644 index 000000000..bb78147b1 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_material_color/stac_material_color.dart @@ -0,0 +1,98 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; + +part 'stac_material_color.g.dart'; + +/// A Stac model representing Flutter's [MaterialColor]. +/// +/// Defines a Material Design color swatch with shades from 50 to 900. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacMaterialColor( +/// primary: '#2196F3', +/// shade50: '#E3F2FD', +/// shade100: '#BBDEFB', +/// shade500: '#2196F3', +/// shade900: '#0D47A1', +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "primary": "#2196F3", +/// "shade50": "#E3F2FD", +/// "shade100": "#BBDEFB", +/// "shade200": "#90CAF9", +/// "shade300": "#64B5F6", +/// "shade400": "#42A5F5", +/// "shade500": "#2196F3", +/// "shade600": "#1E88E5", +/// "shade700": "#1976D2", +/// "shade800": "#1565C0", +/// "shade900": "#0D47A1" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacMaterialColor implements StacElement { + /// Creates a [StacMaterialColor] with the given properties. + const StacMaterialColor({ + required this.primary, + required this.shade50, + required this.shade100, + required this.shade200, + required this.shade300, + required this.shade400, + required this.shade500, + required this.shade600, + required this.shade700, + required this.shade800, + required this.shade900, + }); + + /// The primary color value (typically shade500). + final String primary; + + /// The lightest shade (50). + final String shade50; + + /// The shade 100. + final String shade100; + + /// The shade 200. + final String shade200; + + /// The shade 300. + final String shade300; + + /// The shade 400. + final String shade400; + + /// The shade 500 (primary). + final String shade500; + + /// The shade 600. + final String shade600; + + /// The shade 700. + final String shade700; + + /// The shade 800. + final String shade800; + + /// The darkest shade (900). + final String shade900; + + /// Creates a [StacMaterialColor] from JSON. + factory StacMaterialColor.fromJson(Map json) => + _$StacMaterialColorFromJson(json); + + /// Converts this material color to JSON. + @override + Map toJson() => _$StacMaterialColorToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.g.dart b/packages/stac_core/lib/foundation/theme/stac_material_color/stac_material_color.g.dart similarity index 86% rename from packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.g.dart rename to packages/stac_core/lib/foundation/theme/stac_material_color/stac_material_color.g.dart index 403ae9770..e32a5bb00 100644 --- a/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_material_color/stac_material_color.g.dart @@ -6,8 +6,8 @@ part of 'stac_material_color.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacMaterialColor _$StacMaterialColorFromJson(Map json) => - _StacMaterialColor( +StacMaterialColor _$StacMaterialColorFromJson(Map json) => + StacMaterialColor( primary: json['primary'] as String, shade50: json['shade50'] as String, shade100: json['shade100'] as String, @@ -21,7 +21,7 @@ _StacMaterialColor _$StacMaterialColorFromJson(Map json) => shade900: json['shade900'] as String, ); -Map _$StacMaterialColorToJson(_StacMaterialColor instance) => +Map _$StacMaterialColorToJson(StacMaterialColor instance) => { 'primary': instance.primary, 'shade50': instance.shade50, diff --git a/packages/stac_core/lib/foundation/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart new file mode 100644 index 000000000..c6753e4fd --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart @@ -0,0 +1,93 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/navigation/stac_navigation_destination_label_behavior.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; + +part 'stac_navigation_bar_theme_data.g.dart'; + +/// A Stac model representing Flutter's [NavigationBarThemeData]. +/// +/// Defines the theme for navigation bars, including colors, elevation, +/// indicator, icon themes, and text styles. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacNavigationBarThemeData( +/// backgroundColor: '#FFFFFF', +/// elevation: 8.0, +/// indicatorColor: '#E3F2FD', +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 8.0, +/// "shadowColor": "#000000", +/// "surfaceTintColor": "#000000", +/// "indicatorColor": "#E3F2FD", +/// "height": 80.0, +/// "labelBehavior": "alwaysShow" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacNavigationBarThemeData implements StacElement { + /// Creates a [StacNavigationBarThemeData] with the given properties. + const StacNavigationBarThemeData({ + this.height, + this.backgroundColor, + this.elevation, + this.shadowColor, + this.surfaceTintColor, + this.indicatorColor, + this.indicatorShape, + this.labelTextStyle, + this.iconTheme, + this.labelBehavior, + }); + + /// The height of the navigation bar. + final double? height; + + /// The background color of the navigation bar. + final String? backgroundColor; + + /// The z-coordinate at which to place this navigation bar relative to its parent. + final double? elevation; + + /// The color of the shadow below the navigation bar. + final String? shadowColor; + + /// The color used to tint the surface of this navigation bar. + final String? surfaceTintColor; + + /// The color of the indicator for the selected destination. + final String? indicatorColor; + + /// The shape of the indicator. + final StacBorder? indicatorShape; + + /// The text style for navigation bar labels. + final StacTextStyle? labelTextStyle; + + /// The icon theme for navigation bar icons. + final StacIconThemeData? iconTheme; + + /// The behavior for showing labels. + final StacNavigationDestinationLabelBehavior? labelBehavior; + + /// Creates a [StacNavigationBarThemeData] from JSON. + factory StacNavigationBarThemeData.fromJson(Map json) => + _$StacNavigationBarThemeDataFromJson(json); + + /// Converts this navigation bar theme to JSON. + @override + Map toJson() => _$StacNavigationBarThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.g.dart new file mode 100644 index 000000000..73e4ffc8d --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_navigation_bar_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacNavigationBarThemeData _$StacNavigationBarThemeDataFromJson( + Map json, +) => StacNavigationBarThemeData( + height: (json['height'] as num?)?.toDouble(), + backgroundColor: json['backgroundColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + shadowColor: json['shadowColor'] as String?, + surfaceTintColor: json['surfaceTintColor'] as String?, + indicatorColor: json['indicatorColor'] as String?, + indicatorShape: json['indicatorShape'] == null + ? null + : StacBorder.fromJson(json['indicatorShape'] as Map), + labelTextStyle: json['labelTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['labelTextStyle']), + iconTheme: json['iconTheme'] == null + ? null + : StacIconThemeData.fromJson(json['iconTheme'] as Map), + labelBehavior: $enumDecodeNullable( + _$StacNavigationDestinationLabelBehaviorEnumMap, + json['labelBehavior'], + ), +); + +Map _$StacNavigationBarThemeDataToJson( + StacNavigationBarThemeData instance, +) => { + 'height': instance.height, + 'backgroundColor': instance.backgroundColor, + 'elevation': instance.elevation, + 'shadowColor': instance.shadowColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'indicatorColor': instance.indicatorColor, + 'indicatorShape': instance.indicatorShape?.toJson(), + 'labelTextStyle': instance.labelTextStyle?.toJson(), + 'iconTheme': instance.iconTheme?.toJson(), + 'labelBehavior': + _$StacNavigationDestinationLabelBehaviorEnumMap[instance.labelBehavior], +}; + +const _$StacNavigationDestinationLabelBehaviorEnumMap = { + StacNavigationDestinationLabelBehavior.alwaysShow: 'alwaysShow', + StacNavigationDestinationLabelBehavior.alwaysHide: 'alwaysHide', + StacNavigationDestinationLabelBehavior.onlyShowSelected: 'onlyShowSelected', +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart new file mode 100644 index 000000000..3db6fdab5 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart @@ -0,0 +1,92 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/geometry/stac_size/stac_size.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; + +part 'stac_navigation_drawer_theme_data.g.dart'; + +/// A Stac model representing Flutter's [NavigationDrawerThemeData]. +/// +/// Defines the theme for navigation drawers, including colors, elevation, +/// indicator, icon themes, and text styles. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacNavigationDrawerThemeData( +/// backgroundColor: '#FFFFFF', +/// elevation: 16.0, +/// indicatorColor: '#E3F2FD', +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#FFFFFF", +/// "elevation": 16.0, +/// "shadowColor": "#000000", +/// "surfaceTintColor": "#000000", +/// "indicatorColor": "#E3F2FD", +/// "tileHeight": 48.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacNavigationDrawerThemeData implements StacElement { + /// Creates a [StacNavigationDrawerThemeData] with the given properties. + const StacNavigationDrawerThemeData({ + this.tileHeight, + this.backgroundColor, + this.elevation, + this.shadowColor, + this.surfaceTintColor, + this.indicatorColor, + this.indicatorShape, + this.indicatorSize, + this.labelTextStyle, + this.iconTheme, + }); + + /// The height of each navigation drawer tile. + final double? tileHeight; + + /// The background color of the navigation drawer. + final String? backgroundColor; + + /// The z-coordinate at which to place this navigation drawer relative to its parent. + final double? elevation; + + /// The color of the shadow below the navigation drawer. + final String? shadowColor; + + /// The color used to tint the surface of this navigation drawer. + final String? surfaceTintColor; + + /// The color of the indicator for the selected destination. + final String? indicatorColor; + + /// The shape of the indicator. + final StacShapeBorder? indicatorShape; + + /// The size of the indicator. + final StacSize? indicatorSize; + + /// The text style for navigation drawer labels. + final StacTextStyle? labelTextStyle; + + /// The icon theme for navigation drawer icons. + final StacIconThemeData? iconTheme; + + /// Creates a [StacNavigationDrawerThemeData] from JSON. + factory StacNavigationDrawerThemeData.fromJson(Map json) => + _$StacNavigationDrawerThemeDataFromJson(json); + + /// Converts this navigation drawer theme to JSON. + @override + Map toJson() => _$StacNavigationDrawerThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.g.dart new file mode 100644 index 000000000..6b4185c3c --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_navigation_drawer_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacNavigationDrawerThemeData _$StacNavigationDrawerThemeDataFromJson( + Map json, +) => StacNavigationDrawerThemeData( + tileHeight: (json['tileHeight'] as num?)?.toDouble(), + backgroundColor: json['backgroundColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + shadowColor: json['shadowColor'] as String?, + surfaceTintColor: json['surfaceTintColor'] as String?, + indicatorColor: json['indicatorColor'] as String?, + indicatorShape: json['indicatorShape'] == null + ? null + : StacShapeBorder.fromJson( + json['indicatorShape'] as Map, + ), + indicatorSize: json['indicatorSize'] == null + ? null + : StacSize.fromJson(json['indicatorSize'] as Map), + labelTextStyle: json['labelTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['labelTextStyle']), + iconTheme: json['iconTheme'] == null + ? null + : StacIconThemeData.fromJson(json['iconTheme'] as Map), +); + +Map _$StacNavigationDrawerThemeDataToJson( + StacNavigationDrawerThemeData instance, +) => { + 'tileHeight': instance.tileHeight, + 'backgroundColor': instance.backgroundColor, + 'elevation': instance.elevation, + 'shadowColor': instance.shadowColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'indicatorColor': instance.indicatorColor, + 'indicatorShape': instance.indicatorShape?.toJson(), + 'indicatorSize': instance.indicatorSize?.toJson(), + 'labelTextStyle': instance.labelTextStyle?.toJson(), + 'iconTheme': instance.iconTheme?.toJson(), +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart new file mode 100644 index 000000000..3215ba733 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart @@ -0,0 +1,93 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; + +part 'stac_scrollbar_theme_data.g.dart'; + +/// A Stac model representing Flutter's [ScrollbarThemeData]. +/// +/// Defines the theme for scrollbars, including colors, visibility, thickness, +/// and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacScrollbarThemeData( +/// thumbColor: '#757575', +/// thickness: 8.0, +/// radius: 4.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "thumbColor": "#757575", +/// "trackColor": "#F5F5F5", +/// "thickness": 8.0, +/// "radius": 4.0, +/// "thumbVisibility": true, +/// "trackVisibility": false, +/// "interactive": true +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacScrollbarThemeData implements StacElement { + /// Creates a [StacScrollbarThemeData] with the given properties. + const StacScrollbarThemeData({ + this.thumbVisibility, + this.thickness, + this.trackVisibility, + this.radius, + this.thumbColor, + this.trackColor, + this.trackBorderColor, + this.crossAxisMargin, + this.mainAxisMargin, + this.minThumbLength, + this.interactive, + }); + + /// Whether the scrollbar thumb should be visible. + final bool? thumbVisibility; + + /// The thickness of the scrollbar. + final double? thickness; + + /// Whether the scrollbar track should be visible. + final bool? trackVisibility; + + /// The radius of the scrollbar's rounded corners. + final double? radius; + + /// The color of the scrollbar thumb. + final String? thumbColor; + + /// The color of the scrollbar track. + final String? trackColor; + + /// The color of the scrollbar track border. + final String? trackBorderColor; + + /// The margin from the cross axis edge. + final double? crossAxisMargin; + + /// The margin from the main axis edge. + final double? mainAxisMargin; + + /// The minimum length of the scrollbar thumb. + final double? minThumbLength; + + /// Whether the scrollbar is interactive. + final bool? interactive; + + /// Creates a [StacScrollbarThemeData] from JSON. + factory StacScrollbarThemeData.fromJson(Map json) => + _$StacScrollbarThemeDataFromJson(json); + + /// Converts this scrollbar theme to JSON. + @override + Map toJson() => _$StacScrollbarThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.g.dart new file mode 100644 index 000000000..7eee4e3a6 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_scrollbar_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacScrollbarThemeData _$StacScrollbarThemeDataFromJson( + Map json, +) => StacScrollbarThemeData( + thumbVisibility: json['thumbVisibility'] as bool?, + thickness: (json['thickness'] as num?)?.toDouble(), + trackVisibility: json['trackVisibility'] as bool?, + radius: (json['radius'] as num?)?.toDouble(), + thumbColor: json['thumbColor'] as String?, + trackColor: json['trackColor'] as String?, + trackBorderColor: json['trackBorderColor'] as String?, + crossAxisMargin: (json['crossAxisMargin'] as num?)?.toDouble(), + mainAxisMargin: (json['mainAxisMargin'] as num?)?.toDouble(), + minThumbLength: (json['minThumbLength'] as num?)?.toDouble(), + interactive: json['interactive'] as bool?, +); + +Map _$StacScrollbarThemeDataToJson( + StacScrollbarThemeData instance, +) => { + 'thumbVisibility': instance.thumbVisibility, + 'thickness': instance.thickness, + 'trackVisibility': instance.trackVisibility, + 'radius': instance.radius, + 'thumbColor': instance.thumbColor, + 'trackColor': instance.trackColor, + 'trackBorderColor': instance.trackBorderColor, + 'crossAxisMargin': instance.crossAxisMargin, + 'mainAxisMargin': instance.mainAxisMargin, + 'minThumbLength': instance.minThumbLength, + 'interactive': instance.interactive, +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart new file mode 100644 index 000000000..71277f1bb --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart @@ -0,0 +1,113 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.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'; +import 'package:stac_core/foundation/ui_components/stac_dismiss_direction.dart'; +import 'package:stac_core/foundation/ui_components/stac_snack_bar_behavior.dart'; + +part 'stac_snack_bar_theme_data.g.dart'; + +/// A Stac model representing Flutter's [SnackBarThemeData]. +/// +/// Defines the theme for snack bars, including colors, elevation, shape, +/// text styles, and behavior properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacSnackBarThemeData( +/// backgroundColor: '#323232', +/// contentTextStyle: StacTextStyle(color: '#FFFFFF'), +/// behavior: SnackBarBehavior.floating, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "backgroundColor": "#323232", +/// "elevation": 6.0, +/// "contentTextStyle": {"color": "#FFFFFF"}, +/// "actionTextColor": "#FF9800", +/// "behavior": "floating", +/// "showCloseIcon": true +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacSnackBarThemeData implements StacElement { + /// Creates a [StacSnackBarThemeData] with the given properties. + const StacSnackBarThemeData({ + this.behavior, + this.backgroundColor, + this.elevation, + this.shape, + this.width, + this.contentTextStyle, + this.actionTextColor, + this.disabledActionTextColor, + this.insetPadding, + this.dismissDirection, + this.showCloseIcon, + this.closeIconColor, + this.actionOverflowThreshold, + this.actionBackgroundColor, + this.disabledActionBackgroundColor, + }); + + /// The behavior of the snack bar. + final StacSnackBarBehavior? behavior; + + /// The background color of the snack bar. + final String? backgroundColor; + + /// The z-coordinate at which to place this snack bar relative to its parent. + final double? elevation; + + /// The shape of the snack bar's border. + final StacShapeBorder? shape; + + /// The width of the snack bar. + final double? width; + + /// The text style for the snack bar's content. + final StacTextStyle? contentTextStyle; + + /// The color of the snack bar's action text. + final String? actionTextColor; + + /// The color of the snack bar's disabled action text. + final String? disabledActionTextColor; + + /// The padding around the snack bar's content. + final StacEdgeInsets? insetPadding; + + /// The direction in which the snack bar can be dismissed. + final StacDismissDirection? dismissDirection; + + /// Whether to show a close icon on the snack bar. + final bool? showCloseIcon; + + /// The color of the close icon. + final String? closeIconColor; + + /// The threshold for action overflow. + final double? actionOverflowThreshold; + + /// The background color of the snack bar's action. + final String? actionBackgroundColor; + + /// The background color of the snack bar's disabled action. + final String? disabledActionBackgroundColor; + + /// Creates a [StacSnackBarThemeData] from JSON. + factory StacSnackBarThemeData.fromJson(Map json) => + _$StacSnackBarThemeDataFromJson(json); + + /// Converts this snack bar theme to JSON. + @override + Map toJson() => _$StacSnackBarThemeDataToJson(this); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.g.dart new file mode 100644 index 000000000..825f11d33 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.g.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_snack_bar_theme_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacSnackBarThemeData _$StacSnackBarThemeDataFromJson( + Map json, +) => StacSnackBarThemeData( + behavior: $enumDecodeNullable( + _$StacSnackBarBehaviorEnumMap, + json['behavior'], + ), + backgroundColor: json['backgroundColor'] as String?, + elevation: (json['elevation'] as num?)?.toDouble(), + shape: json['shape'] == null + ? null + : StacShapeBorder.fromJson(json['shape'] as Map), + width: (json['width'] as num?)?.toDouble(), + contentTextStyle: json['contentTextStyle'] == null + ? null + : StacTextStyle.fromJson(json['contentTextStyle']), + actionTextColor: json['actionTextColor'] as String?, + disabledActionTextColor: json['disabledActionTextColor'] as String?, + insetPadding: json['insetPadding'] == null + ? null + : StacEdgeInsets.fromJson(json['insetPadding']), + dismissDirection: $enumDecodeNullable( + _$StacDismissDirectionEnumMap, + json['dismissDirection'], + ), + showCloseIcon: json['showCloseIcon'] as bool?, + closeIconColor: json['closeIconColor'] as String?, + actionOverflowThreshold: (json['actionOverflowThreshold'] as num?) + ?.toDouble(), + actionBackgroundColor: json['actionBackgroundColor'] as String?, + disabledActionBackgroundColor: + json['disabledActionBackgroundColor'] as String?, +); + +Map _$StacSnackBarThemeDataToJson( + StacSnackBarThemeData instance, +) => { + 'behavior': _$StacSnackBarBehaviorEnumMap[instance.behavior], + 'backgroundColor': instance.backgroundColor, + 'elevation': instance.elevation, + 'shape': instance.shape?.toJson(), + 'width': instance.width, + 'contentTextStyle': instance.contentTextStyle?.toJson(), + 'actionTextColor': instance.actionTextColor, + 'disabledActionTextColor': instance.disabledActionTextColor, + 'insetPadding': instance.insetPadding?.toJson(), + 'dismissDirection': _$StacDismissDirectionEnumMap[instance.dismissDirection], + 'showCloseIcon': instance.showCloseIcon, + 'closeIconColor': instance.closeIconColor, + 'actionOverflowThreshold': instance.actionOverflowThreshold, + 'actionBackgroundColor': instance.actionBackgroundColor, + 'disabledActionBackgroundColor': instance.disabledActionBackgroundColor, +}; + +const _$StacSnackBarBehaviorEnumMap = { + StacSnackBarBehavior.fixed: 'fixed', + StacSnackBarBehavior.floating: 'floating', +}; + +const _$StacDismissDirectionEnumMap = { + StacDismissDirection.horizontal: 'horizontal', + StacDismissDirection.vertical: 'vertical', + StacDismissDirection.down: 'down', + StacDismissDirection.up: 'up', + StacDismissDirection.endToStart: 'endToStart', + StacDismissDirection.startToEnd: 'startToEnd', +}; diff --git a/packages/stac_core/lib/foundation/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart b/packages/stac_core/lib/foundation/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart new file mode 100644 index 000000000..31d8e3824 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart @@ -0,0 +1,92 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/decoration/stac_box_decoration/stac_box_decoration.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/navigation/stac_tab_bar_indicator_size.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; + +part 'stac_tab_bar_theme_data.g.dart'; + +/// A Stac model representing Flutter's [TabBarTheme]. +/// +/// Defines the theme for tab bars, including colors, indicator, text styles, +/// and layout properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacTabBarThemeData( +/// labelColor: '#2196F3', +/// unselectedLabelColor: '#757575', +/// indicatorColor: '#2196F3', +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "labelColor": "#2196F3", +/// "unselectedLabelColor": "#757575", +/// "indicatorColor": "#2196F3", +/// "indicatorSize": "tab", +/// "dividerColor": "#BDBDBD", +/// "labelStyle": {"fontSize": 14.0, "fontWeight": "medium"} +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacTabBarThemeData implements StacElement { + /// Creates a [StacTabBarThemeData] with the given properties. + const StacTabBarThemeData({ + this.indicator, + this.indicatorColor, + this.indicatorSize, + this.dividerColor, + this.labelColor, + this.labelPadding, + this.labelStyle, + this.unselectedLabelColor, + this.unselectedLabelStyle, + this.overlayColor, + }); + + /// The decoration for the tab indicator. + final StacBoxDecoration? indicator; + + /// The color of the tab indicator. + final String? indicatorColor; + + /// The size of the tab indicator. + final StacTabBarIndicatorSize? indicatorSize; + + /// The color of the divider between tabs. + final String? dividerColor; + + /// The color of selected tab labels. + final String? labelColor; + + /// The padding around tab labels. + final StacEdgeInsets? labelPadding; + + /// The text style for selected tab labels. + final StacTextStyle? labelStyle; + + /// The color of unselected tab labels. + final String? unselectedLabelColor; + + /// The text style for unselected tab labels. + final StacTextStyle? unselectedLabelStyle; + + /// The overlay color for tab interactions. + final String? overlayColor; + + /// Creates a [StacTabBarThemeData] from JSON. + factory StacTabBarThemeData.fromJson(Map json) => + _$StacTabBarThemeDataFromJson(json); + + /// Converts this tab bar theme to JSON. + @override + Map toJson() => _$StacTabBarThemeDataToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.g.dart b/packages/stac_core/lib/foundation/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.g.dart similarity index 55% rename from packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.g.dart rename to packages/stac_core/lib/foundation/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.g.dart index 45d07e8d9..a4576ddb7 100644 --- a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.g.dart @@ -6,15 +6,18 @@ part of 'stac_tab_bar_theme_data.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacTabBarThemeData _$StacTabBarThemeDataFromJson(Map json) => - _StacTabBarThemeData( +StacTabBarThemeData _$StacTabBarThemeDataFromJson(Map json) => + StacTabBarThemeData( indicator: json['indicator'] == null ? null : StacBoxDecoration.fromJson( - json['indicator'] as Map), + json['indicator'] as Map, + ), indicatorColor: json['indicatorColor'] as String?, indicatorSize: $enumDecodeNullable( - _$TabBarIndicatorSizeEnumMap, json['indicatorSize']), + _$StacTabBarIndicatorSizeEnumMap, + json['indicatorSize'], + ), dividerColor: json['dividerColor'] as String?, labelColor: json['labelColor'] as String?, labelPadding: json['labelPadding'] == null @@ -31,21 +34,21 @@ _StacTabBarThemeData _$StacTabBarThemeDataFromJson(Map json) => ); Map _$StacTabBarThemeDataToJson( - _StacTabBarThemeData instance) => - { - 'indicator': instance.indicator, - 'indicatorColor': instance.indicatorColor, - 'indicatorSize': _$TabBarIndicatorSizeEnumMap[instance.indicatorSize], - 'dividerColor': instance.dividerColor, - 'labelColor': instance.labelColor, - 'labelPadding': instance.labelPadding, - 'labelStyle': instance.labelStyle, - 'unselectedLabelColor': instance.unselectedLabelColor, - 'unselectedLabelStyle': instance.unselectedLabelStyle, - 'overlayColor': instance.overlayColor, - }; + StacTabBarThemeData instance, +) => { + 'indicator': instance.indicator?.toJson(), + 'indicatorColor': instance.indicatorColor, + 'indicatorSize': _$StacTabBarIndicatorSizeEnumMap[instance.indicatorSize], + 'dividerColor': instance.dividerColor, + 'labelColor': instance.labelColor, + 'labelPadding': instance.labelPadding?.toJson(), + 'labelStyle': instance.labelStyle?.toJson(), + 'unselectedLabelColor': instance.unselectedLabelColor, + 'unselectedLabelStyle': instance.unselectedLabelStyle?.toJson(), + 'overlayColor': instance.overlayColor, +}; -const _$TabBarIndicatorSizeEnumMap = { - TabBarIndicatorSize.tab: 'tab', - TabBarIndicatorSize.label: 'label', +const _$StacTabBarIndicatorSizeEnumMap = { + StacTabBarIndicatorSize.tab: 'tab', + StacTabBarIndicatorSize.label: 'label', }; diff --git a/packages/stac_core/lib/foundation/theme/stac_text_theme/stac_text_theme.dart b/packages/stac_core/lib/foundation/theme/stac_text_theme/stac_text_theme.dart new file mode 100644 index 000000000..deb7f0466 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_text_theme/stac_text_theme.dart @@ -0,0 +1,108 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; + +part 'stac_text_theme.g.dart'; + +/// A Stac model representing Flutter's [TextTheme]. +/// +/// Defines the text theme for the application, including display, headline, +/// title, body, and label text styles. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacTextTheme( +/// displayLarge: StacTextStyle(fontSize: 57.0, fontWeight: 'normal'), +/// headlineLarge: StacTextStyle(fontSize: 32.0, fontWeight: 'normal'), +/// bodyLarge: StacTextStyle(fontSize: 16.0, fontWeight: 'normal'), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "displayLarge": {"fontSize": 57.0, "fontWeight": "normal"}, +/// "headlineLarge": {"fontSize": 32.0, "fontWeight": "normal"}, +/// "titleLarge": {"fontSize": 22.0, "fontWeight": "medium"}, +/// "bodyLarge": {"fontSize": 16.0, "fontWeight": "normal"}, +/// "labelLarge": {"fontSize": 14.0, "fontWeight": "medium"} +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacTextTheme implements StacElement { + /// Creates a [StacTextTheme] with the given properties. + const StacTextTheme({ + this.displayLarge, + this.displayMedium, + this.displaySmall, + this.headlineLarge, + this.headlineMedium, + this.headlineSmall, + this.titleLarge, + this.titleMedium, + this.titleSmall, + this.bodyLarge, + this.bodyMedium, + this.bodySmall, + this.labelLarge, + this.labelMedium, + this.labelSmall, + }); + + /// The style for display large text. + final StacTextStyle? displayLarge; + + /// The style for display medium text. + final StacTextStyle? displayMedium; + + /// The style for display small text. + final StacTextStyle? displaySmall; + + /// The style for headline large text. + final StacTextStyle? headlineLarge; + + /// The style for headline medium text. + final StacTextStyle? headlineMedium; + + /// The style for headline small text. + final StacTextStyle? headlineSmall; + + /// The style for title large text. + final StacTextStyle? titleLarge; + + /// The style for title medium text. + final StacTextStyle? titleMedium; + + /// The style for title small text. + final StacTextStyle? titleSmall; + + /// The style for body large text. + final StacTextStyle? bodyLarge; + + /// The style for body medium text. + final StacTextStyle? bodyMedium; + + /// The style for body small text. + final StacTextStyle? bodySmall; + + /// The style for label large text. + final StacTextStyle? labelLarge; + + /// The style for label medium text. + final StacTextStyle? labelMedium; + + /// The style for label small text. + final StacTextStyle? labelSmall; + + /// Creates a [StacTextTheme] from JSON. + factory StacTextTheme.fromJson(Map json) => + _$StacTextThemeFromJson(json); + + /// Converts this text theme to JSON. + @override + Map toJson() => _$StacTextThemeToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.g.dart b/packages/stac_core/lib/foundation/theme/stac_text_theme/stac_text_theme.g.dart similarity index 68% rename from packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.g.dart rename to packages/stac_core/lib/foundation/theme/stac_text_theme/stac_text_theme.g.dart index 4147645e2..d3abebda1 100644 --- a/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.g.dart +++ b/packages/stac_core/lib/foundation/theme/stac_text_theme/stac_text_theme.g.dart @@ -6,8 +6,8 @@ part of 'stac_text_theme.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacTextTheme _$StacTextThemeFromJson(Map json) => - _StacTextTheme( +StacTextTheme _$StacTextThemeFromJson(Map json) => + StacTextTheme( displayLarge: json['displayLarge'] == null ? null : StacTextStyle.fromJson(json['displayLarge']), @@ -55,21 +55,21 @@ _StacTextTheme _$StacTextThemeFromJson(Map json) => : StacTextStyle.fromJson(json['labelSmall']), ); -Map _$StacTextThemeToJson(_StacTextTheme instance) => +Map _$StacTextThemeToJson(StacTextTheme instance) => { - 'displayLarge': instance.displayLarge, - 'displayMedium': instance.displayMedium, - 'displaySmall': instance.displaySmall, - 'headlineLarge': instance.headlineLarge, - 'headlineMedium': instance.headlineMedium, - 'headlineSmall': instance.headlineSmall, - 'titleLarge': instance.titleLarge, - 'titleMedium': instance.titleMedium, - 'titleSmall': instance.titleSmall, - 'bodyLarge': instance.bodyLarge, - 'bodyMedium': instance.bodyMedium, - 'bodySmall': instance.bodySmall, - 'labelLarge': instance.labelLarge, - 'labelMedium': instance.labelMedium, - 'labelSmall': instance.labelSmall, + 'displayLarge': instance.displayLarge?.toJson(), + 'displayMedium': instance.displayMedium?.toJson(), + 'displaySmall': instance.displaySmall?.toJson(), + 'headlineLarge': instance.headlineLarge?.toJson(), + 'headlineMedium': instance.headlineMedium?.toJson(), + 'headlineSmall': instance.headlineSmall?.toJson(), + 'titleLarge': instance.titleLarge?.toJson(), + 'titleMedium': instance.titleMedium?.toJson(), + 'titleSmall': instance.titleSmall?.toJson(), + 'bodyLarge': instance.bodyLarge?.toJson(), + 'bodyMedium': instance.bodyMedium?.toJson(), + 'bodySmall': instance.bodySmall?.toJson(), + 'labelLarge': instance.labelLarge?.toJson(), + 'labelMedium': instance.labelMedium?.toJson(), + 'labelSmall': instance.labelSmall?.toJson(), }; diff --git a/packages/stac_core/lib/foundation/theme/stac_theme/stac_theme.dart b/packages/stac_core/lib/foundation/theme/stac_theme/stac_theme.dart new file mode 100644 index 000000000..9010160a4 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_theme/stac_theme.dart @@ -0,0 +1,429 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/core.dart'; +import 'package:stac_core/foundation/colors/stac_brightness.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/foundation/theme/stac_app_bar_theme/stac_app_bar_theme.dart'; +import 'package:stac_core/foundation/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart'; +import 'package:stac_core/foundation/theme/stac_bottom_nav_bar_theme_data/stac_bottom_nav_bar_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_bottom_sheet_theme_data/stac_bottom_sheet_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_core/foundation/theme/stac_button_theme_data/stac_button_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_card_theme_data/stac_card_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_chip_theme_data/stac_chip_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_color_scheme/stac_color_scheme.dart'; +import 'package:stac_core/foundation/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_dialog_theme_data/stac_dialog_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_divider_theme_data/stac_divider_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; +import 'package:stac_core/foundation/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_material_color/stac_material_color.dart'; +import 'package:stac_core/foundation/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart'; +import 'package:stac_core/foundation/theme/stac_text_theme/stac_text_theme.dart'; + +part 'stac_theme.g.dart'; + +/// A Stac model representing Flutter's [ThemeData]. +/// +/// Defines the complete theme for the application, including colors, typography, +/// iconography, and component themes for all Material widgets. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacTheme( +/// brightness: StacBrightness.light, +/// colorScheme: StacColorScheme( +/// brightness: StacBrightness.light, +/// primary: '#2196F3', +/// onPrimary: '#FFFFFF', +/// ), +/// textTheme: StacTextTheme(...), +/// appBarTheme: StacAppBarTheme(...), +/// useMaterial3: true, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "brightness": "light", +/// "useMaterial3": true, +/// "colorScheme": { +/// "brightness": "light", +/// "primary": "#2196F3", +/// "onPrimary": "#FFFFFF" +/// }, +/// "textTheme": {...}, +/// "appBarTheme": {...}, +/// "buttonTheme": {...} +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacTheme implements StacElement { + /// Creates a [StacTheme] with the given properties. + const StacTheme({ + // GENERAL CONFIGURATION + this.applyElevationOverlayColor, + this.inputDecorationTheme, + this.materialTapTargetSize, + // this.platform, + this.scrollbarTheme, + this.useMaterial3, + // COLOR + this.colorScheme, + this.brightness, + this.colorSchemeSeed, + // [colorScheme] is the preferred way to configure colors. The [Color] properties + // listed below (as well as primarySwatch) will gradually be phased out, see + // https://github.com/flutter/flutter/issues/91772. + this.canvasColor, + this.cardColor, + this.disabledColor, + this.dividerColor, + this.focusColor, + this.highlightColor, + this.hintColor, + this.hoverColor, + this.primaryColor, + this.primaryColorDark, + this.primaryColorLight, + this.primarySwatch, + this.scaffoldBackgroundColor, + this.secondaryHeaderColor, + this.shadowColor, + this.splashColor, + this.unselectedWidgetColor, + // TYPOGRAPHY & ICONOGRAPHY + this.fontFamily, + this.fontFamilyFallback, + this.package, + this.iconTheme, + this.primaryIconTheme, + this.primaryTextTheme, + this.textTheme, + // COMPONENT THEMES + this.appBarTheme, + this.bannerTheme, + this.bottomAppBarTheme, + this.bottomNavigationBarTheme, + this.bottomSheetTheme, + this.buttonTheme, + this.cardTheme, + this.checkboxTheme, + this.chipTheme, + this.datePickerTheme, + this.dialogTheme, + this.dividerTheme, + this.drawerTheme, + // DropdownMenuThemeData? dropdownMenuTheme, + this.elevatedButtonTheme, + // ExpansionTileThemeData? expansionTileTheme, + this.filledButtonTheme, + this.floatingActionButtonTheme, + this.iconButtonTheme, + this.listTileTheme, + // MenuBarThemeData? menuBarTheme, + this.menuButtonTheme, + // MenuThemeData? menuTheme, + this.navigationBarTheme, + this.navigationDrawerTheme, + // NavigationRailThemeData? navigationRailTheme, + this.outlinedButtonTheme, + // PopupMenuThemeData? popupMenuTheme, + // ProgressIndicatorThemeData? progressIndicatorTheme, + // RadioThemeData? radioTheme, + // SearchBarThemeData? searchBarTheme, + // SearchViewThemeData? searchViewTheme, + this.segmentedButtonTheme, + // SliderThemeData? sliderTheme, + this.snackBarTheme, + // SwitchThemeData? switchTheme, + this.tabBarTheme, + this.textButtonTheme, + // TextSelectionThemeData? textSelectionTheme, + // TimePickerThemeData? timePickerTheme, + // ToggleButtonsThemeData? toggleButtonsTheme, + // TooltipThemeData? tooltipTheme, + }); + + // GENERAL CONFIGURATION + /// Whether to apply elevation overlay color. + final bool? applyElevationOverlayColor; + + /// The theme for input decorations (text fields, etc.). + final StacInputDecorationTheme? inputDecorationTheme; + + /// The minimum size of tap targets. + final StacMaterialTapTargetSize? materialTapTargetSize; + + // final StacTargetPlatform? platform; + + /// The theme for scrollbars. + final StacScrollbarThemeData? scrollbarTheme; + + /// Whether to use Material 3 design. + final bool? useMaterial3; + + // COLOR + /// The color scheme for the theme. + /// + /// This is the preferred way to configure colors. The individual color + /// properties below (as well as primarySwatch) will gradually be phased out. + final StacColorScheme? colorScheme; + + /// The brightness of the theme (light or dark). + final StacBrightness? brightness; + + /// A seed color used to generate the color scheme. + final String? colorSchemeSeed; + + // [colorScheme] is the preferred way to configure colors. The [Color] properties + // listed below (as well as primarySwatch) will gradually be phased out, see + // https://github.com/flutter/flutter/issues/91772. + + /// The default color of [Material] when it is used within this theme. + final String? canvasColor; + + /// The default color of [Card] widgets. + final String? cardColor; + + /// The color to use for disabled widgets. + final String? disabledColor; + + /// The color to use for dividers. + final String? dividerColor; + + /// The color to use for input fields that have the input focus. + final String? focusColor; + + /// The highlight color for widgets. + final String? highlightColor; + + /// The color to use for hint text or placeholder text. + final String? hintColor; + + /// The color to use for widgets when they are being hovered over. + final String? hoverColor; + + /// The primary color of the theme. + final String? primaryColor; + + /// A darker version of the primary color. + final String? primaryColorDark; + + /// A lighter version of the primary color. + final String? primaryColorLight; + + /// A swatch of primary colors with different shades. + final StacMaterialColor? primarySwatch; + + /// The default color of the [Scaffold] background. + final String? scaffoldBackgroundColor; + + /// The color of the header in a [DataTable]. + final String? secondaryHeaderColor; + + /// The default shadow color for [Material] widgets. + final String? shadowColor; + + /// The splash color for widgets. + final String? splashColor; + + /// The color to use for unselected widgets. + final String? unselectedWidgetColor; + + // TYPOGRAPHY & ICONOGRAPHY + /// The default font family for text in the theme. + final String? fontFamily; + + /// The fallback font families to use when [fontFamily] is not available. + final List? fontFamilyFallback; + + /// The package name for the font family. + final String? package; + + /// The default theme for icons. + final StacIconThemeData? iconTheme; + + /// The theme for primary icons. + final StacIconThemeData? primaryIconTheme; + + /// The text theme for primary text. + final StacTextTheme? primaryTextTheme; + + /// The default text theme for the application. + final StacTextTheme? textTheme; + + // COMPONENT THEMES + /// The theme for [AppBar] widgets. + final StacAppBarTheme? appBarTheme; + + // Note: Many theme classes are currently in stac package, will be migrated later + // Using Map for now to avoid circular dependency + + /// The theme for [MaterialBanner] widgets. + final StacMaterialBannerThemeData? bannerTheme; + + /// The theme for [BottomAppBar] widgets. + final StacBottomAppBarThemeData? bottomAppBarTheme; + + /// The theme for [BottomNavigationBar] widgets. + final StacBottomNavBarThemeData? bottomNavigationBarTheme; + + /// The theme for [BottomSheet] widgets. + final StacBottomSheetThemeData? bottomSheetTheme; + + /// The theme for Material buttons. + final StacButtonThemeData? buttonTheme; + + /// The theme for [Card] widgets. + final StacCardThemeData? cardTheme; + + /// The theme for [Checkbox] widgets. + final StacCheckboxThemeData? checkboxTheme; + + /// The theme for [Chip] widgets. + final StacChipThemeData? chipTheme; + + /// The theme for date picker dialogs. + final StacDatePickerThemeData? datePickerTheme; + + /// The theme for [Dialog] widgets. + final StacDialogThemeData? dialogTheme; + + /// The theme for [Divider] widgets. + final StacDividerThemeData? dividerTheme; + + /// The theme for [Drawer] widgets. + final StacDrawerThemeData? drawerTheme; + + // DropdownMenuThemeData? dropdownMenuTheme, + + /// The theme for [ElevatedButton] widgets. + final StacButtonStyle? elevatedButtonTheme; + + // ExpansionTileThemeData? expansionTileTheme, + + /// The theme for [FilledButton] widgets. + final StacButtonStyle? filledButtonTheme; + + /// The theme for [FloatingActionButton] widgets. + final StacFloatingActionButtonThemeData? floatingActionButtonTheme; + + /// The theme for [IconButton] widgets. + final StacButtonStyle? iconButtonTheme; + + /// The theme for [ListTile] widgets. + final StacListTileThemeData? listTileTheme; + + // MenuBarThemeData? menuBarTheme, + + /// The theme for [MenuButton] widgets. + final StacButtonStyle? menuButtonTheme; + + // MenuThemeData? menuTheme, + + /// The theme for [NavigationBar] widgets. + final StacNavigationBarThemeData? navigationBarTheme; + + /// The theme for [NavigationDrawer] widgets. + final StacNavigationDrawerThemeData? navigationDrawerTheme; + + // NavigationRailThemeData? navigationRailTheme, + + /// The theme for [OutlinedButton] widgets. + final StacButtonStyle? outlinedButtonTheme; + + // PopupMenuThemeData? popupMenuTheme, + // ProgressIndicatorThemeData? progressIndicatorTheme, + // RadioThemeData? radioTheme, + // SearchBarThemeData? searchBarTheme, + // SearchViewThemeData? searchViewTheme, + + /// The theme for [SegmentedButton] widgets. + final StacButtonStyle? segmentedButtonTheme; + + // SliderThemeData? sliderTheme, + + /// The theme for [SnackBar] widgets. + final StacSnackBarThemeData? snackBarTheme; + + // SwitchThemeData? switchTheme, + + /// The theme for [TabBar] widgets. + final StacTabBarThemeData? tabBarTheme; + + /// The theme for [TextButton] widgets. + final StacButtonStyle? textButtonTheme; + + // TextSelectionThemeData? textSelectionTheme, + // TimePickerThemeData? timePickerTheme, + // ToggleButtonsThemeData? toggleButtonsTheme, + // TooltipThemeData? tooltipTheme, + + /// Creates a [StacTheme] from JSON. + factory StacTheme.fromJson(Map json) => + _$StacThemeFromJson(json); + + /// Converts this theme to JSON. + @override + Map toJson() => _$StacThemeToJson(this); +} + +/// A utility class providing access to Material text theme styles. +/// +/// This class provides convenient access to Material Design text theme styles +/// for use in Stac widgets. It offers a fluent API to access all Material +/// text theme variants. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// final style = StacThemeData.textTheme.displayLarge; +/// final bodyStyle = StacThemeData.textTheme.bodyMedium; +/// final titleStyle = StacThemeData.textTheme.titleLarge; +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "style": { +/// "type": "theme", +/// "textTheme": "displayLarge" +/// } +/// } +/// ``` +/// {@end-tool} +class StacThemeData { + /// Creates a [StacThemeData] instance. + const StacThemeData._(); + + /// Access to all Material text theme styles. + /// + /// Provides easy access to Material Design text theme styles through a + /// fluent API. Use this to reference standard Material text styles in your + /// Stac widgets. + /// + /// Example: + /// ```dart + /// StacText( + /// data: 'Hello', + /// style: StacThemeData.textTheme.bodyMedium, + /// ) + /// ``` + static const StacThemeTextStyles textTheme = StacThemeTextStyles(); +} diff --git a/packages/stac_core/lib/foundation/theme/stac_theme/stac_theme.g.dart b/packages/stac_core/lib/foundation/theme/stac_theme/stac_theme.g.dart new file mode 100644 index 000000000..cd7396854 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_theme/stac_theme.g.dart @@ -0,0 +1,270 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_theme.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacTheme _$StacThemeFromJson(Map json) => StacTheme( + applyElevationOverlayColor: json['applyElevationOverlayColor'] as bool?, + inputDecorationTheme: json['inputDecorationTheme'] == null + ? null + : StacInputDecorationTheme.fromJson( + json['inputDecorationTheme'] as Map, + ), + materialTapTargetSize: $enumDecodeNullable( + _$StacMaterialTapTargetSizeEnumMap, + json['materialTapTargetSize'], + ), + scrollbarTheme: json['scrollbarTheme'] == null + ? null + : StacScrollbarThemeData.fromJson( + json['scrollbarTheme'] as Map, + ), + useMaterial3: json['useMaterial3'] as bool?, + colorScheme: json['colorScheme'] == null + ? null + : StacColorScheme.fromJson(json['colorScheme'] as Map), + brightness: $enumDecodeNullable(_$StacBrightnessEnumMap, json['brightness']), + colorSchemeSeed: json['colorSchemeSeed'] as String?, + canvasColor: json['canvasColor'] as String?, + cardColor: json['cardColor'] as String?, + disabledColor: json['disabledColor'] as String?, + dividerColor: json['dividerColor'] as String?, + focusColor: json['focusColor'] as String?, + highlightColor: json['highlightColor'] as String?, + hintColor: json['hintColor'] as String?, + hoverColor: json['hoverColor'] as String?, + primaryColor: json['primaryColor'] as String?, + primaryColorDark: json['primaryColorDark'] as String?, + primaryColorLight: json['primaryColorLight'] as String?, + primarySwatch: json['primarySwatch'] == null + ? null + : StacMaterialColor.fromJson( + json['primarySwatch'] as Map, + ), + scaffoldBackgroundColor: json['scaffoldBackgroundColor'] as String?, + secondaryHeaderColor: json['secondaryHeaderColor'] as String?, + shadowColor: json['shadowColor'] as String?, + splashColor: json['splashColor'] as String?, + unselectedWidgetColor: json['unselectedWidgetColor'] as String?, + fontFamily: json['fontFamily'] as String?, + fontFamilyFallback: (json['fontFamilyFallback'] as List?) + ?.map((e) => e as String) + .toList(), + package: json['package'] as String?, + iconTheme: json['iconTheme'] == null + ? null + : StacIconThemeData.fromJson(json['iconTheme'] as Map), + primaryIconTheme: json['primaryIconTheme'] == null + ? null + : StacIconThemeData.fromJson( + json['primaryIconTheme'] as Map, + ), + primaryTextTheme: json['primaryTextTheme'] == null + ? null + : StacTextTheme.fromJson( + json['primaryTextTheme'] as Map, + ), + textTheme: json['textTheme'] == null + ? null + : StacTextTheme.fromJson(json['textTheme'] as Map), + appBarTheme: json['appBarTheme'] == null + ? null + : StacAppBarTheme.fromJson(json['appBarTheme'] as Map), + bannerTheme: json['bannerTheme'] == null + ? null + : StacMaterialBannerThemeData.fromJson( + json['bannerTheme'] as Map, + ), + bottomAppBarTheme: json['bottomAppBarTheme'] == null + ? null + : StacBottomAppBarThemeData.fromJson( + json['bottomAppBarTheme'] as Map, + ), + bottomNavigationBarTheme: json['bottomNavigationBarTheme'] == null + ? null + : StacBottomNavBarThemeData.fromJson( + json['bottomNavigationBarTheme'] as Map, + ), + bottomSheetTheme: json['bottomSheetTheme'] == null + ? null + : StacBottomSheetThemeData.fromJson( + json['bottomSheetTheme'] as Map, + ), + buttonTheme: json['buttonTheme'] == null + ? null + : StacButtonThemeData.fromJson( + json['buttonTheme'] as Map, + ), + cardTheme: json['cardTheme'] == null + ? null + : StacCardThemeData.fromJson(json['cardTheme'] as Map), + checkboxTheme: json['checkboxTheme'] == null + ? null + : StacCheckboxThemeData.fromJson( + json['checkboxTheme'] as Map, + ), + chipTheme: json['chipTheme'] == null + ? null + : StacChipThemeData.fromJson(json['chipTheme'] as Map), + datePickerTheme: json['datePickerTheme'] == null + ? null + : StacDatePickerThemeData.fromJson( + json['datePickerTheme'] as Map, + ), + dialogTheme: json['dialogTheme'] == null + ? null + : StacDialogThemeData.fromJson( + json['dialogTheme'] as Map, + ), + dividerTheme: json['dividerTheme'] == null + ? null + : StacDividerThemeData.fromJson( + json['dividerTheme'] as Map, + ), + drawerTheme: json['drawerTheme'] == null + ? null + : StacDrawerThemeData.fromJson( + json['drawerTheme'] as Map, + ), + elevatedButtonTheme: json['elevatedButtonTheme'] == null + ? null + : StacButtonStyle.fromJson( + json['elevatedButtonTheme'] as Map, + ), + filledButtonTheme: json['filledButtonTheme'] == null + ? null + : StacButtonStyle.fromJson( + json['filledButtonTheme'] as Map, + ), + floatingActionButtonTheme: json['floatingActionButtonTheme'] == null + ? null + : StacFloatingActionButtonThemeData.fromJson( + json['floatingActionButtonTheme'] as Map, + ), + iconButtonTheme: json['iconButtonTheme'] == null + ? null + : StacButtonStyle.fromJson( + json['iconButtonTheme'] as Map, + ), + listTileTheme: json['listTileTheme'] == null + ? null + : StacListTileThemeData.fromJson( + json['listTileTheme'] as Map, + ), + menuButtonTheme: json['menuButtonTheme'] == null + ? null + : StacButtonStyle.fromJson( + json['menuButtonTheme'] as Map, + ), + navigationBarTheme: json['navigationBarTheme'] == null + ? null + : StacNavigationBarThemeData.fromJson( + json['navigationBarTheme'] as Map, + ), + navigationDrawerTheme: json['navigationDrawerTheme'] == null + ? null + : StacNavigationDrawerThemeData.fromJson( + json['navigationDrawerTheme'] as Map, + ), + outlinedButtonTheme: json['outlinedButtonTheme'] == null + ? null + : StacButtonStyle.fromJson( + json['outlinedButtonTheme'] as Map, + ), + segmentedButtonTheme: json['segmentedButtonTheme'] == null + ? null + : StacButtonStyle.fromJson( + json['segmentedButtonTheme'] as Map, + ), + snackBarTheme: json['snackBarTheme'] == null + ? null + : StacSnackBarThemeData.fromJson( + json['snackBarTheme'] as Map, + ), + tabBarTheme: json['tabBarTheme'] == null + ? null + : StacTabBarThemeData.fromJson( + json['tabBarTheme'] as Map, + ), + textButtonTheme: json['textButtonTheme'] == null + ? null + : StacButtonStyle.fromJson( + json['textButtonTheme'] as Map, + ), +); + +Map _$StacThemeToJson(StacTheme instance) => { + 'applyElevationOverlayColor': instance.applyElevationOverlayColor, + 'inputDecorationTheme': instance.inputDecorationTheme?.toJson(), + 'materialTapTargetSize': + _$StacMaterialTapTargetSizeEnumMap[instance.materialTapTargetSize], + 'scrollbarTheme': instance.scrollbarTheme?.toJson(), + 'useMaterial3': instance.useMaterial3, + 'colorScheme': instance.colorScheme?.toJson(), + 'brightness': _$StacBrightnessEnumMap[instance.brightness], + 'colorSchemeSeed': instance.colorSchemeSeed, + 'canvasColor': instance.canvasColor, + 'cardColor': instance.cardColor, + 'disabledColor': instance.disabledColor, + 'dividerColor': instance.dividerColor, + 'focusColor': instance.focusColor, + 'highlightColor': instance.highlightColor, + 'hintColor': instance.hintColor, + 'hoverColor': instance.hoverColor, + 'primaryColor': instance.primaryColor, + 'primaryColorDark': instance.primaryColorDark, + 'primaryColorLight': instance.primaryColorLight, + 'primarySwatch': instance.primarySwatch?.toJson(), + 'scaffoldBackgroundColor': instance.scaffoldBackgroundColor, + 'secondaryHeaderColor': instance.secondaryHeaderColor, + 'shadowColor': instance.shadowColor, + 'splashColor': instance.splashColor, + 'unselectedWidgetColor': instance.unselectedWidgetColor, + 'fontFamily': instance.fontFamily, + 'fontFamilyFallback': instance.fontFamilyFallback, + 'package': instance.package, + 'iconTheme': instance.iconTheme?.toJson(), + 'primaryIconTheme': instance.primaryIconTheme?.toJson(), + 'primaryTextTheme': instance.primaryTextTheme?.toJson(), + 'textTheme': instance.textTheme?.toJson(), + 'appBarTheme': instance.appBarTheme?.toJson(), + 'bannerTheme': instance.bannerTheme?.toJson(), + 'bottomAppBarTheme': instance.bottomAppBarTheme?.toJson(), + 'bottomNavigationBarTheme': instance.bottomNavigationBarTheme?.toJson(), + 'bottomSheetTheme': instance.bottomSheetTheme?.toJson(), + 'buttonTheme': instance.buttonTheme?.toJson(), + 'cardTheme': instance.cardTheme?.toJson(), + 'checkboxTheme': instance.checkboxTheme?.toJson(), + 'chipTheme': instance.chipTheme?.toJson(), + 'datePickerTheme': instance.datePickerTheme?.toJson(), + 'dialogTheme': instance.dialogTheme?.toJson(), + 'dividerTheme': instance.dividerTheme?.toJson(), + 'drawerTheme': instance.drawerTheme?.toJson(), + 'elevatedButtonTheme': instance.elevatedButtonTheme?.toJson(), + 'filledButtonTheme': instance.filledButtonTheme?.toJson(), + 'floatingActionButtonTheme': instance.floatingActionButtonTheme?.toJson(), + 'iconButtonTheme': instance.iconButtonTheme?.toJson(), + 'listTileTheme': instance.listTileTheme?.toJson(), + 'menuButtonTheme': instance.menuButtonTheme?.toJson(), + 'navigationBarTheme': instance.navigationBarTheme?.toJson(), + 'navigationDrawerTheme': instance.navigationDrawerTheme?.toJson(), + 'outlinedButtonTheme': instance.outlinedButtonTheme?.toJson(), + 'segmentedButtonTheme': instance.segmentedButtonTheme?.toJson(), + 'snackBarTheme': instance.snackBarTheme?.toJson(), + 'tabBarTheme': instance.tabBarTheme?.toJson(), + 'textButtonTheme': instance.textButtonTheme?.toJson(), +}; + +const _$StacMaterialTapTargetSizeEnumMap = { + StacMaterialTapTargetSize.padded: 'padded', + StacMaterialTapTargetSize.shrinkWrap: 'shrinkWrap', +}; + +const _$StacBrightnessEnumMap = { + StacBrightness.light: 'light', + StacBrightness.dark: 'dark', + StacBrightness.system: 'system', +}; diff --git a/packages/stac_core/lib/foundation/theme/theme.dart b/packages/stac_core/lib/foundation/theme/theme.dart new file mode 100644 index 000000000..8200a0525 --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/theme.dart @@ -0,0 +1,30 @@ +library; + +export 'stac_app_bar_theme/stac_app_bar_theme.dart'; +export 'stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart'; +export 'stac_bottom_nav_bar_theme_data/stac_bottom_nav_bar_theme_data.dart'; +export 'stac_bottom_sheet_theme_data/stac_bottom_sheet_theme_data.dart'; +export 'stac_button_style/stac_button_style.dart'; +export 'stac_button_theme_data/stac_button_theme_data.dart'; +export 'stac_card_theme_data/stac_card_theme_data.dart'; +export 'stac_checkbox_theme_data/stac_checkbox_theme_data.dart'; +export 'stac_chip_theme_data/stac_chip_theme_data.dart'; +export 'stac_color_scheme/stac_color_scheme.dart'; +export 'stac_date_picker_theme_data/stac_date_picker_theme_data.dart'; +export 'stac_dialog_theme/stac_dialog_theme.dart'; +export 'stac_dialog_theme_data/stac_dialog_theme_data.dart'; +export 'stac_divider_theme_data/stac_divider_theme_data.dart'; +export 'stac_drawer_theme_data/stac_drawer_theme_data.dart'; +export 'stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart'; +export 'stac_icon_theme_data/stac_icon_theme_data.dart'; +export 'stac_input_decoration_theme/stac_input_decoration_theme.dart'; +export 'stac_list_tile_theme_data/stac_list_tile_theme_data.dart'; +export 'stac_material_banner_theme_data/stac_material_banner_theme_data.dart'; +export 'stac_material_color/stac_material_color.dart'; +export 'stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart'; +export 'stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart'; +export 'stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart'; +export 'stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart'; +export 'stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart'; +export 'stac_text_theme/stac_text_theme.dart'; +export 'stac_theme/stac_theme.dart'; diff --git a/packages/stac_core/lib/widgets/text/stac_text.dart b/packages/stac_core/lib/widgets/text/stac_text.dart index 573ebeedf..01ca506ba 100644 --- a/packages/stac_core/lib/widgets/text/stac_text.dart +++ b/packages/stac_core/lib/widgets/text/stac_text.dart @@ -16,7 +16,7 @@ part 'stac_text.g.dart'; /// ```dart /// final widget = StacText( /// data: 'Hello', -/// style: StacTheme.textTheme.bodyMedium, +/// style: StacThemeData.textTheme.bodyMedium, /// copyWithStyle: StacTextStyle(color: StacColors.blue), /// ); /// ```