From 913b70175564ab8664a81b91844d668ffdeb3b8c Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Fri, 24 Jul 2026 09:52:00 -0400 Subject: [PATCH 1/2] refactor(remix): generate Fortal wrappers --- packages/remix/build.yaml | 9 +- .../src/components/accordion/accordion.g.dart | 131 ++++++ .../accordion/fortal_accordion_styles.dart | 132 +----- .../lib/src/components/avatar/avatar.g.dart | 89 ++++ .../avatar/fortal_avatar_styles.dart | 87 +--- .../lib/src/components/badge/badge.g.dart | 69 ++++ .../components/badge/fortal_badge_styles.dart | 67 +--- .../lib/src/components/button/button.g.dart | 217 ++++++++++ .../button/fortal_button_styles.dart | 215 +--------- .../lib/src/components/callout/callout.g.dart | 61 +++ .../callout/fortal_callout_styles.dart | 57 +-- .../remix/lib/src/components/card/card.g.dart | 38 ++ .../components/card/fortal_card_styles.dart | 36 +- .../src/components/checkbox/checkbox.g.dart | 109 +++++ .../checkbox/fortal_checkbox_styles.dart | 107 +---- .../lib/src/components/dialog/dialog.g.dart | 43 ++ .../dialog/fortal_dialog_styles.dart | 41 +- .../lib/src/components/divider/divider.g.dart | 19 + .../divider/fortal_divider_styles.dart | 15 +- .../fortal_icon_button_styles.dart | 174 +------- .../components/icon_button/icon_button.g.dart | 176 ++++++++ .../components/menu/fortal_menu_styles.dart | 119 +----- .../remix/lib/src/components/menu/menu.g.dart | 121 ++++++ .../popover/fortal_popover_styles.dart | 73 +--- .../lib/src/components/popover/popover.g.dart | 75 ++++ .../progress/fortal_progress_styles.dart | 39 +- .../src/components/progress/progress.g.dart | 41 ++ .../components/radio/fortal_radio_styles.dart | 71 +--- .../lib/src/components/radio/radio.g.dart | 73 ++++ .../select/fortal_select_styles.dart | 130 +----- .../lib/src/components/select/select.g.dart | 132 ++++++ .../slider/fortal_slider_styles.dart | 101 +---- .../lib/src/components/slider/slider.g.dart | 103 +++++ .../spinner/fortal_spinner_styles.dart | 15 +- .../lib/src/components/spinner/spinner.g.dart | 19 + .../switch/fortal_switch_styles.dart | 83 +--- .../lib/src/components/switch/switch.g.dart | 85 ++++ .../components/tabs/fortal_tabs_styles.dart | 111 +---- .../remix/lib/src/components/tabs/tabs.g.dart | 110 +++++ .../textfield/fortal_textfield_styles.dart | 377 +---------------- .../src/components/textfield/textfield.g.dart | 379 ++++++++++++++++++ .../toggle/fortal_toggle_styles.dart | 93 +---- .../lib/src/components/toggle/toggle.g.dart | 95 +++++ .../fortal_toggle_group_styles.dart | 84 +--- .../toggle_group/toggle_group.g.dart | 83 ++++ .../tooltip/fortal_tooltip_styles.dart | 33 +- .../lib/src/components/tooltip/tooltip.g.dart | 35 ++ packages/remix/pubspec.yaml | 4 +- packages/remix/tool/check_generated.dart | 85 ++++ pubspec.yaml | 8 +- 50 files changed, 2523 insertions(+), 2146 deletions(-) create mode 100644 packages/remix/tool/check_generated.dart diff --git a/packages/remix/build.yaml b/packages/remix/build.yaml index d63ff53c..6e0d58fc 100644 --- a/packages/remix/build.yaml +++ b/packages/remix/build.yaml @@ -9,14 +9,13 @@ targets: enabled: true generate_for: - lib/**/*.dart - # Remix stylers now come from @MixableSpec. The Fortal widget wrappers - # stay source-authored because a @MixWidget builder cannot resolve a - # Styler generated into the same library during a clean build. + mix_generator|mix_widget_generator: + enabled: true + generate_for: + - lib/**/*.dart mix_generator|styler_generator: enabled: false mix_generator|mixable_generator: enabled: false - mix_generator|mix_widget_generator: - enabled: false mix_generator|modifier_generator: enabled: false diff --git a/packages/remix/lib/src/components/accordion/accordion.g.dart b/packages/remix/lib/src/components/accordion/accordion.g.dart index fed0942e..779a3588 100644 --- a/packages/remix/lib/src/components/accordion/accordion.g.dart +++ b/packages/remix/lib/src/components/accordion/accordion.g.dart @@ -106,6 +106,137 @@ mixin _$RemixAccordionSpec implements Spec, Diagnosticable { ) typedef _$RemixAccordionSpecMethods = _$RemixAccordionSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixAccordion]. +class FortalAccordion extends StatelessWidget { + const FortalAccordion({ + super.key, + this.variant = .surface, + this.size = .size2, + required this.value, + required this.child, + this.title, + this.leadingIcon, + this.trailingIcon, + this.builder, + this.enabled = true, + this.mouseCursor = SystemMouseCursors.click, + this.enableFeedback = true, + this.autofocus = false, + this.focusNode, + this.onFocusChange, + this.onHoverChange, + this.onPressChange, + this.semanticLabel, + this.transitionBuilder = RemixAccordion.defaultAccordionTransitionBuilder, + }); + + const FortalAccordion.surface({ + super.key, + this.size = .size2, + required this.value, + required this.child, + this.title, + this.leadingIcon, + this.trailingIcon, + this.builder, + this.enabled = true, + this.mouseCursor = SystemMouseCursors.click, + this.enableFeedback = true, + this.autofocus = false, + this.focusNode, + this.onFocusChange, + this.onHoverChange, + this.onPressChange, + this.semanticLabel, + this.transitionBuilder = RemixAccordion.defaultAccordionTransitionBuilder, + }) : variant = FortalAccordionVariant.surface; + + const FortalAccordion.soft({ + super.key, + this.size = .size2, + required this.value, + required this.child, + this.title, + this.leadingIcon, + this.trailingIcon, + this.builder, + this.enabled = true, + this.mouseCursor = SystemMouseCursors.click, + this.enableFeedback = true, + this.autofocus = false, + this.focusNode, + this.onFocusChange, + this.onHoverChange, + this.onPressChange, + this.semanticLabel, + this.transitionBuilder = RemixAccordion.defaultAccordionTransitionBuilder, + }) : variant = FortalAccordionVariant.soft; + + final FortalAccordionVariant variant; + + final FortalAccordionSize size; + + final T value; + + final Widget child; + + final String? title; + + final IconData? leadingIcon; + + final IconData? trailingIcon; + + final NakedAccordionTriggerBuilder? builder; + + final bool enabled; + + final MouseCursor mouseCursor; + + final bool enableFeedback; + + final bool autofocus; + + final FocusNode? focusNode; + + final ValueChanged? onFocusChange; + + final ValueChanged? onHoverChange; + + final ValueChanged? onPressChange; + + final String? semanticLabel; + + final Widget Function(Widget, Animation) transitionBuilder; + + @override + Widget build(BuildContext context) { + return RemixAccordion( + key: this.key, + style: fortalAccordionStyler(variant: this.variant, size: this.size), + value: this.value, + child: this.child, + title: this.title, + leadingIcon: this.leadingIcon, + trailingIcon: this.trailingIcon, + builder: this.builder, + enabled: this.enabled, + mouseCursor: this.mouseCursor, + enableFeedback: this.enableFeedback, + autofocus: this.autofocus, + focusNode: this.focusNode, + onFocusChange: this.onFocusChange, + onHoverChange: this.onHoverChange, + onPressChange: this.onPressChange, + semanticLabel: this.semanticLabel, + transitionBuilder: this.transitionBuilder, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/accordion/fortal_accordion_styles.dart b/packages/remix/lib/src/components/accordion/fortal_accordion_styles.dart index 7722d016..1cad22f6 100644 --- a/packages/remix/lib/src/components/accordion/fortal_accordion_styles.dart +++ b/packages/remix/lib/src/components/accordion/fortal_accordion_styles.dart @@ -7,6 +7,11 @@ enum FortalAccordionSize { size1, size2, size3 } enum FortalAccordionVariant { surface, soft } /// Fortal-themed preset for [RemixAccordion]. +@MixWidget( + name: 'FortalAccordion', + target: RemixAccordion.new, + factoryParameters: .only({'variant', 'size'}), +) RemixAccordionStyler fortalAccordionStyler({ FortalAccordionVariant variant = .surface, FortalAccordionSize size = .size2, @@ -98,130 +103,3 @@ RemixAccordionStyler _fortalAccordionSizeStyler(FortalAccordionSize size) { } /// Fortal-themed preset for [RemixAccordion]. -class FortalAccordion extends StatelessWidget { - const FortalAccordion({ - super.key, - this.variant = .surface, - this.size = .size2, - required this.value, - required this.child, - this.title, - this.leadingIcon, - this.trailingIcon, - this.builder, - this.enabled = true, - this.mouseCursor = SystemMouseCursors.click, - this.enableFeedback = true, - this.autofocus = false, - this.focusNode, - this.onFocusChange, - this.onHoverChange, - this.onPressChange, - this.semanticLabel, - this.transitionBuilder, - }); - - const FortalAccordion.surface({ - super.key, - this.size = .size2, - required this.value, - required this.child, - this.title, - this.leadingIcon, - this.trailingIcon, - this.builder, - this.enabled = true, - this.mouseCursor = SystemMouseCursors.click, - this.enableFeedback = true, - this.autofocus = false, - this.focusNode, - this.onFocusChange, - this.onHoverChange, - this.onPressChange, - this.semanticLabel, - this.transitionBuilder, - }) : variant = FortalAccordionVariant.surface; - - const FortalAccordion.soft({ - super.key, - this.size = .size2, - required this.value, - required this.child, - this.title, - this.leadingIcon, - this.trailingIcon, - this.builder, - this.enabled = true, - this.mouseCursor = SystemMouseCursors.click, - this.enableFeedback = true, - this.autofocus = false, - this.focusNode, - this.onFocusChange, - this.onHoverChange, - this.onPressChange, - this.semanticLabel, - this.transitionBuilder, - }) : variant = FortalAccordionVariant.soft; - - final FortalAccordionVariant variant; - - final FortalAccordionSize size; - - final T value; - - final Widget child; - - final String? title; - - final IconData? leadingIcon; - - final IconData? trailingIcon; - - final NakedAccordionTriggerBuilder? builder; - - final bool enabled; - - final MouseCursor mouseCursor; - - final bool enableFeedback; - - final bool autofocus; - - final FocusNode? focusNode; - - final ValueChanged? onFocusChange; - - final ValueChanged? onHoverChange; - - final ValueChanged? onPressChange; - - final String? semanticLabel; - - final Widget Function(Widget, Animation)? transitionBuilder; - - @override - Widget build(BuildContext context) { - return fortalAccordionStyler( - variant: this.variant, - size: this.size, - ).call( - key: this.key, - value: this.value, - title: this.title, - leadingIcon: this.leadingIcon, - trailingIcon: this.trailingIcon, - enabled: this.enabled, - mouseCursor: this.mouseCursor, - enableFeedback: this.enableFeedback, - autofocus: this.autofocus, - focusNode: this.focusNode, - onFocusChange: this.onFocusChange, - onHoverChange: this.onHoverChange, - onPressChange: this.onPressChange, - semanticLabel: this.semanticLabel, - transitionBuilder: this.transitionBuilder, - child: this.child, - builder: this.builder, - ); - } -} diff --git a/packages/remix/lib/src/components/avatar/avatar.g.dart b/packages/remix/lib/src/components/avatar/avatar.g.dart index c4b83789..ea2d3de4 100644 --- a/packages/remix/lib/src/components/avatar/avatar.g.dart +++ b/packages/remix/lib/src/components/avatar/avatar.g.dart @@ -90,6 +90,95 @@ mixin _$RemixAvatarSpec implements Spec, Diagnosticable { ) typedef _$RemixAvatarSpecMethods = _$RemixAvatarSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixAvatar]. +class FortalAvatar extends StatelessWidget { + const FortalAvatar({ + super.key, + this.variant = .soft, + this.size = .size2, + this.backgroundImage, + this.foregroundImage, + this.onBackgroundImageError, + this.onForegroundImageError, + this.child, + this.label, + this.labelBuilder, + this.icon, + this.iconBuilder, + }); + + const FortalAvatar.soft({ + super.key, + this.size = .size2, + this.backgroundImage, + this.foregroundImage, + this.onBackgroundImageError, + this.onForegroundImageError, + this.child, + this.label, + this.labelBuilder, + this.icon, + this.iconBuilder, + }) : variant = FortalAvatarVariant.soft; + + const FortalAvatar.solid({ + super.key, + this.size = .size2, + this.backgroundImage, + this.foregroundImage, + this.onBackgroundImageError, + this.onForegroundImageError, + this.child, + this.label, + this.labelBuilder, + this.icon, + this.iconBuilder, + }) : variant = FortalAvatarVariant.solid; + + final FortalAvatarVariant variant; + + final FortalAvatarSize size; + + final ImageProvider? backgroundImage; + + final ImageProvider? foregroundImage; + + final ImageErrorListener? onBackgroundImageError; + + final ImageErrorListener? onForegroundImageError; + + final Widget? child; + + final String? label; + + final RemixAvatarLabelBuilder? labelBuilder; + + final IconData? icon; + + final RemixAvatarIconBuilder? iconBuilder; + + @override + Widget build(BuildContext context) { + return RemixAvatar( + key: this.key, + style: fortalAvatarStyler(variant: this.variant, size: this.size), + backgroundImage: this.backgroundImage, + foregroundImage: this.foregroundImage, + onBackgroundImageError: this.onBackgroundImageError, + onForegroundImageError: this.onForegroundImageError, + child: this.child, + label: this.label, + labelBuilder: this.labelBuilder, + icon: this.icon, + iconBuilder: this.iconBuilder, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/avatar/fortal_avatar_styles.dart b/packages/remix/lib/src/components/avatar/fortal_avatar_styles.dart index 48e58a00..ae6b1501 100644 --- a/packages/remix/lib/src/components/avatar/fortal_avatar_styles.dart +++ b/packages/remix/lib/src/components/avatar/fortal_avatar_styles.dart @@ -7,6 +7,11 @@ enum FortalAvatarSize { size1, size2, size3, size4 } enum FortalAvatarVariant { soft, solid } /// Fortal-themed preset for [RemixAvatar]. +@MixWidget( + name: 'FortalAvatar', + target: RemixAvatar.new, + factoryParameters: .only({'variant', 'size'}), +) RemixAvatarStyler fortalAvatarStyler({ FortalAvatarVariant variant = .soft, FortalAvatarSize size = .size2, @@ -62,85 +67,3 @@ RemixAvatarStyler _fortalAvatarSizeStyler(FortalAvatarSize size) { } /// Fortal-themed preset for [RemixAvatar]. -class FortalAvatar extends StatelessWidget { - const FortalAvatar({ - super.key, - this.variant = .soft, - this.size = .size2, - this.backgroundImage, - this.foregroundImage, - this.onBackgroundImageError, - this.onForegroundImageError, - this.child, - this.label, - this.labelBuilder, - this.icon, - this.iconBuilder, - }); - - const FortalAvatar.soft({ - super.key, - this.size = .size2, - this.backgroundImage, - this.foregroundImage, - this.onBackgroundImageError, - this.onForegroundImageError, - this.child, - this.label, - this.labelBuilder, - this.icon, - this.iconBuilder, - }) : variant = FortalAvatarVariant.soft; - - const FortalAvatar.solid({ - super.key, - this.size = .size2, - this.backgroundImage, - this.foregroundImage, - this.onBackgroundImageError, - this.onForegroundImageError, - this.child, - this.label, - this.labelBuilder, - this.icon, - this.iconBuilder, - }) : variant = FortalAvatarVariant.solid; - - final FortalAvatarVariant variant; - - final FortalAvatarSize size; - - final ImageProvider? backgroundImage; - - final ImageProvider? foregroundImage; - - final ImageErrorListener? onBackgroundImageError; - - final ImageErrorListener? onForegroundImageError; - - final Widget? child; - - final String? label; - - final RemixAvatarLabelBuilder? labelBuilder; - - final IconData? icon; - - final RemixAvatarIconBuilder? iconBuilder; - - @override - Widget build(BuildContext context) { - return fortalAvatarStyler(variant: this.variant, size: this.size).call( - key: this.key, - backgroundImage: this.backgroundImage, - foregroundImage: this.foregroundImage, - onBackgroundImageError: this.onBackgroundImageError, - onForegroundImageError: this.onForegroundImageError, - label: this.label, - labelBuilder: this.labelBuilder, - icon: this.icon, - iconBuilder: this.iconBuilder, - child: this.child, - ); - } -} diff --git a/packages/remix/lib/src/components/badge/badge.g.dart b/packages/remix/lib/src/components/badge/badge.g.dart index bb960c2d..5404e738 100644 --- a/packages/remix/lib/src/components/badge/badge.g.dart +++ b/packages/remix/lib/src/components/badge/badge.g.dart @@ -85,6 +85,75 @@ mixin _$RemixBadgeSpec implements Spec, Diagnosticable { ) typedef _$RemixBadgeSpecMethods = _$RemixBadgeSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixBadge]. +class FortalBadge extends StatelessWidget { + const FortalBadge({ + super.key, + this.variant = .solid, + this.size = .size2, + this.label, + this.child, + this.labelBuilder, + }); + + const FortalBadge.solid({ + super.key, + this.size = .size2, + this.label, + this.child, + this.labelBuilder, + }) : variant = FortalBadgeVariant.solid; + + const FortalBadge.soft({ + super.key, + this.size = .size2, + this.label, + this.child, + this.labelBuilder, + }) : variant = FortalBadgeVariant.soft; + + const FortalBadge.surface({ + super.key, + this.size = .size2, + this.label, + this.child, + this.labelBuilder, + }) : variant = FortalBadgeVariant.surface; + + const FortalBadge.outline({ + super.key, + this.size = .size2, + this.label, + this.child, + this.labelBuilder, + }) : variant = FortalBadgeVariant.outline; + + final FortalBadgeVariant variant; + + final FortalBadgeSize size; + + final String? label; + + final Widget? child; + + final RemixBadgeLabelBuilder? labelBuilder; + + @override + Widget build(BuildContext context) { + return RemixBadge( + key: this.key, + style: fortalBadgeStyler(variant: this.variant, size: this.size), + label: this.label, + child: this.child, + labelBuilder: this.labelBuilder, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/badge/fortal_badge_styles.dart b/packages/remix/lib/src/components/badge/fortal_badge_styles.dart index 1a95c990..56369764 100644 --- a/packages/remix/lib/src/components/badge/fortal_badge_styles.dart +++ b/packages/remix/lib/src/components/badge/fortal_badge_styles.dart @@ -7,6 +7,11 @@ enum FortalBadgeSize { size1, size2, size3 } enum FortalBadgeVariant { solid, soft, surface, outline } /// Fortal-themed preset for [RemixBadge]. +@MixWidget( + name: 'FortalBadge', + target: RemixBadge.new, + factoryParameters: .only({'variant', 'size'}), +) RemixBadgeStyler fortalBadgeStyler({ FortalBadgeVariant variant = .solid, FortalBadgeSize size = .size2, @@ -82,65 +87,3 @@ RemixBadgeStyler _fortalBadgeSizeStyler(FortalBadgeSize size) { } /// Fortal-themed preset for [RemixBadge]. -class FortalBadge extends StatelessWidget { - const FortalBadge({ - super.key, - this.variant = .solid, - this.size = .size2, - this.label, - this.child, - this.labelBuilder, - }); - - const FortalBadge.solid({ - super.key, - this.size = .size2, - this.label, - this.child, - this.labelBuilder, - }) : variant = FortalBadgeVariant.solid; - - const FortalBadge.soft({ - super.key, - this.size = .size2, - this.label, - this.child, - this.labelBuilder, - }) : variant = FortalBadgeVariant.soft; - - const FortalBadge.surface({ - super.key, - this.size = .size2, - this.label, - this.child, - this.labelBuilder, - }) : variant = FortalBadgeVariant.surface; - - const FortalBadge.outline({ - super.key, - this.size = .size2, - this.label, - this.child, - this.labelBuilder, - }) : variant = FortalBadgeVariant.outline; - - final FortalBadgeVariant variant; - - final FortalBadgeSize size; - - final String? label; - - final Widget? child; - - final RemixBadgeLabelBuilder? labelBuilder; - - @override - Widget build(BuildContext context) { - return fortalBadgeStyler(variant: this.variant, size: this.size).call( - key: this.key, - label: this.label, - labelBuilder: this.labelBuilder, - child: this.child, - ); - } -} diff --git a/packages/remix/lib/src/components/button/button.g.dart b/packages/remix/lib/src/components/button/button.g.dart index 096520e3..a6afadcc 100644 --- a/packages/remix/lib/src/components/button/button.g.dart +++ b/packages/remix/lib/src/components/button/button.g.dart @@ -100,6 +100,223 @@ mixin _$ButtonSpec implements Spec, Diagnosticable { ) typedef _$ButtonSpecMethods = _$ButtonSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed button style and widget presets. +class FortalButton extends StatelessWidget { + const FortalButton({ + super.key, + this.variant = .solid, + this.size = .size2, + required this.label, + this.leadingIcon, + this.trailingIcon, + this.textBuilder, + this.leadingIconBuilder, + this.trailingIconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }); + + /// High-emphasis filled button. + const FortalButton.solid({ + super.key, + this.size = .size2, + required this.label, + this.leadingIcon, + this.trailingIcon, + this.textBuilder, + this.leadingIconBuilder, + this.trailingIconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalButtonVariant.solid; + + /// Low-emphasis filled button. + const FortalButton.soft({ + super.key, + this.size = .size2, + required this.label, + this.leadingIcon, + this.trailingIcon, + this.textBuilder, + this.leadingIconBuilder, + this.trailingIconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalButtonVariant.soft; + + /// Subtle surface button with a border. + const FortalButton.surface({ + super.key, + this.size = .size2, + required this.label, + this.leadingIcon, + this.trailingIcon, + this.textBuilder, + this.leadingIconBuilder, + this.trailingIconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalButtonVariant.surface; + + /// Transparent button with an outline. + const FortalButton.outline({ + super.key, + this.size = .size2, + required this.label, + this.leadingIcon, + this.trailingIcon, + this.textBuilder, + this.leadingIconBuilder, + this.trailingIconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalButtonVariant.outline; + + /// Transparent button without a persistent border. + const FortalButton.ghost({ + super.key, + this.size = .size2, + required this.label, + this.leadingIcon, + this.trailingIcon, + this.textBuilder, + this.leadingIconBuilder, + this.trailingIconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalButtonVariant.ghost; + + final FortalButtonVariant variant; + + final FortalButtonSize size; + + final String label; + + final IconData? leadingIcon; + + final IconData? trailingIcon; + + final RemixButtonTextBuilder? textBuilder; + + final RemixButtonIconBuilder? leadingIconBuilder; + + final RemixButtonIconBuilder? trailingIconBuilder; + + final RemixButtonLoadingBuilder? loadingBuilder; + + final bool loading; + + final bool enabled; + + final VoidCallback? onPressed; + + final VoidCallback? onLongPress; + + final FocusNode? focusNode; + + final bool autofocus; + + final bool enableFeedback; + + final String? semanticLabel; + + final String? semanticHint; + + final bool excludeSemantics; + + final MouseCursor mouseCursor; + + @override + Widget build(BuildContext context) { + return RemixButton( + key: this.key, + style: fortalButtonStyler(variant: this.variant, size: this.size), + label: this.label, + leadingIcon: this.leadingIcon, + trailingIcon: this.trailingIcon, + textBuilder: this.textBuilder, + leadingIconBuilder: this.leadingIconBuilder, + trailingIconBuilder: this.trailingIconBuilder, + loadingBuilder: this.loadingBuilder, + loading: this.loading, + enabled: this.enabled, + onPressed: this.onPressed, + onLongPress: this.onLongPress, + focusNode: this.focusNode, + autofocus: this.autofocus, + enableFeedback: this.enableFeedback, + semanticLabel: this.semanticLabel, + semanticHint: this.semanticHint, + excludeSemantics: this.excludeSemantics, + mouseCursor: this.mouseCursor, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/button/fortal_button_styles.dart b/packages/remix/lib/src/components/button/fortal_button_styles.dart index 233c3c7b..a372a759 100644 --- a/packages/remix/lib/src/components/button/fortal_button_styles.dart +++ b/packages/remix/lib/src/components/button/fortal_button_styles.dart @@ -34,6 +34,11 @@ enum FortalButtonVariant { } /// Fortal-themed button style and widget presets. +@MixWidget( + name: 'FortalButton', + target: RemixButton.new, + factoryParameters: .only({'variant', 'size'}), +) ButtonStyler fortalButtonStyler({ FortalButtonVariant variant = .solid, FortalButtonSize size = .size2, @@ -238,213 +243,3 @@ ButtonStyler _fortalButtonSizeStyler(FortalButtonSize size) { } /// Fortal-themed button style and widget presets. -class FortalButton extends StatelessWidget { - const FortalButton({ - super.key, - this.variant = .solid, - this.size = .size2, - required this.label, - this.leadingIcon, - this.trailingIcon, - this.textBuilder, - this.leadingIconBuilder, - this.trailingIconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }); - - /// High-emphasis filled button. - const FortalButton.solid({ - super.key, - this.size = .size2, - required this.label, - this.leadingIcon, - this.trailingIcon, - this.textBuilder, - this.leadingIconBuilder, - this.trailingIconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalButtonVariant.solid; - - /// Low-emphasis filled button. - const FortalButton.soft({ - super.key, - this.size = .size2, - required this.label, - this.leadingIcon, - this.trailingIcon, - this.textBuilder, - this.leadingIconBuilder, - this.trailingIconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalButtonVariant.soft; - - /// Subtle surface button with a border. - const FortalButton.surface({ - super.key, - this.size = .size2, - required this.label, - this.leadingIcon, - this.trailingIcon, - this.textBuilder, - this.leadingIconBuilder, - this.trailingIconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalButtonVariant.surface; - - /// Transparent button with an outline. - const FortalButton.outline({ - super.key, - this.size = .size2, - required this.label, - this.leadingIcon, - this.trailingIcon, - this.textBuilder, - this.leadingIconBuilder, - this.trailingIconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalButtonVariant.outline; - - /// Transparent button without a persistent border. - const FortalButton.ghost({ - super.key, - this.size = .size2, - required this.label, - this.leadingIcon, - this.trailingIcon, - this.textBuilder, - this.leadingIconBuilder, - this.trailingIconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalButtonVariant.ghost; - - final FortalButtonVariant variant; - - final FortalButtonSize size; - - final String label; - - final IconData? leadingIcon; - - final IconData? trailingIcon; - - final RemixButtonTextBuilder? textBuilder; - - final RemixButtonIconBuilder? leadingIconBuilder; - - final RemixButtonIconBuilder? trailingIconBuilder; - - final RemixButtonLoadingBuilder? loadingBuilder; - - final bool loading; - - final bool enabled; - - final VoidCallback? onPressed; - - final VoidCallback? onLongPress; - - final FocusNode? focusNode; - - final bool autofocus; - - final bool enableFeedback; - - final String? semanticLabel; - - final String? semanticHint; - - final bool excludeSemantics; - - final MouseCursor mouseCursor; - - @override - Widget build(BuildContext context) { - return fortalButtonStyler(variant: this.variant, size: this.size).call( - key: this.key, - label: this.label, - leadingIcon: this.leadingIcon, - trailingIcon: this.trailingIcon, - textBuilder: this.textBuilder, - leadingIconBuilder: this.leadingIconBuilder, - trailingIconBuilder: this.trailingIconBuilder, - loadingBuilder: this.loadingBuilder, - loading: this.loading, - enabled: this.enabled, - onPressed: this.onPressed, - onLongPress: this.onLongPress, - focusNode: this.focusNode, - autofocus: this.autofocus, - enableFeedback: this.enableFeedback, - semanticLabel: this.semanticLabel, - semanticHint: this.semanticHint, - excludeSemantics: this.excludeSemantics, - mouseCursor: this.mouseCursor, - ); - } -} diff --git a/packages/remix/lib/src/components/callout/callout.g.dart b/packages/remix/lib/src/components/callout/callout.g.dart index 60f78d6e..9c23ed89 100644 --- a/packages/remix/lib/src/components/callout/callout.g.dart +++ b/packages/remix/lib/src/components/callout/callout.g.dart @@ -90,6 +90,67 @@ mixin _$RemixCalloutSpec implements Spec, Diagnosticable { ) typedef _$RemixCalloutSpecMethods = _$RemixCalloutSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixCallout]. +class FortalCallout extends StatelessWidget { + const FortalCallout({ + super.key, + this.variant = .surface, + this.size = .size2, + this.text, + this.icon, + this.child, + }); + + const FortalCallout.outline({ + super.key, + this.size = .size2, + this.text, + this.icon, + this.child, + }) : variant = FortalCalloutVariant.outline; + + const FortalCallout.surface({ + super.key, + this.size = .size2, + this.text, + this.icon, + this.child, + }) : variant = FortalCalloutVariant.surface; + + const FortalCallout.soft({ + super.key, + this.size = .size2, + this.text, + this.icon, + this.child, + }) : variant = FortalCalloutVariant.soft; + + final FortalCalloutVariant variant; + + final FortalCalloutSize size; + + final String? text; + + final IconData? icon; + + final Widget? child; + + @override + Widget build(BuildContext context) { + return RemixCallout( + key: this.key, + style: fortalCalloutStyler(variant: this.variant, size: this.size), + text: this.text, + icon: this.icon, + child: this.child, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/callout/fortal_callout_styles.dart b/packages/remix/lib/src/components/callout/fortal_callout_styles.dart index c5129ad5..5dc6b41f 100644 --- a/packages/remix/lib/src/components/callout/fortal_callout_styles.dart +++ b/packages/remix/lib/src/components/callout/fortal_callout_styles.dart @@ -7,6 +7,11 @@ enum FortalCalloutSize { size1, size2, size3 } enum FortalCalloutVariant { outline, surface, soft } /// Fortal-themed preset for [RemixCallout]. +@MixWidget( + name: 'FortalCallout', + target: RemixCallout.new, + factoryParameters: .only({'variant', 'size'}), +) RemixCalloutStyler fortalCalloutStyler({ FortalCalloutVariant variant = .surface, FortalCalloutSize size = .size2, @@ -94,55 +99,3 @@ RemixCalloutStyler _fortalCalloutSizeStyler(FortalCalloutSize size) { } /// Fortal-themed preset for [RemixCallout]. -class FortalCallout extends StatelessWidget { - const FortalCallout({ - super.key, - this.variant = .surface, - this.size = .size2, - this.text, - this.icon, - this.child, - }); - - const FortalCallout.outline({ - super.key, - this.size = .size2, - this.text, - this.icon, - this.child, - }) : variant = FortalCalloutVariant.outline; - - const FortalCallout.surface({ - super.key, - this.size = .size2, - this.text, - this.icon, - this.child, - }) : variant = FortalCalloutVariant.surface; - - const FortalCallout.soft({ - super.key, - this.size = .size2, - this.text, - this.icon, - this.child, - }) : variant = FortalCalloutVariant.soft; - - final FortalCalloutVariant variant; - - final FortalCalloutSize size; - - final String? text; - - final IconData? icon; - - final Widget? child; - - @override - Widget build(BuildContext context) { - return fortalCalloutStyler( - variant: this.variant, - size: this.size, - ).call(key: this.key, text: this.text, icon: this.icon, child: this.child); - } -} diff --git a/packages/remix/lib/src/components/card/card.g.dart b/packages/remix/lib/src/components/card/card.g.dart index e001fed8..cbf099b9 100644 --- a/packages/remix/lib/src/components/card/card.g.dart +++ b/packages/remix/lib/src/components/card/card.g.dart @@ -73,6 +73,44 @@ mixin _$RemixCardSpec implements Spec, Diagnosticable { ) typedef _$RemixCardSpecMethods = _$RemixCardSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixCard]. +class FortalCard extends StatelessWidget { + const FortalCard({ + super.key, + this.variant = .surface, + this.size = .size2, + this.child, + }); + + const FortalCard.surface({super.key, this.size = .size2, this.child}) + : variant = FortalCardVariant.surface; + + const FortalCard.classic({super.key, this.size = .size2, this.child}) + : variant = FortalCardVariant.classic; + + const FortalCard.ghost({super.key, this.size = .size2, this.child}) + : variant = FortalCardVariant.ghost; + + final FortalCardVariant variant; + + final FortalCardSize size; + + final Widget? child; + + @override + Widget build(BuildContext context) { + return RemixCard( + key: this.key, + style: fortalCardStyler(variant: this.variant, size: this.size), + child: this.child, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/card/fortal_card_styles.dart b/packages/remix/lib/src/components/card/fortal_card_styles.dart index 45541bf0..9ebc3fbf 100644 --- a/packages/remix/lib/src/components/card/fortal_card_styles.dart +++ b/packages/remix/lib/src/components/card/fortal_card_styles.dart @@ -7,6 +7,11 @@ enum FortalCardSize { size1, size2, size3 } enum FortalCardVariant { surface, classic, ghost } /// Fortal-themed preset for [RemixCard]. +@MixWidget( + name: 'FortalCard', + target: RemixCard.new, + factoryParameters: .only({'variant', 'size'}), +) RemixCardStyler fortalCardStyler({ FortalCardVariant variant = .surface, FortalCardSize size = .size2, @@ -62,34 +67,3 @@ RemixCardStyler _fortalCardSizeStyler(FortalCardSize size) { } /// Fortal-themed preset for [RemixCard]. -class FortalCard extends StatelessWidget { - const FortalCard({ - super.key, - this.variant = .surface, - this.size = .size2, - this.child, - }); - - const FortalCard.surface({super.key, this.size = .size2, this.child}) - : variant = FortalCardVariant.surface; - - const FortalCard.classic({super.key, this.size = .size2, this.child}) - : variant = FortalCardVariant.classic; - - const FortalCard.ghost({super.key, this.size = .size2, this.child}) - : variant = FortalCardVariant.ghost; - - final FortalCardVariant variant; - - final FortalCardSize size; - - final Widget? child; - - @override - Widget build(BuildContext context) { - return fortalCardStyler( - variant: this.variant, - size: this.size, - ).call(key: this.key, child: this.child); - } -} diff --git a/packages/remix/lib/src/components/checkbox/checkbox.g.dart b/packages/remix/lib/src/components/checkbox/checkbox.g.dart index 0b44fb4e..74376956 100644 --- a/packages/remix/lib/src/components/checkbox/checkbox.g.dart +++ b/packages/remix/lib/src/components/checkbox/checkbox.g.dart @@ -85,6 +85,115 @@ mixin _$RemixCheckboxSpec implements Spec, Diagnosticable { ) typedef _$RemixCheckboxSpecMethods = _$RemixCheckboxSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixCheckbox]. +class FortalCheckbox extends StatelessWidget { + const FortalCheckbox({ + super.key, + this.variant = .surface, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.tristate = false, + this.checkedIcon = Icons.check_rounded, + this.uncheckedIcon, + this.indeterminateIcon = Icons.horizontal_rule, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }); + + /// Surface treatment with neutral border. + const FortalCheckbox.surface({ + super.key, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.tristate = false, + this.checkedIcon = Icons.check_rounded, + this.uncheckedIcon, + this.indeterminateIcon = Icons.horizontal_rule, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalCheckboxVariant.surface; + + /// Soft accent treatment. + const FortalCheckbox.soft({ + super.key, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.tristate = false, + this.checkedIcon = Icons.check_rounded, + this.uncheckedIcon, + this.indeterminateIcon = Icons.horizontal_rule, + this.focusNode, + this.autofocus = false, + this.enableFeedback = true, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalCheckboxVariant.soft; + + final FortalCheckboxVariant variant; + + final FortalCheckboxSize size; + + final bool? selected; + + final ValueChanged? onChanged; + + final bool enabled; + + final bool tristate; + + final IconData checkedIcon; + + final IconData? uncheckedIcon; + + final IconData indeterminateIcon; + + final FocusNode? focusNode; + + final bool autofocus; + + final bool enableFeedback; + + final String? semanticLabel; + + final MouseCursor mouseCursor; + + @override + Widget build(BuildContext context) { + return RemixCheckbox( + key: this.key, + style: fortalCheckboxStyler(variant: this.variant, size: this.size), + selected: this.selected, + onChanged: this.onChanged, + enabled: this.enabled, + tristate: this.tristate, + checkedIcon: this.checkedIcon, + uncheckedIcon: this.uncheckedIcon, + indeterminateIcon: this.indeterminateIcon, + focusNode: this.focusNode, + autofocus: this.autofocus, + enableFeedback: this.enableFeedback, + semanticLabel: this.semanticLabel, + mouseCursor: this.mouseCursor, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/checkbox/fortal_checkbox_styles.dart b/packages/remix/lib/src/components/checkbox/fortal_checkbox_styles.dart index 52b5562d..7542fb53 100644 --- a/packages/remix/lib/src/components/checkbox/fortal_checkbox_styles.dart +++ b/packages/remix/lib/src/components/checkbox/fortal_checkbox_styles.dart @@ -22,6 +22,11 @@ enum FortalCheckboxVariant { } /// Fortal-themed preset for [RemixCheckbox]. +@MixWidget( + name: 'FortalCheckbox', + target: RemixCheckbox.new, + factoryParameters: .only({'variant', 'size'}), +) RemixCheckboxStyler fortalCheckboxStyler({ FortalCheckboxVariant variant = .surface, FortalCheckboxSize size = .size2, @@ -113,105 +118,3 @@ RemixCheckboxStyler _fortalCheckboxSizeStyler(FortalCheckboxSize size) { } /// Fortal-themed preset for [RemixCheckbox]. -class FortalCheckbox extends StatelessWidget { - const FortalCheckbox({ - super.key, - this.variant = .surface, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.tristate = false, - this.checkedIcon = Icons.check_rounded, - this.uncheckedIcon, - this.indeterminateIcon = Icons.horizontal_rule, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }); - - /// Surface treatment with neutral border. - const FortalCheckbox.surface({ - super.key, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.tristate = false, - this.checkedIcon = Icons.check_rounded, - this.uncheckedIcon, - this.indeterminateIcon = Icons.horizontal_rule, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalCheckboxVariant.surface; - - /// Soft accent treatment. - const FortalCheckbox.soft({ - super.key, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.tristate = false, - this.checkedIcon = Icons.check_rounded, - this.uncheckedIcon, - this.indeterminateIcon = Icons.horizontal_rule, - this.focusNode, - this.autofocus = false, - this.enableFeedback = true, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalCheckboxVariant.soft; - - final FortalCheckboxVariant variant; - - final FortalCheckboxSize size; - - final bool? selected; - - final ValueChanged? onChanged; - - final bool enabled; - - final bool tristate; - - final IconData checkedIcon; - - final IconData? uncheckedIcon; - - final IconData indeterminateIcon; - - final FocusNode? focusNode; - - final bool autofocus; - - final bool enableFeedback; - - final String? semanticLabel; - - final MouseCursor mouseCursor; - - @override - Widget build(BuildContext context) { - return fortalCheckboxStyler(variant: this.variant, size: this.size).call( - key: this.key, - selected: this.selected, - onChanged: this.onChanged, - enabled: this.enabled, - tristate: this.tristate, - checkedIcon: this.checkedIcon, - uncheckedIcon: this.uncheckedIcon, - indeterminateIcon: this.indeterminateIcon, - focusNode: this.focusNode, - autofocus: this.autofocus, - enableFeedback: this.enableFeedback, - semanticLabel: this.semanticLabel, - mouseCursor: this.mouseCursor, - ); - } -} diff --git a/packages/remix/lib/src/components/dialog/dialog.g.dart b/packages/remix/lib/src/components/dialog/dialog.g.dart index 2dd41f8e..e39ddabd 100644 --- a/packages/remix/lib/src/components/dialog/dialog.g.dart +++ b/packages/remix/lib/src/components/dialog/dialog.g.dart @@ -95,6 +95,49 @@ mixin _$RemixDialogSpec implements Spec, Diagnosticable { ) typedef _$RemixDialogSpecMethods = _$RemixDialogSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixDialog]. +class FortalDialog extends StatelessWidget { + const FortalDialog({ + super.key, + this.child, + this.title, + this.description, + this.actions, + this.modal = true, + this.semanticLabel, + }); + + final Widget? child; + + final String? title; + + final String? description; + + final List? actions; + + final bool modal; + + final String? semanticLabel; + + @override + Widget build(BuildContext context) { + return RemixDialog( + key: this.key, + style: fortalDialogStyler(), + child: this.child, + title: this.title, + description: this.description, + actions: this.actions, + modal: this.modal, + semanticLabel: this.semanticLabel, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/dialog/fortal_dialog_styles.dart b/packages/remix/lib/src/components/dialog/fortal_dialog_styles.dart index 08ad3b5e..70f3b9d0 100644 --- a/packages/remix/lib/src/components/dialog/fortal_dialog_styles.dart +++ b/packages/remix/lib/src/components/dialog/fortal_dialog_styles.dart @@ -1,6 +1,11 @@ part of 'dialog.dart'; /// Fortal-themed preset for [RemixDialog]. +@MixWidget( + name: 'FortalDialog', + target: RemixDialog.new, + factoryParameters: .only({}), +) RemixDialogStyler fortalDialogStyler() { return RemixDialogStyler() .title( @@ -41,39 +46,3 @@ RemixDialogStyler fortalDialogStyler() { } /// Fortal-themed preset for [RemixDialog]. -class FortalDialog extends StatelessWidget { - const FortalDialog({ - super.key, - this.child, - this.title, - this.description, - this.actions, - this.modal = true, - this.semanticLabel, - }); - - final Widget? child; - - final String? title; - - final String? description; - - final List? actions; - - final bool modal; - - final String? semanticLabel; - - @override - Widget build(BuildContext context) { - return fortalDialogStyler().call( - key: this.key, - title: this.title, - description: this.description, - actions: this.actions, - modal: this.modal, - semanticLabel: this.semanticLabel, - child: this.child, - ); - } -} diff --git a/packages/remix/lib/src/components/divider/divider.g.dart b/packages/remix/lib/src/components/divider/divider.g.dart index fec37347..4effaa30 100644 --- a/packages/remix/lib/src/components/divider/divider.g.dart +++ b/packages/remix/lib/src/components/divider/divider.g.dart @@ -73,6 +73,25 @@ mixin _$RemixDividerSpec implements Spec, Diagnosticable { ) typedef _$RemixDividerSpecMethods = _$RemixDividerSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixDivider]. +class FortalDivider extends StatelessWidget { + const FortalDivider({super.key, this.size = .size1}); + + final FortalDividerSize size; + + @override + Widget build(BuildContext context) { + return RemixDivider( + key: this.key, + style: fortalDividerStyler(size: this.size), + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/divider/fortal_divider_styles.dart b/packages/remix/lib/src/components/divider/fortal_divider_styles.dart index 8d19c641..bf79abfe 100644 --- a/packages/remix/lib/src/components/divider/fortal_divider_styles.dart +++ b/packages/remix/lib/src/components/divider/fortal_divider_styles.dart @@ -13,6 +13,11 @@ enum FortalDividerSize { } /// Fortal-themed preset for [RemixDivider]. +@MixWidget( + name: 'FortalDivider', + target: RemixDivider.new, + factoryParameters: .only({'size'}), +) RemixDividerStyler fortalDividerStyler({FortalDividerSize size = .size1}) { return RemixDividerStyler() .color(FortalTokens.gray6()) @@ -28,13 +33,3 @@ RemixDividerStyler _fortalDividerSizeStyler(FortalDividerSize size) { } /// Fortal-themed preset for [RemixDivider]. -class FortalDivider extends StatelessWidget { - const FortalDivider({super.key, this.size = .size1}); - - final FortalDividerSize size; - - @override - Widget build(BuildContext context) { - return fortalDividerStyler(size: this.size).call(key: this.key); - } -} diff --git a/packages/remix/lib/src/components/icon_button/fortal_icon_button_styles.dart b/packages/remix/lib/src/components/icon_button/fortal_icon_button_styles.dart index c9bec245..f4eb6a17 100644 --- a/packages/remix/lib/src/components/icon_button/fortal_icon_button_styles.dart +++ b/packages/remix/lib/src/components/icon_button/fortal_icon_button_styles.dart @@ -7,6 +7,11 @@ enum FortalIconButtonSize { size1, size2, size3, size4 } enum FortalIconButtonVariant { solid, soft, surface, outline, ghost } /// Fortal-themed preset for [RemixIconButton]. +@MixWidget( + name: 'FortalIconButton', + target: RemixIconButton.new, + factoryParameters: .only({'variant', 'size'}), +) RemixIconButtonStyler fortalIconButtonStyler({ FortalIconButtonVariant variant = .solid, FortalIconButtonSize size = .size2, @@ -209,172 +214,3 @@ RemixIconButtonStyler _fortalIconButtonSizeStyler(FortalIconButtonSize size) { } /// Fortal-themed preset for [RemixIconButton]. -class FortalIconButton extends StatelessWidget { - const FortalIconButton({ - super.key, - this.variant = .solid, - this.size = .size2, - required this.icon, - this.iconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.enableFeedback = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }); - - const FortalIconButton.solid({ - super.key, - this.size = .size2, - required this.icon, - this.iconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.enableFeedback = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalIconButtonVariant.solid; - - const FortalIconButton.soft({ - super.key, - this.size = .size2, - required this.icon, - this.iconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.enableFeedback = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalIconButtonVariant.soft; - - const FortalIconButton.surface({ - super.key, - this.size = .size2, - required this.icon, - this.iconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.enableFeedback = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalIconButtonVariant.surface; - - const FortalIconButton.outline({ - super.key, - this.size = .size2, - required this.icon, - this.iconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.enableFeedback = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalIconButtonVariant.outline; - - const FortalIconButton.ghost({ - super.key, - this.size = .size2, - required this.icon, - this.iconBuilder, - this.loadingBuilder, - this.loading = false, - this.enabled = true, - this.enableFeedback = true, - this.onPressed, - this.onLongPress, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalIconButtonVariant.ghost; - - final FortalIconButtonVariant variant; - - final FortalIconButtonSize size; - - final IconData icon; - - final RemixIconButtonIconBuilder? iconBuilder; - - final RemixIconButtonLoadingBuilder? loadingBuilder; - - final bool loading; - - final bool enabled; - - final bool enableFeedback; - - final VoidCallback? onPressed; - - final VoidCallback? onLongPress; - - final FocusNode? focusNode; - - final bool autofocus; - - final String? semanticLabel; - - final String? semanticHint; - - final bool excludeSemantics; - - final MouseCursor mouseCursor; - - @override - Widget build(BuildContext context) { - return fortalIconButtonStyler(variant: this.variant, size: this.size).call( - key: this.key, - icon: this.icon, - iconBuilder: this.iconBuilder, - loadingBuilder: this.loadingBuilder, - loading: this.loading, - enabled: this.enabled, - enableFeedback: this.enableFeedback, - onPressed: this.onPressed, - onLongPress: this.onLongPress, - focusNode: this.focusNode, - autofocus: this.autofocus, - semanticLabel: this.semanticLabel, - semanticHint: this.semanticHint, - excludeSemantics: this.excludeSemantics, - mouseCursor: this.mouseCursor, - ); - } -} diff --git a/packages/remix/lib/src/components/icon_button/icon_button.g.dart b/packages/remix/lib/src/components/icon_button/icon_button.g.dart index ab633ab2..9684b07e 100644 --- a/packages/remix/lib/src/components/icon_button/icon_button.g.dart +++ b/packages/remix/lib/src/components/icon_button/icon_button.g.dart @@ -91,6 +91,182 @@ mixin _$RemixIconButtonSpec ) typedef _$RemixIconButtonSpecMethods = _$RemixIconButtonSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixIconButton]. +class FortalIconButton extends StatelessWidget { + const FortalIconButton({ + super.key, + this.variant = .solid, + this.size = .size2, + required this.icon, + this.iconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.enableFeedback = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }); + + const FortalIconButton.solid({ + super.key, + this.size = .size2, + required this.icon, + this.iconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.enableFeedback = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalIconButtonVariant.solid; + + const FortalIconButton.soft({ + super.key, + this.size = .size2, + required this.icon, + this.iconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.enableFeedback = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalIconButtonVariant.soft; + + const FortalIconButton.surface({ + super.key, + this.size = .size2, + required this.icon, + this.iconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.enableFeedback = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalIconButtonVariant.surface; + + const FortalIconButton.outline({ + super.key, + this.size = .size2, + required this.icon, + this.iconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.enableFeedback = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalIconButtonVariant.outline; + + const FortalIconButton.ghost({ + super.key, + this.size = .size2, + required this.icon, + this.iconBuilder, + this.loadingBuilder, + this.loading = false, + this.enabled = true, + this.enableFeedback = true, + this.onPressed, + this.onLongPress, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalIconButtonVariant.ghost; + + final FortalIconButtonVariant variant; + + final FortalIconButtonSize size; + + final IconData icon; + + final RemixIconButtonIconBuilder? iconBuilder; + + final RemixIconButtonLoadingBuilder? loadingBuilder; + + final bool loading; + + final bool enabled; + + final bool enableFeedback; + + final VoidCallback? onPressed; + + final VoidCallback? onLongPress; + + final FocusNode? focusNode; + + final bool autofocus; + + final String? semanticLabel; + + final String? semanticHint; + + final bool excludeSemantics; + + final MouseCursor mouseCursor; + + @override + Widget build(BuildContext context) { + return RemixIconButton( + key: this.key, + style: fortalIconButtonStyler(variant: this.variant, size: this.size), + icon: this.icon, + iconBuilder: this.iconBuilder, + loadingBuilder: this.loadingBuilder, + loading: this.loading, + enabled: this.enabled, + enableFeedback: this.enableFeedback, + onPressed: this.onPressed, + onLongPress: this.onLongPress, + focusNode: this.focusNode, + autofocus: this.autofocus, + semanticLabel: this.semanticLabel, + semanticHint: this.semanticHint, + excludeSemantics: this.excludeSemantics, + mouseCursor: this.mouseCursor, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/menu/fortal_menu_styles.dart b/packages/remix/lib/src/components/menu/fortal_menu_styles.dart index 91b62d67..f091af10 100644 --- a/packages/remix/lib/src/components/menu/fortal_menu_styles.dart +++ b/packages/remix/lib/src/components/menu/fortal_menu_styles.dart @@ -19,6 +19,11 @@ enum FortalMenuVariant { } /// Fortal-themed preset for [RemixMenu]. +@MixWidget( + name: 'FortalMenu', + target: RemixMenu.new, + factoryParameters: .only({'variant', 'size'}), +) RemixMenuStyler fortalMenuStyler({ FortalMenuVariant variant = .solid, FortalMenuSize size = .size2, @@ -192,117 +197,3 @@ RemixMenuItemStyler _fortalMenuItemSizeStyler(FortalMenuSize size) { } /// Fortal-themed preset for [RemixMenu]. -class FortalMenu extends StatelessWidget { - const FortalMenu({ - super.key, - this.variant = .solid, - this.size = .size2, - required this.trigger, - required this.items, - this.controller, - this.onSelected, - this.onOpen, - this.onClose, - this.onCanceled, - this.onOpenRequested, - this.onCloseRequested, - this.consumeOutsideTaps = true, - this.useRootOverlay = false, - this.closeOnClickOutside = true, - this.triggerFocusNode, - this.positioning = const OverlayPositionConfig(), - }); - - /// High-emphasis menu trigger and item hover treatment. - const FortalMenu.solid({ - super.key, - this.size = .size2, - required this.trigger, - required this.items, - this.controller, - this.onSelected, - this.onOpen, - this.onClose, - this.onCanceled, - this.onOpenRequested, - this.onCloseRequested, - this.consumeOutsideTaps = true, - this.useRootOverlay = false, - this.closeOnClickOutside = true, - this.triggerFocusNode, - this.positioning = const OverlayPositionConfig(), - }) : variant = FortalMenuVariant.solid; - - /// Subtle accent-backed menu trigger and item hover treatment. - const FortalMenu.soft({ - super.key, - this.size = .size2, - required this.trigger, - required this.items, - this.controller, - this.onSelected, - this.onOpen, - this.onClose, - this.onCanceled, - this.onOpenRequested, - this.onCloseRequested, - this.consumeOutsideTaps = true, - this.useRootOverlay = false, - this.closeOnClickOutside = true, - this.triggerFocusNode, - this.positioning = const OverlayPositionConfig(), - }) : variant = FortalMenuVariant.soft; - - final FortalMenuVariant variant; - - final FortalMenuSize size; - - final RemixMenuTrigger trigger; - - final List> items; - - final MenuController? controller; - - final ValueChanged? onSelected; - - final VoidCallback? onOpen; - - final VoidCallback? onClose; - - final VoidCallback? onCanceled; - - final RawMenuAnchorOpenRequestedCallback? onOpenRequested; - - final RawMenuAnchorCloseRequestedCallback? onCloseRequested; - - final bool consumeOutsideTaps; - - final bool useRootOverlay; - - final bool closeOnClickOutside; - - final FocusNode? triggerFocusNode; - - final OverlayPositionConfig positioning; - - @override - Widget build(BuildContext context) { - return fortalMenuStyler(variant: this.variant, size: this.size).call( - key: this.key, - trigger: this.trigger, - items: this.items, - controller: this.controller, - onSelected: this.onSelected, - onOpen: this.onOpen, - onClose: this.onClose, - onCanceled: this.onCanceled, - onOpenRequested: this.onOpenRequested, - onCloseRequested: this.onCloseRequested, - consumeOutsideTaps: this.consumeOutsideTaps, - useRootOverlay: this.useRootOverlay, - closeOnClickOutside: this.closeOnClickOutside, - triggerFocusNode: this.triggerFocusNode, - positioning: this.positioning, - ); - } -} diff --git a/packages/remix/lib/src/components/menu/menu.g.dart b/packages/remix/lib/src/components/menu/menu.g.dart index 46978fca..30d46e66 100644 --- a/packages/remix/lib/src/components/menu/menu.g.dart +++ b/packages/remix/lib/src/components/menu/menu.g.dart @@ -269,6 +269,127 @@ mixin _$RemixMenuItemSpec implements Spec, Diagnosticable { ) typedef _$RemixMenuItemSpecMethods = _$RemixMenuItemSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixMenu]. +class FortalMenu extends StatelessWidget { + const FortalMenu({ + super.key, + this.variant = .solid, + this.size = .size2, + required this.trigger, + required this.items, + this.controller, + this.onSelected, + this.onOpen, + this.onClose, + this.onCanceled, + this.onOpenRequested, + this.onCloseRequested, + this.consumeOutsideTaps = true, + this.useRootOverlay = false, + this.closeOnClickOutside = true, + this.triggerFocusNode, + this.positioning = const OverlayPositionConfig(), + }); + + /// High-emphasis menu trigger and item hover treatment. + const FortalMenu.solid({ + super.key, + this.size = .size2, + required this.trigger, + required this.items, + this.controller, + this.onSelected, + this.onOpen, + this.onClose, + this.onCanceled, + this.onOpenRequested, + this.onCloseRequested, + this.consumeOutsideTaps = true, + this.useRootOverlay = false, + this.closeOnClickOutside = true, + this.triggerFocusNode, + this.positioning = const OverlayPositionConfig(), + }) : variant = FortalMenuVariant.solid; + + /// Subtle accent-backed menu trigger and item hover treatment. + const FortalMenu.soft({ + super.key, + this.size = .size2, + required this.trigger, + required this.items, + this.controller, + this.onSelected, + this.onOpen, + this.onClose, + this.onCanceled, + this.onOpenRequested, + this.onCloseRequested, + this.consumeOutsideTaps = true, + this.useRootOverlay = false, + this.closeOnClickOutside = true, + this.triggerFocusNode, + this.positioning = const OverlayPositionConfig(), + }) : variant = FortalMenuVariant.soft; + + final FortalMenuVariant variant; + + final FortalMenuSize size; + + final RemixMenuTrigger trigger; + + final List> items; + + final MenuController? controller; + + final ValueChanged? onSelected; + + final VoidCallback? onOpen; + + final VoidCallback? onClose; + + final VoidCallback? onCanceled; + + final RawMenuAnchorOpenRequestedCallback? onOpenRequested; + + final RawMenuAnchorCloseRequestedCallback? onCloseRequested; + + final bool consumeOutsideTaps; + + final bool useRootOverlay; + + final bool closeOnClickOutside; + + final FocusNode? triggerFocusNode; + + final OverlayPositionConfig positioning; + + @override + Widget build(BuildContext context) { + return RemixMenu( + key: this.key, + style: fortalMenuStyler(variant: this.variant, size: this.size), + trigger: this.trigger, + items: this.items, + controller: this.controller, + onSelected: this.onSelected, + onOpen: this.onOpen, + onClose: this.onClose, + onCanceled: this.onCanceled, + onOpenRequested: this.onOpenRequested, + onCloseRequested: this.onCloseRequested, + consumeOutsideTaps: this.consumeOutsideTaps, + useRootOverlay: this.useRootOverlay, + closeOnClickOutside: this.closeOnClickOutside, + triggerFocusNode: this.triggerFocusNode, + positioning: this.positioning, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/popover/fortal_popover_styles.dart b/packages/remix/lib/src/components/popover/fortal_popover_styles.dart index 8955a1fb..83fed1d7 100644 --- a/packages/remix/lib/src/components/popover/fortal_popover_styles.dart +++ b/packages/remix/lib/src/components/popover/fortal_popover_styles.dart @@ -1,6 +1,11 @@ part of 'popover.dart'; /// Fortal-themed preset for [RemixPopover]. +@MixWidget( + name: 'FortalPopover', + target: RemixPopover.new, + factoryParameters: .only({}), +) RemixPopoverStyler fortalPopoverStyler() { return RemixPopoverStyler() .paddingAll(FortalTokens.space4()) @@ -22,71 +27,3 @@ RemixPopoverStyler fortalPopoverStyler() { } /// Fortal-themed preset for [RemixPopover]. -class FortalPopover extends StatelessWidget { - const FortalPopover({ - super.key, - required this.popoverChild, - required this.child, - this.positioning = const OverlayPositionConfig(), - this.consumeOutsideTaps = true, - this.useRootOverlay = false, - this.openOnTap = true, - this.triggerFocusNode, - this.onOpen, - this.onClose, - this.onOpenRequested, - this.onCloseRequested, - this.controller, - this.semanticLabel, - this.excludeSemantics = false, - }); - - final Widget popoverChild; - - final Widget child; - - final OverlayPositionConfig positioning; - - final bool consumeOutsideTaps; - - final bool useRootOverlay; - - final bool openOnTap; - - final FocusNode? triggerFocusNode; - - final VoidCallback? onOpen; - - final VoidCallback? onClose; - - final RawMenuAnchorOpenRequestedCallback? onOpenRequested; - - final RawMenuAnchorCloseRequestedCallback? onCloseRequested; - - final MenuController? controller; - - final String? semanticLabel; - - final bool excludeSemantics; - - @override - Widget build(BuildContext context) { - return fortalPopoverStyler().call( - key: this.key, - popoverChild: this.popoverChild, - child: this.child, - positioning: this.positioning, - consumeOutsideTaps: this.consumeOutsideTaps, - useRootOverlay: this.useRootOverlay, - openOnTap: this.openOnTap, - triggerFocusNode: this.triggerFocusNode, - onOpen: this.onOpen, - onClose: this.onClose, - onOpenRequested: this.onOpenRequested, - onCloseRequested: this.onCloseRequested, - controller: this.controller, - semanticLabel: this.semanticLabel, - excludeSemantics: this.excludeSemantics, - ); - } -} diff --git a/packages/remix/lib/src/components/popover/popover.g.dart b/packages/remix/lib/src/components/popover/popover.g.dart index f6e66372..e73bbd38 100644 --- a/packages/remix/lib/src/components/popover/popover.g.dart +++ b/packages/remix/lib/src/components/popover/popover.g.dart @@ -73,6 +73,81 @@ mixin _$RemixPopoverSpec implements Spec, Diagnosticable { ) typedef _$RemixPopoverSpecMethods = _$RemixPopoverSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixPopover]. +class FortalPopover extends StatelessWidget { + const FortalPopover({ + super.key, + required this.popoverChild, + required this.child, + this.positioning = const OverlayPositionConfig(), + this.consumeOutsideTaps = true, + this.useRootOverlay = false, + this.openOnTap = true, + this.triggerFocusNode, + this.onOpen, + this.onClose, + this.onOpenRequested, + this.onCloseRequested, + this.controller, + this.semanticLabel, + this.excludeSemantics = false, + }); + + final Widget popoverChild; + + final Widget child; + + final OverlayPositionConfig positioning; + + final bool consumeOutsideTaps; + + final bool useRootOverlay; + + final bool openOnTap; + + final FocusNode? triggerFocusNode; + + final VoidCallback? onOpen; + + final VoidCallback? onClose; + + final RawMenuAnchorOpenRequestedCallback? onOpenRequested; + + final RawMenuAnchorCloseRequestedCallback? onCloseRequested; + + final MenuController? controller; + + final String? semanticLabel; + + final bool excludeSemantics; + + @override + Widget build(BuildContext context) { + return RemixPopover( + key: this.key, + style: fortalPopoverStyler(), + popoverChild: this.popoverChild, + child: this.child, + positioning: this.positioning, + consumeOutsideTaps: this.consumeOutsideTaps, + useRootOverlay: this.useRootOverlay, + openOnTap: this.openOnTap, + triggerFocusNode: this.triggerFocusNode, + onOpen: this.onOpen, + onClose: this.onClose, + onOpenRequested: this.onOpenRequested, + onCloseRequested: this.onCloseRequested, + controller: this.controller, + semanticLabel: this.semanticLabel, + excludeSemantics: this.excludeSemantics, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/progress/fortal_progress_styles.dart b/packages/remix/lib/src/components/progress/fortal_progress_styles.dart index 56715336..471fb1f5 100644 --- a/packages/remix/lib/src/components/progress/fortal_progress_styles.dart +++ b/packages/remix/lib/src/components/progress/fortal_progress_styles.dart @@ -7,6 +7,11 @@ enum FortalProgressSize { size1, size2, size3 } enum FortalProgressVariant { surface, soft } /// Fortal-themed preset for [RemixProgress]. +@MixWidget( + name: 'FortalProgress', + target: RemixProgress.new, + factoryParameters: .only({'variant', 'size'}), +) RemixProgressStyler fortalProgressStyler({ FortalProgressVariant variant = .surface, FortalProgressSize size = .size2, @@ -90,37 +95,3 @@ RemixProgressStyler _fortalProgressSizeStyler(FortalProgressSize size) { } /// Fortal-themed preset for [RemixProgress]. -class FortalProgress extends StatelessWidget { - const FortalProgress({ - super.key, - this.variant = .surface, - this.size = .size2, - required this.value, - }); - - const FortalProgress.surface({ - super.key, - this.size = .size2, - required this.value, - }) : variant = FortalProgressVariant.surface; - - const FortalProgress.soft({ - super.key, - this.size = .size2, - required this.value, - }) : variant = FortalProgressVariant.soft; - - final FortalProgressVariant variant; - - final FortalProgressSize size; - - final double value; - - @override - Widget build(BuildContext context) { - return fortalProgressStyler( - variant: this.variant, - size: this.size, - ).call(key: this.key, value: this.value); - } -} diff --git a/packages/remix/lib/src/components/progress/progress.g.dart b/packages/remix/lib/src/components/progress/progress.g.dart index 5aa173e7..93a2185f 100644 --- a/packages/remix/lib/src/components/progress/progress.g.dart +++ b/packages/remix/lib/src/components/progress/progress.g.dart @@ -95,6 +95,47 @@ mixin _$RemixProgressSpec implements Spec, Diagnosticable { ) typedef _$RemixProgressSpecMethods = _$RemixProgressSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixProgress]. +class FortalProgress extends StatelessWidget { + const FortalProgress({ + super.key, + this.variant = .surface, + this.size = .size2, + required this.value, + }); + + const FortalProgress.surface({ + super.key, + this.size = .size2, + required this.value, + }) : variant = FortalProgressVariant.surface; + + const FortalProgress.soft({ + super.key, + this.size = .size2, + required this.value, + }) : variant = FortalProgressVariant.soft; + + final FortalProgressVariant variant; + + final FortalProgressSize size; + + final double value; + + @override + Widget build(BuildContext context) { + return RemixProgress( + key: this.key, + style: fortalProgressStyler(variant: this.variant, size: this.size), + value: this.value, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/radio/fortal_radio_styles.dart b/packages/remix/lib/src/components/radio/fortal_radio_styles.dart index 25c86569..57041ee4 100644 --- a/packages/remix/lib/src/components/radio/fortal_radio_styles.dart +++ b/packages/remix/lib/src/components/radio/fortal_radio_styles.dart @@ -22,6 +22,11 @@ enum FortalRadioVariant { } /// Fortal-themed preset for [RemixRadio]. +@MixWidget( + name: 'FortalRadio', + target: RemixRadio.new, + factoryParameters: .only({'variant', 'size'}), +) RemixRadioStyler fortalRadioStyler({ FortalRadioVariant variant = .surface, FortalRadioSize size = .size2, @@ -115,69 +120,3 @@ RemixRadioStyler _fortalRadioSizeStyler(FortalRadioSize size) { } /// Fortal-themed preset for [RemixRadio]. -class FortalRadio extends StatelessWidget { - const FortalRadio({ - super.key, - this.variant = .surface, - this.size = .size2, - required this.value, - this.enabled = true, - this.toggleable = false, - this.mouseCursor, - this.focusNode, - this.autofocus = false, - }); - - /// Surface treatment with neutral border. - const FortalRadio.surface({ - super.key, - this.size = .size2, - required this.value, - this.enabled = true, - this.toggleable = false, - this.mouseCursor, - this.focusNode, - this.autofocus = false, - }) : variant = FortalRadioVariant.surface; - - /// Soft accent treatment. - const FortalRadio.soft({ - super.key, - this.size = .size2, - required this.value, - this.enabled = true, - this.toggleable = false, - this.mouseCursor, - this.focusNode, - this.autofocus = false, - }) : variant = FortalRadioVariant.soft; - - final FortalRadioVariant variant; - - final FortalRadioSize size; - - final T value; - - final bool enabled; - - final bool toggleable; - - final MouseCursor? mouseCursor; - - final FocusNode? focusNode; - - final bool autofocus; - - @override - Widget build(BuildContext context) { - return fortalRadioStyler(variant: this.variant, size: this.size).call( - key: this.key, - value: this.value, - enabled: this.enabled, - toggleable: this.toggleable, - mouseCursor: this.mouseCursor, - focusNode: this.focusNode, - autofocus: this.autofocus, - ); - } -} diff --git a/packages/remix/lib/src/components/radio/radio.g.dart b/packages/remix/lib/src/components/radio/radio.g.dart index 4f9a7586..0e1a5cfe 100644 --- a/packages/remix/lib/src/components/radio/radio.g.dart +++ b/packages/remix/lib/src/components/radio/radio.g.dart @@ -85,6 +85,79 @@ mixin _$RemixRadioSpec implements Spec, Diagnosticable { ) typedef _$RemixRadioSpecMethods = _$RemixRadioSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixRadio]. +class FortalRadio extends StatelessWidget { + const FortalRadio({ + super.key, + this.variant = .surface, + this.size = .size2, + required this.value, + this.enabled = true, + this.toggleable = false, + this.mouseCursor, + this.focusNode, + this.autofocus = false, + }); + + /// Surface treatment with neutral border. + const FortalRadio.surface({ + super.key, + this.size = .size2, + required this.value, + this.enabled = true, + this.toggleable = false, + this.mouseCursor, + this.focusNode, + this.autofocus = false, + }) : variant = FortalRadioVariant.surface; + + /// Soft accent treatment. + const FortalRadio.soft({ + super.key, + this.size = .size2, + required this.value, + this.enabled = true, + this.toggleable = false, + this.mouseCursor, + this.focusNode, + this.autofocus = false, + }) : variant = FortalRadioVariant.soft; + + final FortalRadioVariant variant; + + final FortalRadioSize size; + + final T value; + + final bool enabled; + + final bool toggleable; + + final MouseCursor? mouseCursor; + + final FocusNode? focusNode; + + final bool autofocus; + + @override + Widget build(BuildContext context) { + return RemixRadio( + key: this.key, + style: fortalRadioStyler(variant: this.variant, size: this.size), + value: this.value, + enabled: this.enabled, + toggleable: this.toggleable, + mouseCursor: this.mouseCursor, + focusNode: this.focusNode, + autofocus: this.autofocus, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/select/fortal_select_styles.dart b/packages/remix/lib/src/components/select/fortal_select_styles.dart index 7ab148b5..1d854549 100644 --- a/packages/remix/lib/src/components/select/fortal_select_styles.dart +++ b/packages/remix/lib/src/components/select/fortal_select_styles.dart @@ -25,6 +25,11 @@ enum FortalSelectVariant { } /// Fortal-themed preset for [RemixSelect]. +@MixWidget( + name: 'FortalSelect', + target: RemixSelect.new, + factoryParameters: .only({'variant', 'size'}), +) RemixSelectStyler fortalSelectStyler({ FortalSelectVariant variant = .surface, FortalSelectSize size = .size2, @@ -187,128 +192,3 @@ RemixSelectMenuItemStyler _fortalSelectMenuItemSizeStyler( } /// Fortal-themed preset for [RemixSelect]. -class FortalSelect extends StatelessWidget { - const FortalSelect({ - super.key, - this.variant = .surface, - this.size = .size2, - required this.trigger, - required this.items, - this.selectedValue, - this.positioning = const OverlayPositionConfig( - targetAnchor: .bottomCenter, - followerAnchor: .topCenter, - ), - this.onChanged, - this.onOpen, - this.onClose, - this.enabled = true, - this.closeOnSelect = true, - this.semanticLabel, - this.focusNode, - }); - - /// Surface-backed trigger with border. - const FortalSelect.surface({ - super.key, - this.size = .size2, - required this.trigger, - required this.items, - this.selectedValue, - this.positioning = const OverlayPositionConfig( - targetAnchor: .bottomCenter, - followerAnchor: .topCenter, - ), - this.onChanged, - this.onOpen, - this.onClose, - this.enabled = true, - this.closeOnSelect = true, - this.semanticLabel, - this.focusNode, - }) : variant = FortalSelectVariant.surface; - - /// Soft accent trigger. - const FortalSelect.soft({ - super.key, - this.size = .size2, - required this.trigger, - required this.items, - this.selectedValue, - this.positioning = const OverlayPositionConfig( - targetAnchor: .bottomCenter, - followerAnchor: .topCenter, - ), - this.onChanged, - this.onOpen, - this.onClose, - this.enabled = true, - this.closeOnSelect = true, - this.semanticLabel, - this.focusNode, - }) : variant = FortalSelectVariant.soft; - - /// Transparent trigger. - const FortalSelect.ghost({ - super.key, - this.size = .size2, - required this.trigger, - required this.items, - this.selectedValue, - this.positioning = const OverlayPositionConfig( - targetAnchor: .bottomCenter, - followerAnchor: .topCenter, - ), - this.onChanged, - this.onOpen, - this.onClose, - this.enabled = true, - this.closeOnSelect = true, - this.semanticLabel, - this.focusNode, - }) : variant = FortalSelectVariant.ghost; - - final FortalSelectVariant variant; - - final FortalSelectSize size; - - final RemixSelectTrigger trigger; - - final List> items; - - final T? selectedValue; - - final OverlayPositionConfig positioning; - - final ValueChanged? onChanged; - - final VoidCallback? onOpen; - - final VoidCallback? onClose; - - final bool enabled; - - final bool closeOnSelect; - - final String? semanticLabel; - - final FocusNode? focusNode; - - @override - Widget build(BuildContext context) { - return fortalSelectStyler(variant: this.variant, size: this.size).call( - key: this.key, - trigger: this.trigger, - items: this.items, - selectedValue: this.selectedValue, - positioning: this.positioning, - onChanged: this.onChanged, - onOpen: this.onOpen, - onClose: this.onClose, - enabled: this.enabled, - closeOnSelect: this.closeOnSelect, - semanticLabel: this.semanticLabel, - focusNode: this.focusNode, - ); - } -} diff --git a/packages/remix/lib/src/components/select/select.g.dart b/packages/remix/lib/src/components/select/select.g.dart index cb6adc52..2579f2d3 100644 --- a/packages/remix/lib/src/components/select/select.g.dart +++ b/packages/remix/lib/src/components/select/select.g.dart @@ -260,6 +260,138 @@ mixin _$RemixSelectMenuItemSpec ) typedef _$RemixSelectMenuItemSpecMethods = _$RemixSelectMenuItemSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixSelect]. +class FortalSelect extends StatelessWidget { + const FortalSelect({ + super.key, + this.variant = .surface, + this.size = .size2, + required this.trigger, + required this.items, + this.selectedValue, + this.positioning = const OverlayPositionConfig( + targetAnchor: .bottomCenter, + followerAnchor: .topCenter, + ), + this.onChanged, + this.onOpen, + this.onClose, + this.enabled = true, + this.semanticLabel, + this.closeOnSelect = true, + this.focusNode, + }); + + /// Surface-backed trigger with border. + const FortalSelect.surface({ + super.key, + this.size = .size2, + required this.trigger, + required this.items, + this.selectedValue, + this.positioning = const OverlayPositionConfig( + targetAnchor: .bottomCenter, + followerAnchor: .topCenter, + ), + this.onChanged, + this.onOpen, + this.onClose, + this.enabled = true, + this.semanticLabel, + this.closeOnSelect = true, + this.focusNode, + }) : variant = FortalSelectVariant.surface; + + /// Soft accent trigger. + const FortalSelect.soft({ + super.key, + this.size = .size2, + required this.trigger, + required this.items, + this.selectedValue, + this.positioning = const OverlayPositionConfig( + targetAnchor: .bottomCenter, + followerAnchor: .topCenter, + ), + this.onChanged, + this.onOpen, + this.onClose, + this.enabled = true, + this.semanticLabel, + this.closeOnSelect = true, + this.focusNode, + }) : variant = FortalSelectVariant.soft; + + /// Transparent trigger. + const FortalSelect.ghost({ + super.key, + this.size = .size2, + required this.trigger, + required this.items, + this.selectedValue, + this.positioning = const OverlayPositionConfig( + targetAnchor: .bottomCenter, + followerAnchor: .topCenter, + ), + this.onChanged, + this.onOpen, + this.onClose, + this.enabled = true, + this.semanticLabel, + this.closeOnSelect = true, + this.focusNode, + }) : variant = FortalSelectVariant.ghost; + + final FortalSelectVariant variant; + + final FortalSelectSize size; + + final RemixSelectTrigger trigger; + + final List> items; + + final T? selectedValue; + + final OverlayPositionConfig positioning; + + final ValueChanged? onChanged; + + final VoidCallback? onOpen; + + final VoidCallback? onClose; + + final bool enabled; + + final String? semanticLabel; + + final bool closeOnSelect; + + final FocusNode? focusNode; + + @override + Widget build(BuildContext context) { + return RemixSelect( + key: this.key, + style: fortalSelectStyler(variant: this.variant, size: this.size), + trigger: this.trigger, + items: this.items, + selectedValue: this.selectedValue, + positioning: this.positioning, + onChanged: this.onChanged, + onOpen: this.onOpen, + onClose: this.onClose, + enabled: this.enabled, + semanticLabel: this.semanticLabel, + closeOnSelect: this.closeOnSelect, + focusNode: this.focusNode, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/slider/fortal_slider_styles.dart b/packages/remix/lib/src/components/slider/fortal_slider_styles.dart index fec8890a..5aa9188e 100644 --- a/packages/remix/lib/src/components/slider/fortal_slider_styles.dart +++ b/packages/remix/lib/src/components/slider/fortal_slider_styles.dart @@ -22,6 +22,11 @@ enum FortalSliderVariant { } /// Fortal-themed preset for [RemixSlider]. +@MixWidget( + name: 'FortalSlider', + target: RemixSlider.new, + factoryParameters: .only({'variant', 'size'}), +) RemixSliderStyler fortalSliderStyler({ FortalSliderVariant variant = .surface, FortalSliderSize size = .size2, @@ -97,99 +102,3 @@ RemixSliderStyler _fortalSliderSizeStyler(FortalSliderSize size) { } /// Fortal-themed preset for [RemixSlider]. -class FortalSlider extends StatelessWidget { - const FortalSlider({ - super.key, - this.variant = .surface, - this.size = .size2, - required this.value, - this.onChanged, - this.onChangeStart, - this.onChangeEnd, - this.min = 0.0, - this.max = 1.0, - this.enabled = true, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.snapDivisions, - }); - - /// Neutral track with the active accent indicator. - const FortalSlider.surface({ - super.key, - this.size = .size2, - required this.value, - this.onChanged, - this.onChangeStart, - this.onChangeEnd, - this.min = 0.0, - this.max = 1.0, - this.enabled = true, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.snapDivisions, - }) : variant = FortalSliderVariant.surface; - - /// Softer accent treatment for lower-emphasis controls. - const FortalSlider.soft({ - super.key, - this.size = .size2, - required this.value, - this.onChanged, - this.onChangeStart, - this.onChangeEnd, - this.min = 0.0, - this.max = 1.0, - this.enabled = true, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.snapDivisions, - }) : variant = FortalSliderVariant.soft; - - final FortalSliderVariant variant; - - final FortalSliderSize size; - - final double value; - - final ValueChanged? onChanged; - - final ValueChanged? onChangeStart; - - final ValueChanged? onChangeEnd; - - final double min; - - final double max; - - final bool enabled; - - final bool enableFeedback; - - final FocusNode? focusNode; - - final bool autofocus; - - final int? snapDivisions; - - @override - Widget build(BuildContext context) { - return fortalSliderStyler(variant: this.variant, size: this.size).call( - key: this.key, - value: this.value, - onChanged: this.onChanged, - onChangeStart: this.onChangeStart, - onChangeEnd: this.onChangeEnd, - min: this.min, - max: this.max, - enabled: this.enabled, - enableFeedback: this.enableFeedback, - focusNode: this.focusNode, - autofocus: this.autofocus, - snapDivisions: this.snapDivisions, - ); - } -} diff --git a/packages/remix/lib/src/components/slider/slider.g.dart b/packages/remix/lib/src/components/slider/slider.g.dart index 5ed4d404..de951155 100644 --- a/packages/remix/lib/src/components/slider/slider.g.dart +++ b/packages/remix/lib/src/components/slider/slider.g.dart @@ -106,6 +106,109 @@ mixin _$RemixSliderSpec implements Spec, Diagnosticable { ) typedef _$RemixSliderSpecMethods = _$RemixSliderSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixSlider]. +class FortalSlider extends StatelessWidget { + const FortalSlider({ + super.key, + this.variant = .surface, + this.size = .size2, + required this.value, + this.onChanged, + this.onChangeStart, + this.onChangeEnd, + this.min = 0.0, + this.max = 1.0, + this.enabled = true, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.snapDivisions, + }); + + /// Neutral track with the active accent indicator. + const FortalSlider.surface({ + super.key, + this.size = .size2, + required this.value, + this.onChanged, + this.onChangeStart, + this.onChangeEnd, + this.min = 0.0, + this.max = 1.0, + this.enabled = true, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.snapDivisions, + }) : variant = FortalSliderVariant.surface; + + /// Softer accent treatment for lower-emphasis controls. + const FortalSlider.soft({ + super.key, + this.size = .size2, + required this.value, + this.onChanged, + this.onChangeStart, + this.onChangeEnd, + this.min = 0.0, + this.max = 1.0, + this.enabled = true, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.snapDivisions, + }) : variant = FortalSliderVariant.soft; + + final FortalSliderVariant variant; + + final FortalSliderSize size; + + final double value; + + final ValueChanged? onChanged; + + final ValueChanged? onChangeStart; + + final ValueChanged? onChangeEnd; + + final double min; + + final double max; + + final bool enabled; + + final bool enableFeedback; + + final FocusNode? focusNode; + + final bool autofocus; + + final int? snapDivisions; + + @override + Widget build(BuildContext context) { + return RemixSlider( + key: this.key, + style: fortalSliderStyler(variant: this.variant, size: this.size), + value: this.value, + onChanged: this.onChanged, + onChangeStart: this.onChangeStart, + onChangeEnd: this.onChangeEnd, + min: this.min, + max: this.max, + enabled: this.enabled, + enableFeedback: this.enableFeedback, + focusNode: this.focusNode, + autofocus: this.autofocus, + snapDivisions: this.snapDivisions, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/spinner/fortal_spinner_styles.dart b/packages/remix/lib/src/components/spinner/fortal_spinner_styles.dart index d4f46191..e81fcab4 100644 --- a/packages/remix/lib/src/components/spinner/fortal_spinner_styles.dart +++ b/packages/remix/lib/src/components/spinner/fortal_spinner_styles.dart @@ -4,6 +4,11 @@ part of 'spinner.dart'; enum FortalSpinnerSize { size1, size2, size3 } /// Fortal-themed preset for [RemixSpinner]. +@MixWidget( + name: 'FortalSpinner', + target: RemixSpinner.new, + factoryParameters: .only({'size'}), +) RemixSpinnerStyler fortalSpinnerStyler({FortalSpinnerSize size = .size2}) { return RemixSpinnerStyler( indicatorColor: FortalTokens.accent9(), @@ -20,13 +25,3 @@ RemixSpinnerStyler _fortalSpinnerSizeStyler(FortalSpinnerSize size) { } /// Fortal-themed preset for [RemixSpinner]. -class FortalSpinner extends StatelessWidget { - const FortalSpinner({super.key, this.size = .size2}); - - final FortalSpinnerSize size; - - @override - Widget build(BuildContext context) { - return fortalSpinnerStyler(size: this.size).call(key: this.key); - } -} diff --git a/packages/remix/lib/src/components/spinner/spinner.g.dart b/packages/remix/lib/src/components/spinner/spinner.g.dart index d62a549c..57a36d65 100644 --- a/packages/remix/lib/src/components/spinner/spinner.g.dart +++ b/packages/remix/lib/src/components/spinner/spinner.g.dart @@ -116,6 +116,25 @@ mixin _$RemixSpinnerSpec implements Spec, Diagnosticable { ) typedef _$RemixSpinnerSpecMethods = _$RemixSpinnerSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixSpinner]. +class FortalSpinner extends StatelessWidget { + const FortalSpinner({super.key, this.size = .size2}); + + final FortalSpinnerSize size; + + @override + Widget build(BuildContext context) { + return RemixSpinner( + key: this.key, + style: fortalSpinnerStyler(size: this.size), + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/switch/fortal_switch_styles.dart b/packages/remix/lib/src/components/switch/fortal_switch_styles.dart index 218e52a2..bef09d76 100644 --- a/packages/remix/lib/src/components/switch/fortal_switch_styles.dart +++ b/packages/remix/lib/src/components/switch/fortal_switch_styles.dart @@ -22,6 +22,11 @@ enum FortalSwitchVariant { } /// Fortal-themed preset for [RemixSwitch]. +@MixWidget( + name: 'FortalSwitch', + target: RemixSwitch.new, + factoryParameters: .only({'variant', 'size'}), +) RemixSwitchStyler fortalSwitchStyler({ FortalSwitchVariant variant = .surface, FortalSwitchSize size = .size2, @@ -115,81 +120,3 @@ RemixSwitchStyler _fortalSwitchSizeStyler(FortalSwitchSize size) { } /// Fortal-themed preset for [RemixSwitch]. -class FortalSwitch extends StatelessWidget { - const FortalSwitch({ - super.key, - this.variant = .surface, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }); - - /// Surface treatment with a visible border. - const FortalSwitch.surface({ - super.key, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalSwitchVariant.surface; - - /// Softer accent treatment. - const FortalSwitch.soft({ - super.key, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalSwitchVariant.soft; - - final FortalSwitchVariant variant; - - final FortalSwitchSize size; - - final bool selected; - - final ValueChanged? onChanged; - - final bool enabled; - - final bool enableFeedback; - - final FocusNode? focusNode; - - final bool autofocus; - - final String? semanticLabel; - - final MouseCursor mouseCursor; - - @override - Widget build(BuildContext context) { - return fortalSwitchStyler(variant: this.variant, size: this.size).call( - key: this.key, - selected: this.selected, - onChanged: this.onChanged, - enabled: this.enabled, - enableFeedback: this.enableFeedback, - focusNode: this.focusNode, - autofocus: this.autofocus, - semanticLabel: this.semanticLabel, - mouseCursor: this.mouseCursor, - ); - } -} diff --git a/packages/remix/lib/src/components/switch/switch.g.dart b/packages/remix/lib/src/components/switch/switch.g.dart index 22b60941..a6377f33 100644 --- a/packages/remix/lib/src/components/switch/switch.g.dart +++ b/packages/remix/lib/src/components/switch/switch.g.dart @@ -85,6 +85,91 @@ mixin _$RemixSwitchSpec implements Spec, Diagnosticable { ) typedef _$RemixSwitchSpecMethods = _$RemixSwitchSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixSwitch]. +class FortalSwitch extends StatelessWidget { + const FortalSwitch({ + super.key, + this.variant = .surface, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }); + + /// Surface treatment with a visible border. + const FortalSwitch.surface({ + super.key, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalSwitchVariant.surface; + + /// Softer accent treatment. + const FortalSwitch.soft({ + super.key, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalSwitchVariant.soft; + + final FortalSwitchVariant variant; + + final FortalSwitchSize size; + + final bool selected; + + final ValueChanged? onChanged; + + final bool enabled; + + final bool enableFeedback; + + final FocusNode? focusNode; + + final bool autofocus; + + final String? semanticLabel; + + final MouseCursor mouseCursor; + + @override + Widget build(BuildContext context) { + return RemixSwitch( + key: this.key, + style: fortalSwitchStyler(variant: this.variant, size: this.size), + selected: this.selected, + onChanged: this.onChanged, + enabled: this.enabled, + enableFeedback: this.enableFeedback, + focusNode: this.focusNode, + autofocus: this.autofocus, + semanticLabel: this.semanticLabel, + mouseCursor: this.mouseCursor, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/tabs/fortal_tabs_styles.dart b/packages/remix/lib/src/components/tabs/fortal_tabs_styles.dart index bea03455..eb3bbc09 100644 --- a/packages/remix/lib/src/components/tabs/fortal_tabs_styles.dart +++ b/packages/remix/lib/src/components/tabs/fortal_tabs_styles.dart @@ -1,6 +1,11 @@ part of 'tabs.dart'; /// Fortal-themed preset for [RemixTabBar]. +@MixWidget( + name: 'FortalTabBar', + target: RemixTabBar.new, + factoryParameters: .only({}), +) RemixTabBarStyler fortalTabBarStyler() { return RemixTabBarStyler().container( FlexBoxStyler() @@ -11,11 +16,21 @@ RemixTabBarStyler fortalTabBarStyler() { } /// Fortal-themed preset for [RemixTabView]. +@MixWidget( + name: 'FortalTabView', + target: RemixTabView.new, + factoryParameters: .only({}), +) RemixTabViewStyler fortalTabViewStyler() { return RemixTabViewStyler().paddingAll(FortalTokens.space3()); } /// Fortal-themed preset for [RemixTab]. +@MixWidget( + name: 'FortalTab', + target: RemixTab.new, + factoryParameters: .only({}), +) RemixTabStyler fortalTabStyler() { return RemixTabStyler() .label(TextStyler().color(FortalTokens.gray12())) @@ -52,101 +67,5 @@ RemixTabStyler fortalTabStyler() { } /// Fortal-themed preset for [RemixTabBar]. -class FortalTabBar extends StatelessWidget { - const FortalTabBar({super.key, required this.child}); - - final Widget child; - - @override - Widget build(BuildContext context) { - return fortalTabBarStyler().call(key: this.key, child: this.child); - } -} - /// Fortal-themed preset for [RemixTabView]. -class FortalTabView extends StatelessWidget { - const FortalTabView({super.key, required this.tabId, required this.child}); - - final String tabId; - - final Widget child; - - @override - Widget build(BuildContext context) { - return fortalTabViewStyler().call( - key: this.key, - tabId: this.tabId, - child: this.child, - ); - } -} - /// Fortal-themed preset for [RemixTab]. -class FortalTab extends StatelessWidget { - const FortalTab({ - super.key, - required this.tabId, - this.child, - this.label, - this.icon, - this.enabled = true, - this.mouseCursor = SystemMouseCursors.click, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.onFocusChange, - this.onHoverChange, - this.onPressChange, - this.builder, - this.semanticLabel, - }); - - final String tabId; - - final Widget? child; - - final String? label; - - final IconData? icon; - - final bool enabled; - - final MouseCursor mouseCursor; - - final bool enableFeedback; - - final FocusNode? focusNode; - - final bool autofocus; - - final ValueChanged? onFocusChange; - - final ValueChanged? onHoverChange; - - final ValueChanged? onPressChange; - - final ValueWidgetBuilder? builder; - - final String? semanticLabel; - - @override - Widget build(BuildContext context) { - return fortalTabStyler().call( - key: this.key, - tabId: this.tabId, - label: this.label, - icon: this.icon, - enabled: this.enabled, - mouseCursor: this.mouseCursor, - enableFeedback: this.enableFeedback, - focusNode: this.focusNode, - autofocus: this.autofocus, - onFocusChange: this.onFocusChange, - onHoverChange: this.onHoverChange, - onPressChange: this.onPressChange, - semanticLabel: this.semanticLabel, - child: this.child, - builder: this.builder, - ); - } -} diff --git a/packages/remix/lib/src/components/tabs/tabs.g.dart b/packages/remix/lib/src/components/tabs/tabs.g.dart index df2bdac5..70173da2 100644 --- a/packages/remix/lib/src/components/tabs/tabs.g.dart +++ b/packages/remix/lib/src/components/tabs/tabs.g.dart @@ -224,6 +224,116 @@ mixin _$RemixTabViewSpec implements Spec, Diagnosticable { ) typedef _$RemixTabViewSpecMethods = _$RemixTabViewSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixTabBar]. +class FortalTabBar extends StatelessWidget { + const FortalTabBar({super.key, required this.child}); + + final Widget child; + + @override + Widget build(BuildContext context) { + return RemixTabBar( + key: this.key, + style: fortalTabBarStyler(), + child: this.child, + ); + } +} + +/// Fortal-themed preset for [RemixTabView]. +class FortalTabView extends StatelessWidget { + const FortalTabView({super.key, required this.tabId, required this.child}); + + final String tabId; + + final Widget child; + + @override + Widget build(BuildContext context) { + return RemixTabView( + key: this.key, + style: fortalTabViewStyler(), + tabId: this.tabId, + child: this.child, + ); + } +} + +/// Fortal-themed preset for [RemixTab]. +class FortalTab extends StatelessWidget { + const FortalTab({ + super.key, + required this.tabId, + this.child, + this.label, + this.icon, + this.enabled = true, + this.mouseCursor = SystemMouseCursors.click, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.onFocusChange, + this.onHoverChange, + this.onPressChange, + this.builder, + this.semanticLabel, + }); + + final String tabId; + + final Widget? child; + + final String? label; + + final IconData? icon; + + final bool enabled; + + final MouseCursor mouseCursor; + + final bool enableFeedback; + + final FocusNode? focusNode; + + final bool autofocus; + + final ValueChanged? onFocusChange; + + final ValueChanged? onHoverChange; + + final ValueChanged? onPressChange; + + final ValueWidgetBuilder? builder; + + final String? semanticLabel; + + @override + Widget build(BuildContext context) { + return RemixTab( + key: this.key, + style: fortalTabStyler(), + tabId: this.tabId, + child: this.child, + label: this.label, + icon: this.icon, + enabled: this.enabled, + mouseCursor: this.mouseCursor, + enableFeedback: this.enableFeedback, + focusNode: this.focusNode, + autofocus: this.autofocus, + onFocusChange: this.onFocusChange, + onHoverChange: this.onHoverChange, + onPressChange: this.onPressChange, + builder: this.builder, + semanticLabel: this.semanticLabel, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/textfield/fortal_textfield_styles.dart b/packages/remix/lib/src/components/textfield/fortal_textfield_styles.dart index 5f6156d8..ce863d42 100644 --- a/packages/remix/lib/src/components/textfield/fortal_textfield_styles.dart +++ b/packages/remix/lib/src/components/textfield/fortal_textfield_styles.dart @@ -22,6 +22,11 @@ enum FortalTextFieldVariant { } /// Fortal-themed preset for [RemixTextField]. +@MixWidget( + name: 'FortalTextField', + target: RemixTextField.new, + factoryParameters: .only({'variant', 'size'}), +) RemixTextFieldStyler fortalTextFieldStyler({ FortalTextFieldVariant variant = .surface, FortalTextFieldSize size = .size2, @@ -163,375 +168,3 @@ RemixTextFieldStyler _fortalTextFieldSizeStyler(FortalTextFieldSize size) { } /// Fortal-themed preset for [RemixTextField]. -class FortalTextField extends StatelessWidget { - const FortalTextField({ - super.key, - this.variant = .surface, - this.size = .size2, - this.controller, - this.focusNode, - this.label, - this.hintText, - this.helperText, - this.error = false, - this.keyboardType, - this.textInputAction, - this.textCapitalization = .none, - this.textDirection, - this.obscureText = false, - this.enabled = true, - this.readOnly = false, - this.autofocus = false, - this.maxLines = 1, - this.minLines, - this.expands = false, - this.maxLength, - this.maxLengthEnforcement, - this.onChanged, - this.onEditingComplete, - this.onSubmitted, - this.onAppPrivateCommand, - this.inputFormatters, - this.showCursor, - this.obscuringCharacter = '•', - this.autocorrect = true, - this.enableSuggestions = true, - this.smartDashesType, - this.smartQuotesType, - this.dragStartBehavior = .start, - this.enableInteractiveSelection = true, - this.selectionControls, - this.onTap, - this.onTapOutside, - this.onPressUpOutside, - this.onTapAlwaysCalled = false, - this.scrollController, - this.scrollPhysics, - this.autofillHints, - this.contentInsertionConfiguration, - this.clipBehavior = .hardEdge, - this.restorationId, - this.stylusHandwritingEnabled = true, - this.enableIMEPersonalizedLearning = true, - this.contextMenuBuilder, - this.spellCheckConfiguration, - this.magnifierConfiguration, - this.canRequestFocus = true, - this.ignorePointers, - this.undoController, - this.groupId = EditableText, - this.leading, - this.trailing, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - }); - - /// Surface treatment with neutral border and text colors. - const FortalTextField.surface({ - super.key, - this.size = .size2, - this.controller, - this.focusNode, - this.label, - this.hintText, - this.helperText, - this.error = false, - this.keyboardType, - this.textInputAction, - this.textCapitalization = .none, - this.textDirection, - this.obscureText = false, - this.enabled = true, - this.readOnly = false, - this.autofocus = false, - this.maxLines = 1, - this.minLines, - this.expands = false, - this.maxLength, - this.maxLengthEnforcement, - this.onChanged, - this.onEditingComplete, - this.onSubmitted, - this.onAppPrivateCommand, - this.inputFormatters, - this.showCursor, - this.obscuringCharacter = '•', - this.autocorrect = true, - this.enableSuggestions = true, - this.smartDashesType, - this.smartQuotesType, - this.dragStartBehavior = .start, - this.enableInteractiveSelection = true, - this.selectionControls, - this.onTap, - this.onTapOutside, - this.onPressUpOutside, - this.onTapAlwaysCalled = false, - this.scrollController, - this.scrollPhysics, - this.autofillHints, - this.contentInsertionConfiguration, - this.clipBehavior = .hardEdge, - this.restorationId, - this.stylusHandwritingEnabled = true, - this.enableIMEPersonalizedLearning = true, - this.contextMenuBuilder, - this.spellCheckConfiguration, - this.magnifierConfiguration, - this.canRequestFocus = true, - this.ignorePointers, - this.undoController, - this.groupId = EditableText, - this.leading, - this.trailing, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - }) : variant = FortalTextFieldVariant.surface; - - /// Soft accent treatment. - const FortalTextField.soft({ - super.key, - this.size = .size2, - this.controller, - this.focusNode, - this.label, - this.hintText, - this.helperText, - this.error = false, - this.keyboardType, - this.textInputAction, - this.textCapitalization = .none, - this.textDirection, - this.obscureText = false, - this.enabled = true, - this.readOnly = false, - this.autofocus = false, - this.maxLines = 1, - this.minLines, - this.expands = false, - this.maxLength, - this.maxLengthEnforcement, - this.onChanged, - this.onEditingComplete, - this.onSubmitted, - this.onAppPrivateCommand, - this.inputFormatters, - this.showCursor, - this.obscuringCharacter = '•', - this.autocorrect = true, - this.enableSuggestions = true, - this.smartDashesType, - this.smartQuotesType, - this.dragStartBehavior = .start, - this.enableInteractiveSelection = true, - this.selectionControls, - this.onTap, - this.onTapOutside, - this.onPressUpOutside, - this.onTapAlwaysCalled = false, - this.scrollController, - this.scrollPhysics, - this.autofillHints, - this.contentInsertionConfiguration, - this.clipBehavior = .hardEdge, - this.restorationId, - this.stylusHandwritingEnabled = true, - this.enableIMEPersonalizedLearning = true, - this.contextMenuBuilder, - this.spellCheckConfiguration, - this.magnifierConfiguration, - this.canRequestFocus = true, - this.ignorePointers, - this.undoController, - this.groupId = EditableText, - this.leading, - this.trailing, - this.semanticLabel, - this.semanticHint, - this.excludeSemantics = false, - }) : variant = FortalTextFieldVariant.soft; - - final FortalTextFieldVariant variant; - - final FortalTextFieldSize size; - - final TextEditingController? controller; - - final FocusNode? focusNode; - - final String? label; - - final String? hintText; - - final String? helperText; - - final bool error; - - final TextInputType? keyboardType; - - final TextInputAction? textInputAction; - - final TextCapitalization textCapitalization; - - final TextDirection? textDirection; - - final bool obscureText; - - final bool enabled; - - final bool readOnly; - - final bool autofocus; - - final int? maxLines; - - final int? minLines; - - final bool expands; - - final int? maxLength; - - final MaxLengthEnforcement? maxLengthEnforcement; - - final ValueChanged? onChanged; - - final VoidCallback? onEditingComplete; - - final ValueChanged? onSubmitted; - - final AppPrivateCommandCallback? onAppPrivateCommand; - - final List? inputFormatters; - - final bool? showCursor; - - final String obscuringCharacter; - - final bool autocorrect; - - final bool enableSuggestions; - - final SmartDashesType? smartDashesType; - - final SmartQuotesType? smartQuotesType; - - final DragStartBehavior dragStartBehavior; - - final bool enableInteractiveSelection; - - final TextSelectionControls? selectionControls; - - final GestureTapCallback? onTap; - - final TapRegionCallback? onTapOutside; - - final TapRegionUpCallback? onPressUpOutside; - - final bool onTapAlwaysCalled; - - final ScrollController? scrollController; - - final ScrollPhysics? scrollPhysics; - - final Iterable? autofillHints; - - final ContentInsertionConfiguration? contentInsertionConfiguration; - - final Clip clipBehavior; - - final String? restorationId; - - final bool stylusHandwritingEnabled; - - final bool enableIMEPersonalizedLearning; - - final EditableTextContextMenuBuilder? contextMenuBuilder; - - final SpellCheckConfiguration? spellCheckConfiguration; - - final TextMagnifierConfiguration? magnifierConfiguration; - - final bool canRequestFocus; - - final bool? ignorePointers; - - final UndoHistoryController? undoController; - - final Object groupId; - - final Widget? leading; - - final Widget? trailing; - - final String? semanticLabel; - - final String? semanticHint; - - final bool excludeSemantics; - - @override - Widget build(BuildContext context) { - return fortalTextFieldStyler(variant: this.variant, size: this.size).call( - key: this.key, - controller: this.controller, - focusNode: this.focusNode, - label: this.label, - hintText: this.hintText, - helperText: this.helperText, - error: this.error, - keyboardType: this.keyboardType, - textInputAction: this.textInputAction, - textCapitalization: this.textCapitalization, - textDirection: this.textDirection, - obscureText: this.obscureText, - enabled: this.enabled, - readOnly: this.readOnly, - autofocus: this.autofocus, - maxLines: this.maxLines, - minLines: this.minLines, - expands: this.expands, - maxLength: this.maxLength, - maxLengthEnforcement: this.maxLengthEnforcement, - onChanged: this.onChanged, - onEditingComplete: this.onEditingComplete, - onSubmitted: this.onSubmitted, - onAppPrivateCommand: this.onAppPrivateCommand, - inputFormatters: this.inputFormatters, - showCursor: this.showCursor, - obscuringCharacter: this.obscuringCharacter, - autocorrect: this.autocorrect, - enableSuggestions: this.enableSuggestions, - smartDashesType: this.smartDashesType, - smartQuotesType: this.smartQuotesType, - dragStartBehavior: this.dragStartBehavior, - enableInteractiveSelection: this.enableInteractiveSelection, - selectionControls: this.selectionControls, - onTap: this.onTap, - onTapOutside: this.onTapOutside, - onPressUpOutside: this.onPressUpOutside, - onTapAlwaysCalled: this.onTapAlwaysCalled, - scrollController: this.scrollController, - scrollPhysics: this.scrollPhysics, - autofillHints: this.autofillHints, - contentInsertionConfiguration: this.contentInsertionConfiguration, - clipBehavior: this.clipBehavior, - restorationId: this.restorationId, - stylusHandwritingEnabled: this.stylusHandwritingEnabled, - enableIMEPersonalizedLearning: this.enableIMEPersonalizedLearning, - contextMenuBuilder: this.contextMenuBuilder, - spellCheckConfiguration: this.spellCheckConfiguration, - magnifierConfiguration: this.magnifierConfiguration, - canRequestFocus: this.canRequestFocus, - ignorePointers: this.ignorePointers, - undoController: this.undoController, - groupId: this.groupId, - leading: this.leading, - trailing: this.trailing, - semanticLabel: this.semanticLabel, - semanticHint: this.semanticHint, - excludeSemantics: this.excludeSemantics, - ); - } -} diff --git a/packages/remix/lib/src/components/textfield/textfield.g.dart b/packages/remix/lib/src/components/textfield/textfield.g.dart index 461223e8..643a113a 100644 --- a/packages/remix/lib/src/components/textfield/textfield.g.dart +++ b/packages/remix/lib/src/components/textfield/textfield.g.dart @@ -189,6 +189,385 @@ mixin _$RemixTextFieldSpec implements Spec, Diagnosticable { ) typedef _$RemixTextFieldSpecMethods = _$RemixTextFieldSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixTextField]. +class FortalTextField extends StatelessWidget { + const FortalTextField({ + super.key, + this.variant = .surface, + this.size = .size2, + this.controller, + this.focusNode, + this.label, + this.hintText, + this.helperText, + this.error = false, + this.keyboardType, + this.textInputAction, + this.textCapitalization = .none, + this.textDirection, + this.obscureText = false, + this.enabled = true, + this.readOnly = false, + this.autofocus = false, + this.maxLines = 1, + this.minLines, + this.expands = false, + this.maxLength, + this.maxLengthEnforcement, + this.onChanged, + this.onEditingComplete, + this.onSubmitted, + this.onAppPrivateCommand, + this.inputFormatters, + this.showCursor, + this.obscuringCharacter = '•', + this.autocorrect = true, + this.enableSuggestions = true, + this.smartDashesType, + this.smartQuotesType, + this.dragStartBehavior = .start, + this.enableInteractiveSelection = true, + this.selectionControls, + this.onTap, + this.onTapOutside, + this.onPressUpOutside, + this.onTapAlwaysCalled = false, + this.scrollController, + this.scrollPhysics, + this.autofillHints, + this.contentInsertionConfiguration, + this.clipBehavior = .hardEdge, + this.restorationId, + this.stylusHandwritingEnabled = true, + this.enableIMEPersonalizedLearning = true, + this.contextMenuBuilder, + this.spellCheckConfiguration, + this.magnifierConfiguration, + this.canRequestFocus = true, + this.ignorePointers, + this.undoController, + this.groupId = EditableText, + this.leading, + this.trailing, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + }); + + /// Surface treatment with neutral border and text colors. + const FortalTextField.surface({ + super.key, + this.size = .size2, + this.controller, + this.focusNode, + this.label, + this.hintText, + this.helperText, + this.error = false, + this.keyboardType, + this.textInputAction, + this.textCapitalization = .none, + this.textDirection, + this.obscureText = false, + this.enabled = true, + this.readOnly = false, + this.autofocus = false, + this.maxLines = 1, + this.minLines, + this.expands = false, + this.maxLength, + this.maxLengthEnforcement, + this.onChanged, + this.onEditingComplete, + this.onSubmitted, + this.onAppPrivateCommand, + this.inputFormatters, + this.showCursor, + this.obscuringCharacter = '•', + this.autocorrect = true, + this.enableSuggestions = true, + this.smartDashesType, + this.smartQuotesType, + this.dragStartBehavior = .start, + this.enableInteractiveSelection = true, + this.selectionControls, + this.onTap, + this.onTapOutside, + this.onPressUpOutside, + this.onTapAlwaysCalled = false, + this.scrollController, + this.scrollPhysics, + this.autofillHints, + this.contentInsertionConfiguration, + this.clipBehavior = .hardEdge, + this.restorationId, + this.stylusHandwritingEnabled = true, + this.enableIMEPersonalizedLearning = true, + this.contextMenuBuilder, + this.spellCheckConfiguration, + this.magnifierConfiguration, + this.canRequestFocus = true, + this.ignorePointers, + this.undoController, + this.groupId = EditableText, + this.leading, + this.trailing, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + }) : variant = FortalTextFieldVariant.surface; + + /// Soft accent treatment. + const FortalTextField.soft({ + super.key, + this.size = .size2, + this.controller, + this.focusNode, + this.label, + this.hintText, + this.helperText, + this.error = false, + this.keyboardType, + this.textInputAction, + this.textCapitalization = .none, + this.textDirection, + this.obscureText = false, + this.enabled = true, + this.readOnly = false, + this.autofocus = false, + this.maxLines = 1, + this.minLines, + this.expands = false, + this.maxLength, + this.maxLengthEnforcement, + this.onChanged, + this.onEditingComplete, + this.onSubmitted, + this.onAppPrivateCommand, + this.inputFormatters, + this.showCursor, + this.obscuringCharacter = '•', + this.autocorrect = true, + this.enableSuggestions = true, + this.smartDashesType, + this.smartQuotesType, + this.dragStartBehavior = .start, + this.enableInteractiveSelection = true, + this.selectionControls, + this.onTap, + this.onTapOutside, + this.onPressUpOutside, + this.onTapAlwaysCalled = false, + this.scrollController, + this.scrollPhysics, + this.autofillHints, + this.contentInsertionConfiguration, + this.clipBehavior = .hardEdge, + this.restorationId, + this.stylusHandwritingEnabled = true, + this.enableIMEPersonalizedLearning = true, + this.contextMenuBuilder, + this.spellCheckConfiguration, + this.magnifierConfiguration, + this.canRequestFocus = true, + this.ignorePointers, + this.undoController, + this.groupId = EditableText, + this.leading, + this.trailing, + this.semanticLabel, + this.semanticHint, + this.excludeSemantics = false, + }) : variant = FortalTextFieldVariant.soft; + + final FortalTextFieldVariant variant; + + final FortalTextFieldSize size; + + final TextEditingController? controller; + + final FocusNode? focusNode; + + final String? label; + + final String? hintText; + + final String? helperText; + + final bool error; + + final TextInputType? keyboardType; + + final TextInputAction? textInputAction; + + final TextCapitalization textCapitalization; + + final TextDirection? textDirection; + + final bool obscureText; + + final bool enabled; + + final bool readOnly; + + final bool autofocus; + + final int? maxLines; + + final int? minLines; + + final bool expands; + + final int? maxLength; + + final MaxLengthEnforcement? maxLengthEnforcement; + + final ValueChanged? onChanged; + + final VoidCallback? onEditingComplete; + + final ValueChanged? onSubmitted; + + final AppPrivateCommandCallback? onAppPrivateCommand; + + final List? inputFormatters; + + final bool? showCursor; + + final String obscuringCharacter; + + final bool autocorrect; + + final bool enableSuggestions; + + final SmartDashesType? smartDashesType; + + final SmartQuotesType? smartQuotesType; + + final DragStartBehavior dragStartBehavior; + + final bool enableInteractiveSelection; + + final TextSelectionControls? selectionControls; + + final GestureTapCallback? onTap; + + final TapRegionCallback? onTapOutside; + + final TapRegionUpCallback? onPressUpOutside; + + final bool onTapAlwaysCalled; + + final ScrollController? scrollController; + + final ScrollPhysics? scrollPhysics; + + final Iterable? autofillHints; + + final ContentInsertionConfiguration? contentInsertionConfiguration; + + final Clip clipBehavior; + + final String? restorationId; + + final bool stylusHandwritingEnabled; + + final bool enableIMEPersonalizedLearning; + + final EditableTextContextMenuBuilder? contextMenuBuilder; + + final SpellCheckConfiguration? spellCheckConfiguration; + + final TextMagnifierConfiguration? magnifierConfiguration; + + final bool canRequestFocus; + + final bool? ignorePointers; + + final UndoHistoryController? undoController; + + final Object groupId; + + final Widget? leading; + + final Widget? trailing; + + final String? semanticLabel; + + final String? semanticHint; + + final bool excludeSemantics; + + @override + Widget build(BuildContext context) { + return RemixTextField( + key: this.key, + style: fortalTextFieldStyler(variant: this.variant, size: this.size), + controller: this.controller, + focusNode: this.focusNode, + label: this.label, + hintText: this.hintText, + helperText: this.helperText, + error: this.error, + keyboardType: this.keyboardType, + textInputAction: this.textInputAction, + textCapitalization: this.textCapitalization, + textDirection: this.textDirection, + obscureText: this.obscureText, + enabled: this.enabled, + readOnly: this.readOnly, + autofocus: this.autofocus, + maxLines: this.maxLines, + minLines: this.minLines, + expands: this.expands, + maxLength: this.maxLength, + maxLengthEnforcement: this.maxLengthEnforcement, + onChanged: this.onChanged, + onEditingComplete: this.onEditingComplete, + onSubmitted: this.onSubmitted, + onAppPrivateCommand: this.onAppPrivateCommand, + inputFormatters: this.inputFormatters, + showCursor: this.showCursor, + obscuringCharacter: this.obscuringCharacter, + autocorrect: this.autocorrect, + enableSuggestions: this.enableSuggestions, + smartDashesType: this.smartDashesType, + smartQuotesType: this.smartQuotesType, + dragStartBehavior: this.dragStartBehavior, + enableInteractiveSelection: this.enableInteractiveSelection, + selectionControls: this.selectionControls, + onTap: this.onTap, + onTapOutside: this.onTapOutside, + onPressUpOutside: this.onPressUpOutside, + onTapAlwaysCalled: this.onTapAlwaysCalled, + scrollController: this.scrollController, + scrollPhysics: this.scrollPhysics, + autofillHints: this.autofillHints, + contentInsertionConfiguration: this.contentInsertionConfiguration, + clipBehavior: this.clipBehavior, + restorationId: this.restorationId, + stylusHandwritingEnabled: this.stylusHandwritingEnabled, + enableIMEPersonalizedLearning: this.enableIMEPersonalizedLearning, + contextMenuBuilder: this.contextMenuBuilder, + spellCheckConfiguration: this.spellCheckConfiguration, + magnifierConfiguration: this.magnifierConfiguration, + canRequestFocus: this.canRequestFocus, + ignorePointers: this.ignorePointers, + undoController: this.undoController, + groupId: this.groupId, + leading: this.leading, + trailing: this.trailing, + semanticLabel: this.semanticLabel, + semanticHint: this.semanticHint, + excludeSemantics: this.excludeSemantics, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/toggle/fortal_toggle_styles.dart b/packages/remix/lib/src/components/toggle/fortal_toggle_styles.dart index a2c1a01f..cbe2c21f 100644 --- a/packages/remix/lib/src/components/toggle/fortal_toggle_styles.dart +++ b/packages/remix/lib/src/components/toggle/fortal_toggle_styles.dart @@ -7,6 +7,11 @@ enum FortalToggleSize { size1, size2, size3 } enum FortalToggleVariant { ghost, outline } /// Fortal-themed preset for [RemixToggle]. +@MixWidget( + name: 'FortalToggle', + target: RemixToggle.new, + factoryParameters: .only({'variant', 'size'}), +) RemixToggleStyler fortalToggleStyler({ FortalToggleVariant variant = .ghost, FortalToggleSize size = .size2, @@ -100,91 +105,3 @@ RemixToggleStyler _fortalToggleSizeStyler(FortalToggleSize size) { } /// Fortal-themed preset for [RemixToggle]. -class FortalToggle extends StatelessWidget { - const FortalToggle({ - super.key, - this.variant = .ghost, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.label, - this.icon, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }); - - const FortalToggle.ghost({ - super.key, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.label, - this.icon, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalToggleVariant.ghost; - - const FortalToggle.outline({ - super.key, - this.size = .size2, - required this.selected, - this.onChanged, - this.enabled = true, - this.label, - this.icon, - this.enableFeedback = true, - this.focusNode, - this.autofocus = false, - this.semanticLabel, - this.mouseCursor = SystemMouseCursors.click, - }) : variant = FortalToggleVariant.outline; - - final FortalToggleVariant variant; - - final FortalToggleSize size; - - final bool selected; - - final ValueChanged? onChanged; - - final bool enabled; - - final String? label; - - final IconData? icon; - - final bool enableFeedback; - - final FocusNode? focusNode; - - final bool autofocus; - - final String? semanticLabel; - - final MouseCursor mouseCursor; - - @override - Widget build(BuildContext context) { - return fortalToggleStyler(variant: this.variant, size: this.size).call( - key: this.key, - selected: this.selected, - onChanged: this.onChanged, - enabled: this.enabled, - label: this.label, - icon: this.icon, - enableFeedback: this.enableFeedback, - focusNode: this.focusNode, - autofocus: this.autofocus, - semanticLabel: this.semanticLabel, - mouseCursor: this.mouseCursor, - ); - } -} diff --git a/packages/remix/lib/src/components/toggle/toggle.g.dart b/packages/remix/lib/src/components/toggle/toggle.g.dart index d1314fa6..81ad10dc 100644 --- a/packages/remix/lib/src/components/toggle/toggle.g.dart +++ b/packages/remix/lib/src/components/toggle/toggle.g.dart @@ -90,6 +90,101 @@ mixin _$RemixToggleSpec implements Spec, Diagnosticable { ) typedef _$RemixToggleSpecMethods = _$RemixToggleSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixToggle]. +class FortalToggle extends StatelessWidget { + const FortalToggle({ + super.key, + this.variant = .ghost, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.label, + this.icon, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }); + + const FortalToggle.ghost({ + super.key, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.label, + this.icon, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalToggleVariant.ghost; + + const FortalToggle.outline({ + super.key, + this.size = .size2, + required this.selected, + this.onChanged, + this.enabled = true, + this.label, + this.icon, + this.enableFeedback = true, + this.focusNode, + this.autofocus = false, + this.semanticLabel, + this.mouseCursor = SystemMouseCursors.click, + }) : variant = FortalToggleVariant.outline; + + final FortalToggleVariant variant; + + final FortalToggleSize size; + + final bool selected; + + final ValueChanged? onChanged; + + final bool enabled; + + final String? label; + + final IconData? icon; + + final bool enableFeedback; + + final FocusNode? focusNode; + + final bool autofocus; + + final String? semanticLabel; + + final MouseCursor mouseCursor; + + @override + Widget build(BuildContext context) { + return RemixToggle( + key: this.key, + style: fortalToggleStyler(variant: this.variant, size: this.size), + selected: this.selected, + onChanged: this.onChanged, + enabled: this.enabled, + label: this.label, + icon: this.icon, + enableFeedback: this.enableFeedback, + focusNode: this.focusNode, + autofocus: this.autofocus, + semanticLabel: this.semanticLabel, + mouseCursor: this.mouseCursor, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/toggle_group/fortal_toggle_group_styles.dart b/packages/remix/lib/src/components/toggle_group/fortal_toggle_group_styles.dart index 2a11539b..a8a62a60 100644 --- a/packages/remix/lib/src/components/toggle_group/fortal_toggle_group_styles.dart +++ b/packages/remix/lib/src/components/toggle_group/fortal_toggle_group_styles.dart @@ -7,6 +7,11 @@ enum FortalToggleGroupSize { size1, size2, size3 } enum FortalToggleGroupVariant { soft, surface } /// Fortal-themed segmented-control preset for [RemixToggleGroup]. +@MixWidget( + name: 'FortalToggleGroup', + target: RemixToggleGroup.new, + factoryParameters: .only({'variant', 'size'}), +) RemixToggleGroupStyler fortalToggleGroupStyler({ FortalToggleGroupVariant variant = .soft, FortalToggleGroupSize size = .size2, @@ -99,82 +104,3 @@ RemixToggleGroupStyler _fortalToggleGroupSizeStyler( } /// Fortal-themed segmented-control preset for [RemixToggleGroup]. -class FortalToggleGroup extends StatelessWidget { - const FortalToggleGroup({ - super.key, - this.variant = .soft, - this.size = .size2, - required this.items, - required this.selectedValue, - this.onChanged, - this.enabled = true, - this.orientation = .horizontal, - this.loop = true, - this.semanticLabel, - this.excludeSemantics = false, - }); - - const FortalToggleGroup.soft({ - super.key, - this.size = .size2, - required this.items, - required this.selectedValue, - this.onChanged, - this.enabled = true, - this.orientation = .horizontal, - this.loop = true, - this.semanticLabel, - this.excludeSemantics = false, - }) : variant = FortalToggleGroupVariant.soft; - - const FortalToggleGroup.surface({ - super.key, - this.size = .size2, - required this.items, - required this.selectedValue, - this.onChanged, - this.enabled = true, - this.orientation = .horizontal, - this.loop = true, - this.semanticLabel, - this.excludeSemantics = false, - }) : variant = FortalToggleGroupVariant.surface; - - final FortalToggleGroupVariant variant; - - final FortalToggleGroupSize size; - - final List> items; - - final T? selectedValue; - - final ValueChanged? onChanged; - - final bool enabled; - - final Axis orientation; - - final bool loop; - - final String? semanticLabel; - - final bool excludeSemantics; - - @override - Widget build(BuildContext context) { - return fortalToggleGroupStyler( - variant: this.variant, - size: this.size, - ).call( - key: this.key, - items: this.items, - selectedValue: this.selectedValue, - onChanged: this.onChanged, - enabled: this.enabled, - orientation: this.orientation, - loop: this.loop, - semanticLabel: this.semanticLabel, - excludeSemantics: this.excludeSemantics, - ); - } -} diff --git a/packages/remix/lib/src/components/toggle_group/toggle_group.g.dart b/packages/remix/lib/src/components/toggle_group/toggle_group.g.dart index c98391cc..077a138a 100644 --- a/packages/remix/lib/src/components/toggle_group/toggle_group.g.dart +++ b/packages/remix/lib/src/components/toggle_group/toggle_group.g.dart @@ -171,6 +171,89 @@ mixin _$RemixToggleGroupItemSpec ) typedef _$RemixToggleGroupItemSpecMethods = _$RemixToggleGroupItemSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed segmented-control preset for [RemixToggleGroup]. +class FortalToggleGroup extends StatelessWidget { + const FortalToggleGroup({ + super.key, + this.variant = .soft, + this.size = .size2, + required this.items, + required this.selectedValue, + this.onChanged, + this.enabled = true, + this.orientation = .horizontal, + this.loop = true, + this.semanticLabel, + this.excludeSemantics = false, + }); + + const FortalToggleGroup.soft({ + super.key, + this.size = .size2, + required this.items, + required this.selectedValue, + this.onChanged, + this.enabled = true, + this.orientation = .horizontal, + this.loop = true, + this.semanticLabel, + this.excludeSemantics = false, + }) : variant = FortalToggleGroupVariant.soft; + + const FortalToggleGroup.surface({ + super.key, + this.size = .size2, + required this.items, + required this.selectedValue, + this.onChanged, + this.enabled = true, + this.orientation = .horizontal, + this.loop = true, + this.semanticLabel, + this.excludeSemantics = false, + }) : variant = FortalToggleGroupVariant.surface; + + final FortalToggleGroupVariant variant; + + final FortalToggleGroupSize size; + + final List> items; + + final T? selectedValue; + + final ValueChanged? onChanged; + + final bool enabled; + + final Axis orientation; + + final bool loop; + + final String? semanticLabel; + + final bool excludeSemantics; + + @override + Widget build(BuildContext context) { + return RemixToggleGroup( + key: this.key, + style: fortalToggleGroupStyler(variant: this.variant, size: this.size), + items: this.items, + selectedValue: this.selectedValue, + onChanged: this.onChanged, + enabled: this.enabled, + orientation: this.orientation, + loop: this.loop, + semanticLabel: this.semanticLabel, + excludeSemantics: this.excludeSemantics, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/lib/src/components/tooltip/fortal_tooltip_styles.dart b/packages/remix/lib/src/components/tooltip/fortal_tooltip_styles.dart index bb19c53a..02f70190 100644 --- a/packages/remix/lib/src/components/tooltip/fortal_tooltip_styles.dart +++ b/packages/remix/lib/src/components/tooltip/fortal_tooltip_styles.dart @@ -1,6 +1,11 @@ part of 'tooltip.dart'; /// Fortal-themed preset for [RemixTooltip]. +@MixWidget( + name: 'FortalTooltip', + target: RemixTooltip.new, + factoryParameters: .only({}), +) RemixTooltipStyler fortalTooltipStyler() { return RemixTooltipStyler() .borderRadiusAll(FortalTokens.radius2()) @@ -14,31 +19,3 @@ RemixTooltipStyler fortalTooltipStyler() { } /// Fortal-themed preset for [RemixTooltip]. -class FortalTooltip extends StatelessWidget { - const FortalTooltip({ - super.key, - required this.tooltipChild, - required this.child, - this.tooltipSemantics, - this.positioning = const OverlayPositionConfig(), - }); - - final Widget tooltipChild; - - final Widget child; - - final String? tooltipSemantics; - - final OverlayPositionConfig positioning; - - @override - Widget build(BuildContext context) { - return fortalTooltipStyler().call( - key: this.key, - tooltipChild: this.tooltipChild, - tooltipSemantics: this.tooltipSemantics, - positioning: this.positioning, - child: this.child, - ); - } -} diff --git a/packages/remix/lib/src/components/tooltip/tooltip.g.dart b/packages/remix/lib/src/components/tooltip/tooltip.g.dart index 5215206b..89fbc734 100644 --- a/packages/remix/lib/src/components/tooltip/tooltip.g.dart +++ b/packages/remix/lib/src/components/tooltip/tooltip.g.dart @@ -110,6 +110,41 @@ mixin _$RemixTooltipSpec implements Spec, Diagnosticable { ) typedef _$RemixTooltipSpecMethods = _$RemixTooltipSpec; // ignore: unused_element +// ************************************************************************** +// MixWidgetGenerator +// ************************************************************************** + +/// Fortal-themed preset for [RemixTooltip]. +class FortalTooltip extends StatelessWidget { + const FortalTooltip({ + super.key, + required this.tooltipChild, + required this.child, + this.tooltipSemantics, + this.positioning = const OverlayPositionConfig(), + }); + + final Widget tooltipChild; + + final Widget child; + + final String? tooltipSemantics; + + final OverlayPositionConfig positioning; + + @override + Widget build(BuildContext context) { + return RemixTooltip( + key: this.key, + style: fortalTooltipStyler(), + tooltipChild: this.tooltipChild, + child: this.child, + tooltipSemantics: this.tooltipSemantics, + positioning: this.positioning, + ); + } +} + // ************************************************************************** // SpecStylerGenerator // ************************************************************************** diff --git a/packages/remix/pubspec.yaml b/packages/remix/pubspec.yaml index 70e0758c..7d7f3b77 100644 --- a/packages/remix/pubspec.yaml +++ b/packages/remix/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: flutter: sdk: flutter mix: ^2.1.0 - mix_annotations: ^2.2.0-beta.0 + mix_annotations: ^2.2.0-beta.1 naked_ui: ^1.0.0-beta.4 dev_dependencies: @@ -30,7 +30,7 @@ dev_dependencies: sdk: flutter build_runner: ^2.10.1 meta: ^1.18.0 - mix_generator: ^2.2.0-beta.0 + mix_generator: ^2.2.0-beta.2 flutter: uses-material-design: true diff --git a/packages/remix/tool/check_generated.dart b/packages/remix/tool/check_generated.dart new file mode 100644 index 00000000..46b7364d --- /dev/null +++ b/packages/remix/tool/check_generated.dart @@ -0,0 +1,85 @@ +import 'dart:io'; + +Future main() async { + final packageRoot = Directory.current.absolute; + final pubspec = File('${packageRoot.path}/pubspec.yaml'); + if (!pubspec.existsSync() || + !pubspec.readAsStringSync().contains('name: remix')) { + stderr.writeln('Run this checker from packages/remix.'); + exitCode = 64; + return; + } + + final libraryRoot = Directory('${packageRoot.path}/lib'); + final before = _generatedSnapshot(libraryRoot); + if (before.isEmpty) { + stderr.writeln('No committed generated Dart files were found.'); + exitCode = 1; + return; + } + + for (final path in before.keys) { + File('${libraryRoot.path}/$path').deleteSync(); + } + + final process = await Process.start( + Platform.resolvedExecutable, + ['run', 'build_runner', 'build'], + workingDirectory: packageRoot.path, + mode: ProcessStartMode.inheritStdio, + ); + final buildExitCode = await process.exitCode; + if (buildExitCode != 0) { + exitCode = buildExitCode; + return; + } + + final after = _generatedSnapshot(libraryRoot); + final paths = {...before.keys, ...after.keys}.toList()..sort(); + final drift = []; + for (final path in paths) { + final oldBytes = before[path]; + final newBytes = after[path]; + if (oldBytes == null) { + drift.add('$path (created)'); + } else if (newBytes == null) { + drift.add('$path (missing)'); + } else if (!_sameBytes(oldBytes, newBytes)) { + drift.add('$path (changed)'); + } + } + + if (drift.isNotEmpty) { + stderr.writeln('Clean generated source drift detected (${drift.length}):'); + for (final path in drift) { + stderr.writeln('- $path'); + } + exitCode = 1; + return; + } + + stdout.writeln( + 'Clean generation reproduced ${after.length} committed artifacts ' + 'byte-for-byte.', + ); +} + +Map> _generatedSnapshot(Directory root) { + final snapshot = >{}; + for (final entity in root.listSync(recursive: true, followLinks: false)) { + if (entity is! File || !entity.path.endsWith('.g.dart')) continue; + snapshot[_relativePath(root, entity)] = entity.readAsBytesSync(); + } + return snapshot; +} + +String _relativePath(Directory root, File file) => + file.path.substring(root.path.length + 1); + +bool _sameBytes(List left, List right) { + if (left.length != right.length) return false; + for (var index = 0; index < left.length; index += 1) { + if (left[index] != right[index]) return false; + } + return true; +} diff --git a/pubspec.yaml b/pubspec.yaml index 714d5706..efff28a8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,10 +32,10 @@ melos: scope: remix generate:check: - steps: - - generate - - git diff --exit-code -- packages/remix/lib - description: Regenerate Remix sources and fail on generated drift + exec: dart run tool/check_generated.dart + description: Delete and reproducibly regenerate committed Remix artifacts + packageFilters: + scope: remix test:flutter: exec: flutter test --reporter=failures-only From 61ab55366a39d67297516e3edc7b3c28f62edc96 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Fri, 24 Jul 2026 11:23:40 -0400 Subject: [PATCH 2/2] chore(deps): lock released Mix generator betas --- pubspec.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 9254b49b..3cdb72c6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -437,18 +437,18 @@ packages: dependency: transitive description: name: mix_annotations - sha256: f8b9ed018f70a1b376df0fcc16e965ebdcdd56ac3110f9d13de7d50405206c4a + sha256: "955ea7a1b647f96033315585cbe3ca94f5204216787eb11884e566d720ce7d86" url: "https://pub.dev" source: hosted - version: "2.2.0-beta.0" + version: "2.2.0-beta.1" mix_generator: dependency: transitive description: name: mix_generator - sha256: "76d888e0845e7bb3bc6bee3d903bbb0611ec7f27b8b6c554deef62775b59654b" + sha256: "28bf9e71a5a79a02189bec1d5f9d4b0fa560532a36228ff8613272240b091b55" url: "https://pub.dev" source: hosted - version: "2.2.0-beta.0" + version: "2.2.0-beta.2" mix_protocol: dependency: transitive description: