diff --git a/json_theme/CHANGELOG.md b/json_theme/CHANGELOG.md index f47b501..f3e6bd1 100644 --- a/json_theme/CHANGELOG.md +++ b/json_theme/CHANGELOG.md @@ -1,4 +1,4 @@ -## [7.0.0-dev.1] - November 30th, 2024 +## [7.0.0] - December 12th, 2024 * Add support to flutter 3.27 diff --git a/json_theme/lib/src/codec/theme_decoder.dart b/json_theme/lib/src/codec/theme_decoder.dart index 23320a0..cc4f536 100644 --- a/json_theme/lib/src/codec/theme_decoder.dart +++ b/json_theme/lib/src/codec/theme_decoder.dart @@ -395,6 +395,40 @@ class ThemeDecoder { return result; } + /// Decodes the given [value] to an [AnimationStyle]. Supported + /// values are: + /// * `noAnimation` + static AnimationStyle? decodeAnimationStyle(dynamic value, + {bool validate = true}) { + AnimationStyle? result; + + if (value is AnimationStyle) { + result = value; + } else if (value != null) { + _checkSupported( + 'AnimationStyle', + [ + 'noAnimation', + ], + value, + ); + + assert(SchemaValidator.validate( + schemaId: '$_baseSchemaUrl/animation_style', + value: value, + validate: validate, + )); + + switch (value) { + case 'noAnimation': + result = AnimationStyle.noAnimation; + break; + } + } + + return result; + } + /// Decodes the given [value] to an [AppBarTheme]. This expects the given /// [value] to follow the structure below: /// @@ -2456,6 +2490,76 @@ class ThemeDecoder { validate: validate, )); result = CardTheme( + clipBehavior: decodeClip( + value['clipBehavior'], + validate: false, + ), + color: decodeColor( + value['color'], + validate: false, + ), + data: decodeCardThemeData( + value['data'], + validate: false, + ), + elevation: JsonClass.maybeParseDouble(value['elevation']), + margin: decodeEdgeInsetsGeometry( + value['margin'], + validate: false, + ), + shadowColor: decodeColor( + value['shadowColor'], + validate: false, + ), + shape: decodeShapeBorder( + value['shape'], + validate: false, + ), + surfaceTintColor: decodeColor( + value['surfaceTintColor'], + validate: false, + ), + ); + } + + return result; + } + + /// Decodes the given [value] to an [CardThemeData]. This expects the + /// given [value] to follow the structure below: + /// + /// ```json + /// { + /// "clipBehavior": "", + /// "color": "", + /// "elevation": "", + /// "margin": "", + /// "shadowColor": "", + /// "shape": "", + /// "surfaceTintColor": "" + /// } + /// ``` + /// + /// See also: + /// * [decodeClip] + /// * [decodeColor] + /// * [decodeEdgeInsetsGeometry] + /// * [decodeShapeBorder] + static CardThemeData? decodeCardThemeData( + dynamic value, { + bool validate = true, + }) { + CardThemeData? result; + + if (value is CardThemeData) { + result = value; + } else if (value != null) { + assert(SchemaValidator.validate( + schemaId: '$_baseSchemaUrl/card_theme_data', + value: value, + validate: validate, + )); + result = CardThemeData( clipBehavior: decodeClip( value['clipBehavior'], validate: false, @@ -2572,10 +2676,12 @@ class ThemeDecoder { /// /// ```json /// { + /// "avatarBoxConstraints": "", /// "brightness": "", /// "checkmarkColor": "", - /// "color": ">" + /// "color": ">", + /// "deleteIconBoxConstraints": "", /// "deleteIconColor": "", /// "disabledColor": "", /// "elevation": "", @@ -2598,6 +2704,7 @@ class ThemeDecoder { /// /// See also: /// * [decodeBorderSide] + /// * [decodeBoxConstraints] /// * [decodeBrightness] /// * [decodeColor] /// * [decodeEdgeInsetsGeometry] @@ -2620,6 +2727,10 @@ class ThemeDecoder { validate: validate, )); result = ChipThemeData( + avatarBoxConstraints: decodeBoxConstraints( + value['avatarBoxConstraints'], + validate: false, + ), backgroundColor: decodeColor( value['backgroundColor'], validate: false, @@ -2636,6 +2747,10 @@ class ThemeDecoder { value['color'], validate: false, ), + deleteIconBoxConstraints: decodeBoxConstraints( + value['deleteIconBoxConstraints'], + validate: false, + ), deleteIconColor: decodeColor( value['deleteIconColor'], validate: false, @@ -2994,7 +3109,6 @@ class ThemeDecoder { value['onPrimaryFixedVariant'], validate: false, ), - onSecondary: decodeColor( value['onSecondary'], validate: false, @@ -3244,6 +3358,7 @@ class ThemeDecoder { /// /// ```json /// { + /// "actionSmallTextStyle": "", /// "actionTextStyle": "", /// "dateTimePickerTextStyle": "", /// "navActionTextStyle": "", @@ -3274,6 +3389,10 @@ class ThemeDecoder { validate: validate, )); result = CupertinoTextThemeData( + actionSmallTextStyle: decodeTextStyle( + value['actionSmallTextStyle'], + validate: false, + ), actionTextStyle: decodeTextStyle( value['actionTextStyle'], validate: false, @@ -3393,6 +3512,7 @@ class ThemeDecoder { /// "dayBackgroundColor": ">", /// "dayForegroundColor": ">", /// "dayOverlayColor": ">", + /// "dayShape": "", /// "dayStyle": "", /// "dividerColor": "", /// "elevation": "", @@ -3435,9 +3555,10 @@ class ThemeDecoder { /// * [decodeButtonStyle] /// * [decodeColor] /// * [decodeInputDecorationTheme] - /// * [decodeWidgetStatePropertyColor] /// * [decodeShapeBorder] /// * [decodeTextStyle] + /// * [decodeWidgetStatePropertyColor] + /// * [decodeWidgetStatePropertyOutlinedBorder] static DatePickerThemeData? decodeDatePickerThemeData( dynamic value, { bool validate = true, @@ -3477,6 +3598,10 @@ class ThemeDecoder { value['dayOverlayColor'], validate: false, ), + dayShape: decodeWidgetStatePropertyOutlinedBorder( + value['dayShape'], + validate: false, + ), dayStyle: decodeTextStyle( value['dayStyle'], validate: false, @@ -3506,6 +3631,10 @@ class ThemeDecoder { value['inputDecorationTheme'], validate: false, ), + locale: decodeLocale( + value, + validate: false, + ), rangePickerBackgroundColor: decodeColor( value['rangePickerBackgroundColor'], validate: false, @@ -3614,6 +3743,7 @@ class ThemeDecoder { /// "dividerThickness": "", /// "headingCellCursor": "", /// "headingRowColor": ">", + /// "headingRowAlignment": "" /// "headingRowHeight": "", /// "headingTextStyle": "", /// "horizontalMargin": "" @@ -3627,9 +3757,10 @@ class ThemeDecoder { /// See also: /// * [decodeBoxDecoration] /// * [decodeColor] + /// * [decodeMainAxisAlignment] + /// * [decodeTextStyle] /// * [decodeWidgetStatePropertyColor] /// * [decodeWidgetStatePropertyMouseCursor] - /// * [decodeTextStyle] static DataTableThemeData? decodeDataTableThemeData( dynamic value, { bool validate = true, @@ -3682,6 +3813,10 @@ class ThemeDecoder { value['dataRowCursor'], validate: false, ), + headingRowAlignment: decodeMainAxisAlignment( + value['headingRowAlignment'], + validate: false, + ), headingRowColor: decodeWidgetStatePropertyColor( value['headingRowColor'], validate: false, @@ -3832,9 +3967,13 @@ class ThemeDecoder { /// "actionsPadding": "", /// "alignment": "", /// "backgroundColor": "", + /// "barrierColor": "", + /// "clipBehavior": "", /// "contentTextStyle": "", + /// "data": "", /// "elevation": "", /// "iconColor": "", + /// "insetPadding": "", /// "shadowColor": "", /// "shape": "", /// "surfaceColor": "", @@ -3845,7 +3984,10 @@ class ThemeDecoder { /// See also: /// * [decodeAlignment] /// * [decodeBrightness] + /// * [decodeClip] /// * [decodeColor] + /// * [decodeDialogThemeData] + /// * [decodeEdgeInsets] /// * [decodeEdgeInsetsGeometry] /// * [decodeShapeBorder] /// * [decodeTextStyle] @@ -3876,15 +4018,31 @@ class ThemeDecoder { value['backgroundColor'], validate: false, ), + barrierColor: decodeColor( + value['barrierColor'], + validate: false, + ), + clipBehavior: decodeClip( + value['clipBehavior'], + validate: false, + ), contentTextStyle: decodeTextStyle( value['contentTextStyle'], validate: false, ), + data: decodeDialogThemeData( + value['data'], + validate: false, + ), elevation: JsonClass.maybeParseDouble(value['elevation']), iconColor: decodeColor( value['iconColor'], validate: false, ), + insetPadding: decodeEdgeInsets( + value['insetPadding'], + validate: false, + ), shadowColor: decodeColor( value['shadowColor'], validate: false, @@ -3907,6 +4065,172 @@ class ThemeDecoder { return result; } + /// Decodes the given [value] to an [DialogThemeData]. This expects the given + /// [value] to follow the structure below: + /// + /// ```json + /// { + /// "actionsPadding": "", + /// "alignment": "", + /// "backgroundColor": "", + /// "barrierColor": "", + /// "clipBehavior": "", + /// "contentTextStyle": "", + /// "elevation": "", + /// "iconColor": "", + /// "insetPadding": "", + /// "shadowColor": "", + /// "shape": "", + /// "surfaceColor": "", + /// "titleTextStyle": "" + /// } + /// ``` + /// + /// See also: + /// * [decodeAlignment] + /// * [decodeBrightness] + /// * [decodeClip] + /// * [decodeColor] + /// * [decodeEdgeInsets] + /// * [decodeEdgeInsetsGeometry] + /// * [decodeShapeBorder] + /// * [decodeTextStyle] + static DialogThemeData? decodeDialogThemeData( + dynamic value, { + bool validate = true, + }) { + DialogThemeData? result; + + if (value is DialogThemeData) { + result = value; + } else if (value != null) { + assert(SchemaValidator.validate( + schemaId: '$_baseSchemaUrl/dialog_theme_data', + value: value, + validate: validate, + )); + result = DialogThemeData( + actionsPadding: decodeEdgeInsetsGeometry( + value['actionsPadding'], + validate: false, + ), + alignment: decodeAlignment( + value['alignment'], + validate: false, + ), + backgroundColor: decodeColor( + value['backgroundColor'], + validate: false, + ), + barrierColor: decodeColor( + value['barrierColor'], + validate: false, + ), + clipBehavior: decodeClip( + value['clipBehavior'], + validate: false, + ), + contentTextStyle: decodeTextStyle( + value['contentTextStyle'], + validate: false, + ), + elevation: JsonClass.maybeParseDouble(value['elevation']), + iconColor: decodeColor( + value['iconColor'], + validate: false, + ), + insetPadding: decodeEdgeInsets( + value['insetPadding'], + validate: false, + ), + shadowColor: decodeColor( + value['shadowColor'], + validate: false, + ), + shape: decodeShapeBorder( + value['shape'], + validate: false, + ), + surfaceTintColor: decodeColor( + value['surfaceTintColor'], + validate: false, + ), + titleTextStyle: decodeTextStyle( + value['titleTextStyle'], + validate: false, + ), + ); + } + + return result; + } + + /// Decodes the [value] to a [DismissDirection]. Supported values are: + /// * `down` + /// * `endToStart` + /// * `horizontal' + /// * `none' + /// * `startToEnd` + /// * `up` + /// * `vertical` + static DismissDirection? decodeDismissDirection( + dynamic value, { + bool validate = true, + }) { + DismissDirection? result; + + if (value is DismissDirection) { + result = value; + } else { + _checkSupported( + 'DismissDirection', + [ + 'down', + 'endToStart', + 'horizontal', + 'none', + 'startToEnd', + 'up', + 'vertical', + ], + value, + ); + + if (value != null) { + assert(SchemaValidator.validate( + schemaId: '$_baseSchemaUrl/dismiss_direction', + value: value, + validate: validate, + )); + switch (value) { + case 'down': + result = DismissDirection.down; + break; + case 'endToStart': + result = DismissDirection.endToStart; + break; + case 'horizontal': + result = DismissDirection.horizontal; + break; + case 'none': + result = DismissDirection.none; + break; + case 'startToEnd': + result = DismissDirection.startToEnd; + break; + case 'up': + result = DismissDirection.up; + break; + case 'vertical': + result = DismissDirection.vertical; + break; + } + } + } + + return result; + } + /// Decodes the given [value] to an [DividerThemeData]. This expects the given /// [value] to follow the structure below: /// @@ -3998,6 +4322,7 @@ class ThemeDecoder { /// ```json /// { /// "backgroundColor": "", + /// "clipBehavior": "", /// "elevation": "", /// "endShape": "", /// "scrimColor": "", @@ -4031,6 +4356,10 @@ class ThemeDecoder { value['backgroundColor'], validate: false, ), + clipBehavior: decodeClip( + value['clipBehavior'], + validate: false, + ), elevation: JsonClass.maybeParseDouble(value['elevation']), endShape: decodeShapeBorder( value['endShape'], @@ -4336,6 +4665,7 @@ class ThemeDecoder { /// "collapsedShape": "", /// "collapsedTextColor": "", /// "expandedAlignment": "", + /// "expansionAnimationStyle": "", /// "iconColor": "", /// "shape": "", /// "textColor": "", @@ -4345,6 +4675,7 @@ class ThemeDecoder { /// /// See also: /// * [decodeAlignment] + /// * [decodeAnimationStyle] /// * [decodeClip] /// * [decodeColor] /// * [decodeEdgeInsetsGeometry] @@ -4397,6 +4728,10 @@ class ThemeDecoder { value['expandedAlignment'], validate: false, ), + expansionAnimationStyle: decodeAnimationStyle( + value['expansionAnimationStyle'], + validate: false, + ), iconColor: decodeColor( value['iconColor'], validate: false, @@ -5431,6 +5766,8 @@ class ThemeDecoder { /// /// ```json /// { + /// "applyTextScaling": "", + /// "blendMode": "", /// "color": "", /// "fill": "", /// "grade": "", @@ -5445,6 +5782,7 @@ class ThemeDecoder { /// ``` /// /// See also: + /// * [decodeBlendMode] /// * [decodeColor] /// * [decodeIconData] /// * [decodeShadow] @@ -5465,6 +5803,11 @@ class ThemeDecoder { )); result = Icon( decodeIconData(value['icon'], validate: false)!, + applyTextScaling: JsonClass.maybeParseBool(value['applyTextScaling']), + blendMode: decodeBlendMode( + value['blendMode'], + validate: false, + ), color: ThemeDecoder.decodeColor( value['color'], validate: false, @@ -5535,6 +5878,7 @@ class ThemeDecoder { /// { /// "codePoint": "", /// "fontFamily": "", + /// "fontFamilyFallback": ">", /// "fontPackage": "", /// "matchTextDirection": "" /// } @@ -5556,6 +5900,7 @@ class ThemeDecoder { result = IconData( JsonClass.maybeParseInt(value['codePoint'])!, fontFamily: value['fontFamily'], + fontFamilyFallback: value['fontFamilyFallback'], fontPackage: value['fontPackage'], matchTextDirection: JsonClass.parseBool(value['matchTextDirection']), ); @@ -5569,6 +5914,7 @@ class ThemeDecoder { /// /// ```json /// { + /// "applyTextScaling": "", /// "color": "", /// "fill": "", /// "grade": "", @@ -5597,6 +5943,7 @@ class ThemeDecoder { validate: validate, )); result = IconThemeData( + applyTextScaling: JsonClass.maybeParseBool(value['applyTextScaling']), color: decodeColor( value['color'], validate: false, @@ -5886,8 +6233,11 @@ class ThemeDecoder { /// "labelStyle": "", /// "outlineBorder": "", /// "prefixIconColor": "", + /// "prefixIconConstraints": "", /// "prefixStyle": "", - /// "suffixStyle": "", + /// "suffixIconConstraints": "", + /// "suffixIconColor": "", + /// "suffixIconConstraints": "", /// "suffixStyle": "" /// } /// ``` @@ -6018,6 +6368,10 @@ class ThemeDecoder { value['prefixIconColor'], validate: false, ), + prefixIconConstraints: decodeBoxConstraints( + value['prefixIconConstraints'], + validate: false, + ), prefixStyle: decodeTextStyle( value['prefixStyle'], validate: false, @@ -6026,6 +6380,10 @@ class ThemeDecoder { value['suffixIconColor'], validate: false, ), + suffixIconConstraints: decodeBoxConstraints( + value['suffixIconConstraints'], + validate: false, + ), suffixStyle: decodeTextStyle( value['suffixStyle'], validate: false, @@ -6084,6 +6442,52 @@ class ThemeDecoder { return result; } + /// Decodes the [value] to an [ListTileControlAffinity]. Supported + /// values are: + /// * `leading` + /// * `platform` + /// * `trailing` + static ListTileControlAffinity? decodeListTileControlAffinity( + dynamic value, { + bool validate = true, + }) { + ListTileControlAffinity? result; + + if (value is ListTileControlAffinity) { + result = value; + } else if (value != null) { + _checkSupported( + 'ListTileControlAffinity', + [ + 'leading', + 'platform', + 'trailing', + ], + value, + ); + + assert(SchemaValidator.validate( + schemaId: '$_baseSchemaUrl/list_tile_control_affinity', + value: value, + validate: validate, + )); + + switch (value) { + case 'leading': + result = ListTileControlAffinity.leading; + break; + case 'platform': + result = ListTileControlAffinity.platform; + break; + case 'trailing': + result = ListTileControlAffinity.trailing; + break; + } + } + + return result; + } + /// Decodes the [value] to an [ListTileStyle]. Supported /// values are: /// * `drawer` @@ -6187,12 +6591,14 @@ class ThemeDecoder { /// ```json /// { /// "contentPadding": "", + /// "controlAffinity": "", /// "dense": "", /// "enableFeedback": "", /// "horizontalTitleGap": "", /// "iconColor": "", /// "leadingAndTrailingTextStyle": "", /// "minLeadingWidth": "", + /// "minTileHeight": "", /// "minVerticalPadding": "", /// "mouseCursor": ">", /// "selectedColor": "", @@ -6224,6 +6630,10 @@ class ThemeDecoder { value['contentPadding'], validate: false, ), + controlAffinity: decodeListTileControlAffinity( + value['controlAffinity'], + validate: false, + ), dense: JsonClass.maybeParseBool(value['dense']), enableFeedback: JsonClass.maybeParseBool(value['enableFeedback']), horizontalTitleGap: @@ -6237,8 +6647,10 @@ class ThemeDecoder { validate: false, ), minLeadingWidth: JsonClass.maybeParseDouble(value['minLeadingWidth']), - minVerticalPadding: - JsonClass.maybeParseDouble(value['minVerticalPadding']), + minTileHeight: JsonClass.maybeParseDouble(value['minTileHeight']), + minVerticalPadding: JsonClass.maybeParseDouble( + value['minVerticalPadding'], + ), mouseCursor: decodeWidgetStatePropertyMouseCursor( value['mouseCursor'], validate: false, @@ -7264,6 +7676,7 @@ class ThemeDecoder { /// "indicatorShape": "", /// "labelBehavior": "", /// "labelTextStyle": ">", + /// "overlayColor": "", /// "shadowColor": "", /// "surfaceTintColor": "" /// } @@ -7271,6 +7684,7 @@ class ThemeDecoder { /// /// See also: /// * [decodeColor] + /// * [decodeWidgetStatePropertyColor] /// * [decodeWidgetStatePropertyIconThemeData] /// * [decodeWidgetStatePropertyTextStyle] /// * [decodeNavigationDestinationLabelBehavior] @@ -7315,6 +7729,10 @@ class ThemeDecoder { value['labelTextStyle'], validate: false, ), + overlayColor: decodeWidgetStatePropertyColor( + value['overlayColor'], + validate: false, + ), shadowColor: decodeColor( value['shadowColor'], validate: false, @@ -8171,6 +8589,7 @@ class ThemeDecoder { /// "iconColor": "", /// "iconSize": "", /// "labelTextStyle": ">", + /// "menuPadding": "", /// "mouseCursor": ">", /// "position": "", /// "shadowColor": "", @@ -8182,11 +8601,12 @@ class ThemeDecoder { /// /// See also: /// * [decodeColor] - /// * [decodeWidgetStatePropertyMouseCursor] - /// * [decodeWidgetStatePropertyTextStyle] + /// * [decodeEdgeInsetsGeometry] /// * [decodePopupMenuPosition] /// * [decodeShapeBorder] /// * [decodeTextStyle] + /// * [decodeWidgetStatePropertyMouseCursor] + /// * [decodeWidgetStatePropertyTextStyle] static PopupMenuThemeData? decodePopupMenuThemeData( dynamic value, { bool validate = true, @@ -8217,6 +8637,10 @@ class ThemeDecoder { value['labelTextStyle'], validate: false, ), + menuPadding: decodeEdgeInsetsGeometry( + value['menuPadding'], + validate: false, + ), mouseCursor: decodeWidgetStatePropertyMouseCursor( value['mouseCursor'], validate: false, @@ -9774,6 +10198,7 @@ class ThemeDecoder { /// "trackShape": "", /// "valueIndicatorColor": "", /// "valueIndicatorShape": "", + /// "valueIndicatorStrokeColor": "", /// "valueIndicatorTextStyle": "" /// } /// ``` @@ -9916,6 +10341,10 @@ class ThemeDecoder { value['valueIndicatorShape'], validate: false, ), + valueIndicatorStrokeColor: decodeColor( + value['valueIndicatorStrokeColor'], + validate: false, + ), valueIndicatorTextStyle: decodeTextStyle( value['valueIndicatorTextStyle'], validate: false, @@ -10156,6 +10585,7 @@ class ThemeDecoder { /// "contentTextStyle": "", /// "disabledActionBackgroundColor": "", /// "disabledActionTextColor": "", + /// "dismissDirection": "", /// "elevation": "", /// "insetPadding": "", /// "shape": "", @@ -10166,6 +10596,7 @@ class ThemeDecoder { /// /// See also: /// * [decodeColor] + /// * [decodeDismissDirection] /// * [decodeEdgeInsets] /// * [decodeSnackBarBehavior] /// * [decodeShapeBorder] @@ -10220,6 +10651,10 @@ class ThemeDecoder { value['disabledActionTextColor'], validate: false, ), + dismissDirection: decodeDismissDirection( + value['dismissDirection'], + validate: false, + ), elevation: JsonClass.maybeParseDouble(value['elevation']), insetPadding: decodeEdgeInsets( value['insetPadding'], @@ -10347,6 +10782,7 @@ class ThemeDecoder { /// "materialTapTargetSize": "", /// "mouseCursor": ">", /// "overlayColor": ">", + /// "padding": "", /// "splashRadius": "", /// "thumbColor": ">", /// "trackColor": ">", @@ -10357,11 +10793,12 @@ class ThemeDecoder { /// /// See also: /// * [decodeColor] + /// * [decodeEdgeInsetsGeometry] /// * [decodeWidgetStatePropertyColor] - /// * [decodeWidgetStatePropertyDouble] - /// * [decodeWidgetStatePropertyMouseCursor] /// * [decodeMaterialTapTargetSize] /// * [decodeMouseCursor] + /// * [decodeWidgetStatePropertyDouble] + /// * [decodeWidgetStatePropertyMouseCursor] static SwitchThemeData? decodeSwitchThemeData( dynamic value, { bool validate = true, @@ -10390,6 +10827,10 @@ class ThemeDecoder { value['overlayColor'], validate: false, ), + padding: decodeEdgeInsetsGeometry( + value['padding'], + validate: false, + ), splashRadius: JsonClass.maybeParseDouble(value['splashRadius']), thumbColor: decodeWidgetStatePropertyColor( value['thumbColor'], @@ -10596,8 +11037,10 @@ class ThemeDecoder { /// /// ```json /// { + /// "data": "", /// "dividerColor": "", /// "dividerHeight": "", + /// "indicatorAnimation": "", /// "indicatorColor": "", /// "indicatorSize": "", /// "labelPadding": "", @@ -10606,7 +11049,8 @@ class ThemeDecoder { /// "mouseCursor": ">", /// "overlayColor": ">", /// "splashFactory": "", - /// "tabAlignment": "" + /// "tabAlignment": "", + /// "textScaler": "", /// "unselectedLabelColor": "", /// "unselectedLabelStyle": "", /// } @@ -10618,8 +11062,10 @@ class ThemeDecoder { /// * [decodeInteractiveInkFeatureFactory] /// * [decodeWidgetStatePropertyColor] /// * [decodeWidgetStatePropertyMouseCursor] - /// * [decodeTabBarAlignment] + /// * [decodeTabAlignment] + /// * [decodeTabIndicatorAnimation] /// * [decodeTabBarIndicatorSize] + /// * [decodeTextScaler] /// * [decodeTextStyle] static TabBarTheme? decodeTabBarTheme( dynamic value, { @@ -10640,6 +11086,10 @@ class ThemeDecoder { 'TabBarTheme.indicator is not supported', ); result = TabBarTheme( + data: decodeTabBarThemeData( + value['data'], + validate: false, + ), dividerColor: decodeColor( value['dividerColor'], validate: false, @@ -10647,6 +11097,10 @@ class ThemeDecoder { dividerHeight: JsonClass.maybeParseDouble(value['dividerHeight']), // @unencodable // indicator + indicatorAnimation: decodeTabIndicatorAnimation( + value[''], + validate: false, + ), indicatorColor: decodeColor( value['indicatorColor'], validate: false, @@ -10679,6 +11133,128 @@ class ThemeDecoder { value['tabAlignment'], validate: false, ), + textScaler: decodeTextScaler( + value['textScaler'], + validate: false, + ), + splashFactory: decodeInteractiveInkFeatureFactory( + value['splashFactory'], + validate: false, + ), + unselectedLabelColor: decodeColor( + value['unselectedLabelColor'], + validate: false, + ), + unselectedLabelStyle: decodeTextStyle( + value['unselectedLabelStyle'], + validate: false, + ), + ); + } + + return result; + } + + /// Decodes the given [value] to a [TabBarThemeData]. This expects the + /// [value] to have the following structure: + /// + /// ```json + /// { + /// "dividerColor": "", + /// "dividerHeight": "", + /// "indicatorAnimation": "", + /// "indicatorColor": "", + /// "indicatorSize": "", + /// "labelPadding": "", + /// "labelColor": "", + /// "labelStyle": "", + /// "mouseCursor": ">", + /// "overlayColor": ">", + /// "splashFactory": "", + /// "tabAlignment": "", + /// "textScaler": "", + /// "unselectedLabelColor": "", + /// "unselectedLabelStyle": "", + /// } + /// ``` + /// + /// See also: + /// * [decodeColor] + /// * [decodeEdgeInsetsGeometry] + /// * [decodeInteractiveInkFeatureFactory] + /// * [decodeWidgetStatePropertyColor] + /// * [decodeWidgetStatePropertyMouseCursor] + /// * [decodeTabAlignment] + /// * [decodeTabIndicatorAnimation] + /// * [decodeTabBarIndicatorSize] + /// * [decodeTextScaler] + /// * [decodeTextStyle] + static TabBarThemeData? decodeTabBarThemeData( + dynamic value, { + bool validate = true, + }) { + TabBarThemeData? result; + + if (value is TabBarThemeData) { + result = value; + } else if (value != null) { + assert(SchemaValidator.validate( + schemaId: '$_baseSchemaUrl/tab_bar_theme_data', + value: value, + validate: validate, + )); + assert( + value['indicator'] == null, + 'TabBarThemeData.indicator is not supported', + ); + result = TabBarThemeData( + dividerColor: decodeColor( + value['dividerColor'], + validate: false, + ), + dividerHeight: JsonClass.maybeParseDouble(value['dividerHeight']), + // @unencodable + // indicator + indicatorAnimation: decodeTabIndicatorAnimation( + value['indicatorAnimation'], + validate: false, + ), + indicatorColor: decodeColor( + value['indicatorColor'], + validate: false, + ), + indicatorSize: decodeTabBarIndicatorSize( + value['indicatorSize'], + validate: false, + ), + labelPadding: decodeEdgeInsetsGeometry( + value['labelPadding'], + validate: false, + ), + labelColor: decodeColor( + value['labelColor'], + validate: false, + ), + labelStyle: decodeTextStyle( + value['labelStyle'], + validate: false, + ), + mouseCursor: decodeWidgetStatePropertyMouseCursor( + value['mouseCursor'], + validate: false, + ), + overlayColor: decodeWidgetStatePropertyColor( + value['overlayColor'], + validate: false, + ), + tabAlignment: decodeTabAlignment( + value['tabAlignment'], + validate: false, + ), + textScaler: decodeTextScaler( + value['textScaler'], + validate: false, + ), splashFactory: decodeInteractiveInkFeatureFactory( value['splashFactory'], validate: false, @@ -10846,6 +11422,46 @@ class ThemeDecoder { return result; } + /// Decodes the [value] to a [TextAlign]. Supported values are: + /// * `elastic` + /// * `linear` + static TabIndicatorAnimation? decodeTabIndicatorAnimation( + dynamic value, { + bool validate = true, + }) { + TabIndicatorAnimation? result; + if (value is TabIndicatorAnimation) { + result = value; + } else { + _checkSupported( + 'TabIndicatorAnimation', + [ + 'elastic', + 'linear', + ], + value, + ); + + if (value != null) { + assert(SchemaValidator.validate( + schemaId: '$_baseSchemaUrl/tab_indicator_animation', + value: value, + validate: validate, + )); + switch (value) { + case 'elastic': + result = TabIndicatorAnimation.elastic; + break; + case 'linear': + result = TabIndicatorAnimation.linear; + break; + } + } + } + + return result; + } + /// Decodes a [value] to a [TargetPlatform]. Supported values are: /// * `android` /// * `fuchsia` @@ -11626,6 +12242,41 @@ class ThemeDecoder { return result; } + /// Decodes the [value] to a [TextScaler]. Supported values are: + /// * `noScaling` + static TextScaler? decodeTextScaler( + dynamic value, { + bool validate = true, + }) { + TextScaler? result; + if (value is TextScaler) { + result = value; + } else { + _checkSupported( + 'TextScaler', + [ + 'noScaling', + ], + value, + ); + + if (value != null) { + assert(SchemaValidator.validate( + schemaId: '$_baseSchemaUrl/text_scaler', + value: value, + validate: validate, + )); + switch (value) { + case 'noScaling': + result = TextScaler.noScaling; + break; + } + } + } + + return result; + } + /// Decodes the given [value] to an [TextSelectionThemeData]. This expects the /// given [value] to be of the following structure: /// @@ -12665,7 +13316,9 @@ class ThemeDecoder { /// "hourMinuteTextStyle": "", /// "inputDecorationTheme": "", /// "padding": "", - /// "shape": "" + /// "shape": "", + /// "timeSelectorSeparatorColor": "", + /// "timeSelectorSeparatorTextStyle": "" /// } /// ``` /// @@ -12675,9 +13328,11 @@ class ThemeDecoder { /// * [decodeColor] /// * [decodeEdgeInsetsGeometry] /// * [decodeInputDecorationTheme] - /// * [decodeWidgetStateColor] /// * [decodeShapeBorder] /// * [decodeTextStyle] + /// * [decodeWidgetStateColor] + /// * [decodeWidgetStatePropertyColor] + /// * [decodeWidgetStatePropertyTextStyle] static TimePickerThemeData? decodeTimePickerThemeData( dynamic value, { bool validate = true, @@ -12773,11 +13428,22 @@ class ThemeDecoder { value['inputDecorationTheme'], validate: false, ), - padding: decodeEdgeInsetsGeometry(value['padding'], validate: false), + padding: decodeEdgeInsetsGeometry( + value['padding'], + validate: false, + ), shape: decodeShapeBorder( value['shape'], validate: false, ), + timeSelectorSeparatorColor: decodeWidgetStatePropertyColor( + value['timeSelectorSeparatorColor'], + validate: false, + ), + timeSelectorSeparatorTextStyle: decodeWidgetStatePropertyTextStyle( + value['timeSelectorSeparatorTextStyle'], + validate: false, + ), ); } diff --git a/json_theme/lib/src/codec/theme_encoder.dart b/json_theme/lib/src/codec/theme_encoder.dart index 53a473c..aadc992 100644 --- a/json_theme/lib/src/codec/theme_encoder.dart +++ b/json_theme/lib/src/codec/theme_encoder.dart @@ -184,6 +184,22 @@ class ThemeEncoder { return _stripDynamicNull(result); } + /// Encodes the given [value] to a [String]. Supported values are: + /// * `noAnimation` + static String? encodeAnimationStyle( + AnimationStyle? value, + ) { + String? result; + + if (value != null) { + if (value == AnimationStyle.noAnimation) { + result = 'noAnimation'; + } + } + + return _stripDynamicNull(result); + } + /// Encodes the given [value] to a JSON representation. /// /// ```json @@ -1130,26 +1146,26 @@ class ThemeEncoder { /// ```json /// { /// "alignment": "", - /// "animationDuration": ">", - /// "backgroundColor": ">", - /// "elevation": ">", + /// "animationDuration": ">", + /// "backgroundColor": ">", + /// "elevation": ">", /// "enableFeedback": "", - /// "fixedSize": ">", - /// "foregroundColor": ">", - /// "iconColor": ">", - /// "iconSize": ">", - /// "maximumSize": ">", - /// "minimumSize": ">", - /// "mouseCursor": ">", - /// "overlayColor": ">", - /// "padding": ">", - /// "shadowColor": ">", - /// "shape": ">", - /// "side": ">", + /// "fixedSize": ">", + /// "foregroundColor": ">", + /// "iconColor": ">", + /// "iconSize": ">", + /// "maximumSize": ">", + /// "minimumSize": ">", + /// "mouseCursor": ">", + /// "overlayColor": ">", + /// "padding": ">", + /// "shadowColor": ">", + /// "shape": ">", + /// "side": ">", /// "splashFactory": "", - /// "surfaceTintColor": ">", + /// "surfaceTintColor": ">", /// "tapTargetSize": "", - /// "textStyle": ">", + /// "textStyle": ">", /// "visualDensity": "" /// } /// ``` @@ -1302,6 +1318,37 @@ class ThemeEncoder { return _stripDynamicNull(result); } + /// Encodes the given [value] to a JSON representation. + /// + /// ```json + /// { + /// "clipBehavior": "", + /// "color": "", + /// "elevation": "", + /// "margin": "", + /// "shadowColor": "", + /// "shape": "", + /// "surfaceTintColor": "" + /// } + /// ``` + /// + /// See also: + /// * [encodeClip] + /// * [encodeColor] + /// * [encodeEdgeInsetsGeometry] + /// * [encodeShapeBorder] + static Map? encodeCardTheme(CardTheme? value) { + Map? result; + + if (value != null) { + result = { + 'data': encodeCardThemeData(value.data), + }; + } + + return _stripDynamicNull(result); + } + /// Encodes the given [value] to a JSON representation. /// /// ```json @@ -1344,10 +1391,10 @@ class ThemeEncoder { /// ```json /// { /// "checkColor": "", - /// "fillColor": ">", + /// "fillColor": ">", /// "materialTapTargetSize": "", - /// "mouseCursor": ">", - /// "overlayColor": ">", + /// "mouseCursor": ">", + /// "overlayColor": ">", /// "shape": "", /// "side": "", /// "splashRadius": "", @@ -1397,10 +1444,12 @@ class ThemeEncoder { /// /// ```json /// { + /// "avatarBoxConstraints": "", /// "backgroundColor": "", /// "brightness": "", /// "checkmarkColor": "", - /// "color": ">" + /// "color": ">", + /// "deleteIconBoxConstraints": "", /// "deleteIconColor": "", /// "disabledColor": "", /// "elevation": "", @@ -1423,11 +1472,12 @@ class ThemeEncoder { /// /// See also: /// * [encodeBorderSide] + /// * [encodeBoxConstraints] /// * [encodeBrightness] /// * [encodeColor] /// * [encodeEdgeInsetsGeometry] /// * [encodeIconThemeData] - /// * [encodeWidgetStateProperty] + /// * [encodeWidgetStateProperty] /// * [encodeShapeBorder] /// * [encodeTextStyle] static Map? encodeChipThemeData(ChipThemeData? value) { @@ -1435,10 +1485,16 @@ class ThemeEncoder { if (value != null) { result = { + 'avatarBoxConstraints': encodeBoxConstraints( + value.avatarBoxConstraints, + ), 'backgroundColor': encodeColor(value.backgroundColor), 'brightness': encodeBrightness(value.brightness), 'checkmarkColor': encodeColor(value.checkmarkColor), 'color': encodeWidgetStatePropertyColor(value.color), + 'deleteIconBoxConstraints': encodeBoxConstraints( + value.deleteIconBoxConstraints, + ), 'deleteIconColor': encodeColor(value.deleteIconColor), 'disabledColor': encodeColor(value.disabledColor), 'elevation': value.elevation, @@ -1503,7 +1559,10 @@ class ThemeEncoder { String? result; if (value != null) { - final hex = value.value.toRadixString(16).padLeft(8, '0'); + final hex = (value.a * 255).toInt().toRadixString(16).padLeft(2, '0') + + (value.r * 255).toInt().toRadixString(16).padLeft(2, '0') + + (value.g * 255).toInt().toRadixString(16).padLeft(2, '0') + + (value.b * 255).toInt().toRadixString(16).padLeft(2, '0'); result = '#$hex'; } @@ -1685,6 +1744,7 @@ class ThemeEncoder { /// /// ```json /// { + /// "actionSmallTextStyle": "", /// "actionTextStyle": "", /// "dateTimePickerTextStyle": "", /// "navActionTextStyle": "", @@ -1707,6 +1767,7 @@ class ThemeEncoder { if (value != null) { result = { + 'actionSmallTextStyle': encodeTextStyle(value.actionSmallTextStyle), 'actionTextStyle': encodeTextStyle(value.actionTextStyle), 'dateTimePickerTextStyle': encodeTextStyle( value.dateTimePickerTextStyle, @@ -1768,9 +1829,10 @@ class ThemeEncoder { /// "backgroundColor": "", /// "cancelButtonStyle": "", /// "confirmButtonStyle": "", - /// "dayBackgroundColor": ">", - /// "dayForegroundColor": ">", - /// "dayOverlayColor": ">", + /// "dayBackgroundColor": ">", + /// "dayForegroundColor": ">", + /// "dayOverlayColor": ">", + /// "dayShape": "", /// "dividerColor": "", /// "elevation": "", @@ -1779,6 +1841,7 @@ class ThemeEncoder { /// "headerHeadlineStyle": "", /// "headerHelpStyle": "", /// "inputDecorationTheme": "", + /// "locale": "", /// "rangePickerBackgroundColor": "", /// "rangePickerElevation": "", /// "rangePickerHeaderBackgroundColor": "", @@ -1789,17 +1852,17 @@ class ThemeEncoder { /// "rangePickerShape": "", /// "rangePickerSurfaceTintColor": "", /// "rangeSelectionBackgroundColor": "", - /// "rangeSelectionOverlayColor": ">", + /// "rangeSelectionOverlayColor": ">", /// "shadowColor": "", /// "shape": "", /// "surfaceTintColor": "", - /// "todayBackgroundColor": ">", + /// "todayBackgroundColor": ">", /// "todayBorder": "", - /// "todayForegroundColor": ">", + /// "todayForegroundColor": ">", /// "weekdayStyle": "", - /// "yearBackgroundColor": ">", - /// "yearForegroundColor": ">", - /// "yearOverlayColor": ">", + /// "yearBackgroundColor": ">", + /// "yearForegroundColor": ">", + /// "yearOverlayColor": ">", /// "yearStyle": "" /// } /// ``` @@ -1808,9 +1871,10 @@ class ThemeEncoder { /// * [encodeBorderSide] /// * [encodeColor] /// * [encodeInputDecorationTheme] - /// * [encodeWidgetStatePropertyColor] /// * [encodeShapeBorder] /// * [encodeTextStyle] + /// * [encodeWidgetStatePropertyColor] + /// * [encodeWidgetStatePropertyOutlinedBorder] static Map? encodeDatePickerThemeData( DatePickerThemeData? value, ) { @@ -1839,6 +1903,7 @@ class ThemeEncoder { 'inputDecorationTheme': encodeInputDecorationTheme( value.inputDecorationTheme, ), + 'locale': encodeLocale(value.locale), 'rangePickerBackgroundColor': encodeColor( value.rangePickerBackgroundColor, ), @@ -1899,15 +1964,16 @@ class ThemeEncoder { /// { /// "checkboxHorizontalMargin": "", /// "columnSpacing": "", - /// "dataRowColor": ">", - /// "dataRowCursor": "", + /// "dataRowColor": ">", + /// "dataRowCursor": "", /// "dataRowMaxHeight": "", /// "dataRowMinHeight": "", /// "dataTextStyle": "", /// "dividerThickness": "", - /// "headingCellCursor": "", - /// "headingRowColor": ">", + /// "headingCellCursor": "", + /// "headingRowAlignment": "" + /// "headingRowColor": ">", /// "headingRowHeight": "", /// "headingTextStyle": "", /// "horizontalMargin": "" @@ -1950,6 +2016,9 @@ class ThemeEncoder { 'headingCellCursor': encodeWidgetStatePropertyMouseCursor( value.headingCellCursor, ), + 'headingRowAlignment': encodeMainAxisAlignment( + value.headingRowAlignment, + ), 'headingRowColor': encodeWidgetStatePropertyColor( value.headingRowColor, ), @@ -2041,9 +2110,12 @@ class ThemeEncoder { /// "actionsPadding": "", /// "alignment": "", /// "backgroundColor": "", + /// "barrierColor": "", + /// "clipBehavior": "", /// "contentTextStyle": "", /// "elevation": "", /// "iconColor": "", + /// "insetPadding": "", /// "shadowColor": "", /// "shape": "", /// "surfaceColor": "", @@ -2054,7 +2126,67 @@ class ThemeEncoder { /// See also: /// * [encodeAlignment] /// * [encodeBrightness] + /// * [encodeClip] /// * [encodeColor] + /// * [encodeEdgeInsets] + /// * [encodeEdgeInsetsGeometry] + /// * [encodeShapeBorder] + /// * [encodeTextStyle] + static Map? encodeDialogTheme(DialogTheme? value) { + Map? result; + + if (value != null) { + final data = value.data; + result = { + 'data': { + 'actionsPadding': encodeEdgeInsetsGeometry( + data.actionsPadding as EdgeInsets?, + ), + 'alignment': encodeAlignmentGeometry(data.alignment), + 'backgroundColor': encodeColor(data.backgroundColor), + 'clipBehavior': encodeClip(data.clipBehavior), + 'barrierColor': encodeColor(data.barrierColor), + 'contentTextStyle': encodeTextStyle(data.contentTextStyle), + 'elevation': data.elevation, + 'insetsPadding': encodeEdgeInsets(data.insetPadding), + 'shadowColor': encodeColor(data.shadowColor), + 'shape': encodeShapeBorder(data.shape), + 'surfaceTintColor': encodeColor(data.shadowColor), + 'titleTextStyle': encodeTextStyle(data.titleTextStyle), + } + }; + } + + return _stripDynamicNull(result); + } + + /// Encodes the given [value] to a JSON representation. + /// + /// ```json + /// { + /// "actionsPadding": "", + /// "alignment": "", + /// "backgroundColor": "", + /// "barrierColor": "", + /// "clipBehavior": "", + /// "contentTextStyle": "", + /// "elevation": "", + /// "iconColor": "", + /// "insetPadding": "", + /// "shadowColor": "", + /// "shape": "", + /// "surfaceColor": "", + /// "titleTextStyle": "" + /// } + /// ``` + /// + /// See also: + /// * [encodeAlignment] + /// * [encodeBrightness] + /// * [encodeClip] + /// * [encodeColor] + /// * [encodeEdgeInsets] + /// * [encodeEdgeInsetsGeometry] /// * [encodeShapeBorder] /// * [encodeTextStyle] static Map? encodeDialogThemeData(DialogThemeData? value) { @@ -2067,8 +2199,11 @@ class ThemeEncoder { ), 'alignment': encodeAlignmentGeometry(value.alignment), 'backgroundColor': encodeColor(value.backgroundColor), + 'barrierColor': encodeColor(value.barrierColor), + 'clipBehavior': encodeClip(value.clipBehavior), 'contentTextStyle': encodeTextStyle(value.contentTextStyle), 'elevation': value.elevation, + 'insetsPadding': encodeEdgeInsets(value.insetPadding), 'shadowColor': encodeColor(value.shadowColor), 'shape': encodeShapeBorder(value.shape), 'surfaceTintColor': encodeColor(value.shadowColor), @@ -2079,6 +2214,49 @@ class ThemeEncoder { return _stripDynamicNull(result); } + /// Encodes the given [value] to the String representation. Supported values + /// are: + /// * `down` + /// * `endToStart` + /// * `horizontal' + /// * `none' + /// * `startToEnd` + /// * `up` + /// * `vertical` + /// + /// All other values, including `null`, will result in `null`. + static String? encodeDismissDirection(DismissDirection? value) { + String? result; + + if (value != null) { + switch (value) { + case DismissDirection.down: + result = 'down'; + break; + case DismissDirection.endToStart: + result = 'endToStart'; + break; + case DismissDirection.horizontal: + result = 'horizontal'; + break; + case DismissDirection.none: + result = 'none'; + break; + case DismissDirection.startToEnd: + result = 'startToEnd'; + break; + case DismissDirection.up: + result = 'up'; + break; + case DismissDirection.vertical: + result = 'vertical'; + break; + } + } + + return _stripDynamicNull(result); + } + /// Encodes the given [value] to a JSON representation. /// /// ```json @@ -2336,6 +2514,7 @@ class ThemeEncoder { /// "collapsedShape": "", /// "collapsedTextColor": "", /// "expandedAlignment": "", + /// "expansionAnimationStyle": "", /// "iconColor": "", /// "shape": "", /// "textColor": "", @@ -2347,6 +2526,7 @@ class ThemeEncoder { /// * [encodeAlignment] /// * [encodeColor] /// * [encodeEdgeInsetsGeometry] + /// * [encodeExpansionAnimationStyle] /// * [encodeShapeBorder] static Map? encodeExpansionTileThemeData( ExpansionTileThemeData? value, @@ -2364,6 +2544,9 @@ class ThemeEncoder { 'collapsedShape': encodeShapeBorder(value.collapsedShape), 'collapsedTextColor': encodeColor(value.collapsedTextColor), 'expandedAlignment': encodeAlignmentGeometry(value.expandedAlignment), + 'expansionAnimationStyle': encodeAnimationStyle( + value.expansionAnimationStyle, + ), 'iconColor': encodeColor(value.iconColor), 'shape': encodeShapeBorder(value.shape), 'textColor': encodeColor(value.textColor), @@ -2559,7 +2742,7 @@ class ThemeEncoder { /// "hoverElevation": "", /// "iconSize": "", /// "largeSizeConstraints": "", - /// "mouseCursor": ">", + /// "mouseCursor": ">", /// "shape": "", /// "sizeConstraints": "", /// "smallSizeConstraints": "", @@ -2969,6 +3152,8 @@ class ThemeEncoder { /// /// ```json /// { + /// "applyTextScaling": "", + /// "blendMode": "", /// "color": "", /// "fill": "", /// "grade": "", @@ -2986,6 +3171,8 @@ class ThemeEncoder { if (value != null) { result = { + 'applyTextScaling': value.applyTextScaling, + 'blendMode': encodeBlendMode(value.blendMode), 'color': encodeColor(value.color), 'fill': value.fill, 'grade': value.grade, @@ -3032,6 +3219,7 @@ class ThemeEncoder { /// { /// "codePoint": "", /// "fontFamily": "", + /// "fontFamilyFallback": ">", /// "fontPackage": "", /// "matchTextDirection": "" /// } @@ -3043,6 +3231,7 @@ class ThemeEncoder { result = { 'codePoint': value.codePoint, 'fontFamily': value.fontFamily, + 'fontFamilyFallback': value.fontFamilyFallback, 'fontPackage': value.fontPackage, 'matchTextDirection': value.matchTextDirection, }; @@ -3055,6 +3244,7 @@ class ThemeEncoder { /// /// ```json /// { + /// "applyTextScaling": "", /// "color": "", /// "fill": "", /// "grade": "", @@ -3073,6 +3263,7 @@ class ThemeEncoder { if (value != null) { result = { + 'applyTextScaling': value.applyTextScaling, 'color': encodeColor(value.color), 'fill': value.fill, 'grade': value.grade, @@ -3273,8 +3464,11 @@ class ThemeEncoder { /// "labelStyle": "", /// "outlineBorder": "", /// "prefixIconColor": "", + /// "prefixIconConstraints": "", /// "prefixStyle": "", - /// "suffixStyle": "", + /// "suffixIconConstraints": "", + /// "suffixIconColor": "", + /// "suffixIconConstraints": "", /// "suffixStyle": "" /// } /// ``` @@ -3327,8 +3521,14 @@ class ThemeEncoder { 'isDense': value.isDense, 'labelStyle': encodeTextStyle(value.labelStyle), 'outlineBorder': encodeBorderSide(value.outlineBorder), + 'prefixIconConstraints': encodeBoxConstraints( + value.prefixIconConstraints, + ), 'prefixIconColor': encodeColor(value.prefixIconColor), 'prefixStyle': encodeTextStyle(value.prefixStyle), + 'suffixIconConstraints': encodeBoxConstraints( + value.suffixIconConstraints, + ), 'suffixIconColor': encodeColor(value.suffixIconColor), 'suffixStyle': encodeTextStyle(value.suffixStyle), }; @@ -3370,6 +3570,33 @@ class ThemeEncoder { return _stripDynamicNull(result); } + /// Encodes the given [value] to the String representation. Supported values + /// are: + /// * `leading` + /// * `platform` + /// * `trailing` + /// + /// All other values, including `null`, will result in `null`. + static String? encodeListTileControlAffinity(ListTileControlAffinity? value) { + String? result; + + if (value != null) { + switch (value) { + case ListTileControlAffinity.leading: + result = 'leading'; + break; + case ListTileControlAffinity.platform: + result = 'platform'; + break; + case ListTileControlAffinity.trailing: + result = 'trailing'; + break; + } + } + + return _stripDynamicNull(result); + } + /// Encodes the given [value] to the String representation. Supported values /// are: /// * `drawer` @@ -3433,13 +3660,14 @@ class ThemeEncoder { /// ```json /// { /// "contentPadding": "", + /// "controlAffinity": "", /// "dense": "", /// "enableFeedback": "", /// "horizontalTitleGap": "", /// "iconColor": "", /// "minLeadingWidth": "", /// "minVerticalPadding": "", - /// "mouseCursor": ">", + /// "mouseCursor": ">", /// "selectedColor": "", /// "selectedTileColor": "", /// "shape": "", @@ -3458,6 +3686,7 @@ class ThemeEncoder { 'contentPadding': encodeEdgeInsetsGeometry( value.contentPadding as EdgeInsets?, ), + 'controlAffinity': encodeListTileControlAffinity(value.controlAffinity), 'dense': value.dense, 'enableFeedback': value.enableFeedback, 'horizontalTitleGap': value.horizontalTitleGap, @@ -3466,6 +3695,7 @@ class ThemeEncoder { value.leadingAndTrailingTextStyle, ), 'minLeadingWidth': value.minLeadingWidth, + 'minTileHeight': value.minTileHeight, 'minVerticalPadding': value.minVerticalPadding, 'mouseCursor': encodeWidgetStatePropertyMouseCursor( value.mouseCursor, @@ -3834,16 +4064,16 @@ class ThemeEncoder { /// ```json /// { /// "alignment": "", - /// "backgroundColor": ">", - /// "elevation": ">", - /// "fixedSize": ">", - /// "maximumSize": ">", - /// "minimumSize": ">", - /// "padding": ">", - /// "shadowColor": ">", - /// "shape": ">", - /// "side": ">", - /// "surfaceTintColor": ">", + /// "backgroundColor": ">", + /// "elevation": ">", + /// "fixedSize": ">", + /// "maximumSize": ">", + /// "minimumSize": ">", + /// "padding": ">", + /// "shadowColor": ">", + /// "shape": ">", + /// "side": ">", + /// "surfaceTintColor": ">", /// "visualDensity": "", /// } /// ``` @@ -4166,11 +4396,12 @@ class ThemeEncoder { /// "backgroundColor": "", /// "elevation": "", /// "height": "", - /// "iconTheme": ">", + /// "iconTheme": ">", /// "indicatorColor": "", /// "indicatorShape": "", /// "labelBehavior": "", - /// "labelTextStyle": ">", + /// "labelTextStyle": ">", + /// "overlayColor": "", /// "shadowColor": "", /// "surfaceTintColor": "" /// } @@ -4178,6 +4409,7 @@ class ThemeEncoder { /// /// See also: /// * [encodeColor] + /// * [encodeWidgetStatePropertyColor] /// * [encodeWidgetStatePropertyIconThemeData] /// * [encodeWidgetStatePropertyTextStyle] /// * [encodeNavigationDestinationLabelBehavior] @@ -4202,6 +4434,7 @@ class ThemeEncoder { 'labelTextStyle': encodeWidgetStatePropertyTextStyle( value.labelTextStyle, ), + 'overlayColor': encodeWidgetStatePropertyColor(value.overlayColor), 'shadowColor': encodeColor(value.shadowColor), 'surfaceTintColor': encodeColor(value.surfaceTintColor), }; @@ -4677,8 +4910,9 @@ class ThemeEncoder { /// "enableFeedback": "", /// "iconColor": "", /// "iconSize": "", - /// "labelTextStyle": ">", - /// "mouseCursor": ">", + /// "labelTextStyle": ">", + /// "menuPadding": "", + /// "mouseCursor": ">", /// "position": "", /// "shadowColor": "", /// "shape": "", @@ -4689,11 +4923,12 @@ class ThemeEncoder { /// /// See also: /// * [encodeColor] - /// * [encodeWidgetStatePropertyMouseCursor] - /// * [encodeWidgetStatePropertyTextStyle] + /// * [encodeEdgeInsetsGeometry] /// * [encodePopupMenuPosition] /// * [encodeShapeBorder] /// * [encodeTextStyle] + /// * [encodeWidgetStatePropertyMouseCursor] + /// * [encodeWidgetStatePropertyTextStyle] static Map? encodePopupMenuThemeData( PopupMenuThemeData? value, ) { @@ -4709,6 +4944,7 @@ class ThemeEncoder { 'labelTextStyle': encodeWidgetStatePropertyTextStyle( value.labelTextStyle, ), + 'menuPadding': encodeEdgeInsetsGeometry(value.menuPadding), 'mouseCursor': encodeWidgetStatePropertyMouseCursor( value.mouseCursor, ), @@ -5112,12 +5348,12 @@ class ThemeEncoder { /// "mainAxisMargin": "", /// "minThumbLength": "", /// "radius": "", - /// "thickness": ">", - /// "thumbColor": ">", - /// "thumbVisibility": ">", - /// "trackBorderColor": ">", - /// "trackColor": ">", - /// "trackVisibility": ">" + /// "thickness": ">", + /// "thumbColor": ">", + /// "thumbVisibility": ">", + /// "trackBorderColor": ">", + /// "trackColor": ">", + /// "trackVisibility": ">" /// } /// ``` /// @@ -5163,17 +5399,17 @@ class ThemeEncoder { /// /// ```json /// { - /// "backgroundColor": ">", + /// "backgroundColor": ">", /// "constraints": "", - /// "elevation": ">", - /// "hintStyle": ">", - /// "overlayColor": ">", - /// "padding": ">", - /// "shadowColor": ">", - /// "shape": MaterialStateProperty, - /// "side": ">", - /// "surfaceTintColor": ">", - /// "textStyle": ">", + /// "elevation": ">", + /// "hintStyle": ">", + /// "overlayColor": ">", + /// "padding": ">", + /// "shadowColor": ">", + /// "shape": WidgetStateProperty, + /// "side": ">", + /// "surfaceTintColor": ">", + /// "textStyle": ">", /// "textCapitalization": "" /// } /// ``` @@ -5544,7 +5780,7 @@ class ThemeEncoder { /// "inactiveTickMarkColor": "", /// "inactiveTrackColor": "", /// "minThumbSeparation": "", - /// "mouseCursor": ">", + /// "mouseCursor": ">", /// "overlappingShapeStrokeColor": "", /// "overlayColor": "", /// "overlayShape": "", @@ -5561,6 +5797,7 @@ class ThemeEncoder { /// "trackShape": "", /// "valueIndicatorColor": "", /// "valueIndicatorShape": "", + /// "valueIndicatorStrokeColor": "", /// "valueIndicatorTextStyle": "" /// } /// ``` @@ -5632,6 +5869,9 @@ class ThemeEncoder { 'valueIndicatorShape': encodeSliderComponentShape( value.valueIndicatorShape, ), + 'valueIndicatorStrokeColor': encodeColor( + value.valueIndicatorStrokeColor, + ), 'valueIndicatorTextStyle': encodeTextStyle( value.valueIndicatorTextStyle, ), @@ -5778,6 +6018,7 @@ class ThemeEncoder { /// "behavior": "", /// "closeIconColor": "", /// "contentTextStyle": "", + /// "dismissDirection": "", /// "disabledActionBackgroundColor": "", /// "disabledActionTextColor": "", /// "elevation": "", @@ -5790,6 +6031,7 @@ class ThemeEncoder { /// /// See also: /// * [encodeColor] + /// * [encodeDismissDirection] /// * [encodeEdgeInsetsGeometry] /// * [encodeSnackBarBehavior] /// * [encodeShapeBorder] @@ -5812,6 +6054,7 @@ class ThemeEncoder { value.disabledActionBackgroundColor, ), 'disabledActionTextColor': encodeColor(value.disabledActionTextColor), + 'dismissDirection': encodeDismissDirection(value.dismissDirection), 'elevation': value.elevation, 'insetPadding': encodeEdgeInsetsGeometry(value.insetPadding), 'shape': encodeShapeBorder(value.shape), @@ -5898,23 +6141,25 @@ class ThemeEncoder { /// ```json /// { /// "materialTapTargetSize": "", - /// "mouseCursor": ">", - /// "overlayColor": ">", + /// "mouseCursor": ">", + /// "overlayColor": ">", + /// "padding": "", /// "splashRadius": "", - /// "thumbColor": ">", - /// "trackColor": ">", - /// "trackOutlineColor": ">" - /// "trackOutlineWidth": ">" + /// "thumbColor": ">", + /// "trackColor": ">", + /// "trackOutlineColor": ">" + /// "trackOutlineWidth": ">" /// } /// ``` /// /// See also: /// * [encodeColor] + /// * [encodeEdgeInsetsGeometry] + /// * [encodeMaterialTapTargetSize] + /// * [encodeMouseCursor] /// * [encodeWidgetStatePropertyColor] /// * [encodeWidgetStatePropertyDouble] /// * [encodeWidgetStatePropertyMouseCursor] - /// * [encodeMaterialTapTargetSize] - /// * [encodeMouseCursor] static Map? encodeSwitchThemeData( SwitchThemeData? value, { bool validate = true, @@ -5932,6 +6177,7 @@ class ThemeEncoder { 'overlayColor': encodeWidgetStatePropertyColor( value.overlayColor, ), + 'padding': encodeEdgeInsetsGeometry(value.padding), 'splashRadius': value.splashRadius, 'thumbColor': encodeWidgetStatePropertyColor( value.thumbColor, @@ -6068,6 +6314,7 @@ class ThemeEncoder { /// /// ```json /// { + /// "data": "", /// "dividerColor": "", /// "dividerHeight": "", /// "indicatorColor": "", @@ -6075,10 +6322,11 @@ class ThemeEncoder { /// "labelPadding": "", /// "labelColor": "", /// "labelStyle": "", - /// "mouseCursor": ">", - /// "overlayColor": ">", + /// "mouseCursor": ">", + /// "overlayColor": ">", /// "splashFactory": "", /// "tabAlignment": "" + /// "textScaler": "", /// "unselectedLabelColor": "", /// "unselectedLabelStyle": "", /// } @@ -6093,6 +6341,72 @@ class ThemeEncoder { /// * [encodeTabAlignment] /// * [encodeTabBarIndicatorSize] /// * [encodeTextStyle] + static Map? encodeTabBarTheme(TabBarTheme? value) { + Map? result; + + if (value != null) { + final data = value.data; + result = { + 'data': { + 'dividerColor': encodeColor(data.dividerColor), + 'dividerHeight': data.dividerHeight, + 'indicatorColor': encodeColor(data.dividerColor), + 'indicatorSize': encodeTabBarIndicatorSize(data.indicatorSize), + 'labelPadding': + encodeEdgeInsetsGeometry(data.labelPadding as EdgeInsets?), + 'labelColor': encodeColor(data.labelColor), + 'labelStyle': encodeTextStyle(data.labelStyle), + 'mouseCursor': encodeWidgetStatePropertyMouseCursor( + data.mouseCursor, + ), + 'overlayColor': encodeWidgetStatePropertyColor( + data.overlayColor, + ), + 'splashFactory': encodeInteractiveInkFeatureFactory( + data.splashFactory, + ), + 'tabAlignment': encodeTabAlignment(data.tabAlignment), + 'textScaler': encodeTextScaler(data.textScaler), + 'unselectedLabelColor': encodeColor(data.unselectedLabelColor), + 'unselectedLabelStyle': encodeTextStyle(data.unselectedLabelStyle), + }, + }; + } + + return _stripDynamicNull(result); + } + + /// Encodes the given [value] to the JSON representation. + /// + /// ```json + /// { + /// "dividerColor": "", + /// "dividerHeight": "", + /// "indicatorColor": "", + /// "indicatorSize": "", + /// "labelPadding": "", + /// "labelColor": "", + /// "labelStyle": "", + /// "mouseCursor": ">", + /// "overlayColor": ">", + /// "splashFactory": "", + /// "tabAlignment": "", + /// "textScaler": "", + /// "unselectedLabelColor": "", + /// "unselectedLabelStyle": "", + /// } + /// ``` + /// + /// See also: + /// * [encodeColor] + /// * [encodeEdgeInsetsGeometry] + /// * [encodeInteractiveInkFeatureFactory] + /// * [encodeWidgetStatePropertyMouseCursor] + /// * [encodeWidgetStatePropertyMouseCursor] + /// * [encodeTabAlignment] + /// * [encodeTabBarIndicatorSize] + /// * [encodeTextScaler] + /// * [encodeTextStyle] static Map? encodeTabBarThemeData(TabBarThemeData? value) { Map? result; @@ -6116,6 +6430,7 @@ class ThemeEncoder { value.splashFactory, ), 'tabAlignment': encodeTabAlignment(value.tabAlignment), + 'textScaler': encodeTextScaler(value.textScaler), 'unselectedLabelColor': encodeColor(value.unselectedLabelColor), 'unselectedLabelStyle': encodeTextStyle(value.unselectedLabelStyle), }; @@ -6124,6 +6439,29 @@ class ThemeEncoder { return _stripDynamicNull(result); } + /// Encodes the given [value] to the String representation. Supported values + /// are: + /// * `elastic` + /// * `linear` + /// + /// All other values, including `null`, will result in `null`. + static String? encodeTabIndicatorAnimation(TabIndicatorAnimation? value) { + String? result; + + if (value != null) { + switch (value) { + case TabIndicatorAnimation.elastic: + result = 'elastic'; + break; + case TabIndicatorAnimation.linear: + result = 'linear'; + break; + } + } + + return _stripDynamicNull(result); + } + /// Encodes the given [value] to the JSON representation. Supported values /// are: /// @@ -6705,6 +7043,25 @@ class ThemeEncoder { return _stripDynamicNull(result); } + /// Encodes the given [value] to the String representation. Supported values + /// are: + /// * `noScaling` + /// + /// All other values, including `null`, will result in `null`. + static String? encodeTextScaler(TextScaler? value) { + String? result; + + if (value != null) { + switch (value) { + case TextScaler.noScaling: + result = 'noScaling'; + break; + } + } + + return _stripDynamicNull(result); + } + /// Encodes a given [value] into a JSON compatible Map structure. This will /// return the following structure: /// @@ -7264,7 +7621,9 @@ class ThemeEncoder { /// "hourMinuteTextStyle": "", /// "inputDecorationTheme": "", /// "padding": "", - /// "shape": "" + /// "shape": "", + /// "timeSelectorSeparatorColor": "", + /// "timeSelectorSeparatorTextStyle": "" /// } /// ``` /// @@ -7275,6 +7634,9 @@ class ThemeEncoder { /// * [encodeInputDecorationTheme] /// * [encodeShapeBorder] /// * [encodeTextStyle] + /// * [encodeWidgetStateColor] + /// * [encodeWidgetStatePropertyColor] + /// * [encodeWidgetStatePropertyTextStyle] static Map? encodeTimePickerThemeData( TimePickerThemeData? value, ) { @@ -7306,6 +7668,12 @@ class ThemeEncoder { ), 'padding': encodeEdgeInsetsGeometry(value.padding as EdgeInsets?), 'shape': encodeShapeBorder(value.shape), + 'timeSelectorSeparatorColor': encodeWidgetStatePropertyColor( + value.timeSelectorSeparatorColor, + ), + 'timeSelectorSeparatorTextStyle': encodeWidgetStatePropertyTextStyle( + value.timeSelectorSeparatorTextStyle, + ), }; } diff --git a/json_theme/lib/src/schema/all.dart b/json_theme/lib/src/schema/all.dart index 82e384a..8321780 100644 --- a/json_theme/lib/src/schema/all.dart +++ b/json_theme/lib/src/schema/all.dart @@ -1,5 +1,6 @@ export 'schemas/enums/alignment_directional_schema.dart'; export 'schemas/enums/android_overscroll_indicator_schema.dart'; +export 'schemas/enums/animation_style_schema.dart'; export 'schemas/enums/autovalidate_mode_schema.dart'; export 'schemas/enums/axis_schema.dart'; export 'schemas/enums/blend_mode_schema.dart'; @@ -18,6 +19,7 @@ export 'schemas/enums/clip_schema.dart'; export 'schemas/enums/cross_axis_alignment_schema.dart'; export 'schemas/enums/cross_fade_state_schema.dart'; export 'schemas/enums/decoration_position_schema.dart'; +export 'schemas/enums/dismiss_direction_schema.dart'; export 'schemas/enums/drag_start_behavior_schema.dart'; export 'schemas/enums/filter_quality_schema.dart'; export 'schemas/enums/flex_fit_schema.dart'; @@ -30,6 +32,7 @@ export 'schemas/enums/font_weight_schema.dart'; export 'schemas/enums/hit_test_behavior_schema.dart'; export 'schemas/enums/image_repeat_schema.dart'; export 'schemas/enums/interactive_ink_feature_factory_schema.dart'; +export 'schemas/enums/list_tile_control_affinity_schema.dart'; export 'schemas/enums/list_tile_style_schema.dart'; export 'schemas/enums/list_tile_title_alignment_schema.dart'; export 'schemas/enums/main_axis_alignment_schema.dart'; @@ -59,6 +62,7 @@ export 'schemas/enums/snack_bar_behavior_schema.dart'; export 'schemas/enums/stack_fit_schema.dart'; export 'schemas/enums/tab_alignment_schema.dart'; export 'schemas/enums/tab_bar_indicator_size_schema.dart'; +export 'schemas/enums/tab_indicator_animation_schema.dart'; export 'schemas/enums/target_platform_schema.dart'; export 'schemas/enums/text_align_schema.dart'; export 'schemas/enums/text_align_vertical_schema.dart'; @@ -71,6 +75,7 @@ export 'schemas/enums/text_input_action_schema.dart'; export 'schemas/enums/text_input_type_schema.dart'; export 'schemas/enums/text_leading_distribution_schema.dart'; export 'schemas/enums/text_overflow_schema.dart'; +export 'schemas/enums/text_scaler_schema.dart'; export 'schemas/enums/text_width_basis_schema.dart'; export 'schemas/enums/tile_mode_schema.dart'; export 'schemas/enums/tooltip_trigger_mode_schema.dart'; @@ -97,6 +102,7 @@ export 'schemas/objects/box_shadow_schema.dart'; export 'schemas/objects/button_bar_theme_data_schema.dart'; export 'schemas/objects/button_style_schema.dart'; export 'schemas/objects/button_theme_data_schema.dart'; +export 'schemas/objects/card_theme_data_schema.dart'; export 'schemas/objects/card_theme_schema.dart'; export 'schemas/objects/checkbox_theme_data_schema.dart'; export 'schemas/objects/chip_theme_data_schema.dart'; @@ -108,6 +114,7 @@ export 'schemas/objects/cupertino_theme_data_schema.dart'; export 'schemas/objects/data_table_theme_data_schema.dart'; export 'schemas/objects/date_picker_theme_data_schema.dart'; export 'schemas/objects/decoration_image_schema.dart'; +export 'schemas/objects/dialog_theme_data_schema.dart'; export 'schemas/objects/dialog_theme_schema.dart'; export 'schemas/objects/divider_theme_data_schema.dart'; export 'schemas/objects/drawer_theme_data_schema.dart'; @@ -171,6 +178,7 @@ export 'schemas/objects/snack_bar_theme_data_schema.dart'; export 'schemas/objects/strut_style_schema.dart'; export 'schemas/objects/switch_theme_data_schema.dart'; export 'schemas/objects/system_ui_overlay_style_schema.dart'; +export 'schemas/objects/tab_bar_theme_data_schema.dart'; export 'schemas/objects/tab_bar_theme_schema.dart'; export 'schemas/objects/table_border_schema.dart'; export 'schemas/objects/table_column_width_schema.dart'; diff --git a/json_theme/lib/src/schema/schemas.dart b/json_theme/lib/src/schema/schemas.dart index 3cb087a..7997a1e 100644 --- a/json_theme/lib/src/schema/schemas.dart +++ b/json_theme/lib/src/schema/schemas.dart @@ -8,6 +8,7 @@ class Schemas { AlignmentSchema.id: AlignmentSchema.schema, AndroidOverscrollIndicatorSchema.id: AndroidOverscrollIndicatorSchema.schema, + AnimationStyleSchema.id: AnimationStyleSchema.schema, AppBarThemeSchema.id: AppBarThemeSchema.schema, AutovalidateModeSchema.id: AutovalidateModeSchema.schema, AxisSchema.id: AxisSchema.schema, @@ -39,6 +40,7 @@ class Schemas { ButtonStyleSchema.id: ButtonStyleSchema.schema, ButtonTextThemeSchema.id: ButtonTextThemeSchema.schema, ButtonThemeDataSchema.id: ButtonThemeDataSchema.schema, + CardThemeDataSchema.id: CardThemeDataSchema.schema, CardThemeSchema.id: CardThemeSchema.schema, CheckboxThemeDataSchema.id: CheckboxThemeDataSchema.schema, ChipThemeDataSchema.id: ChipThemeDataSchema.schema, @@ -54,7 +56,9 @@ class Schemas { DataTableThemeDataSchema.id: DataTableThemeDataSchema.schema, DecorationImageSchema.id: DecorationImageSchema.schema, DecorationPositionSchema.id: DecorationPositionSchema.schema, + DialogThemeDataSchema.id: DialogThemeDataSchema.schema, DialogThemeSchema.id: DialogThemeSchema.schema, + DismissDirectionSchema.id: DismissDirectionSchema.schema, DividerThemeDataSchema.id: DividerThemeDataSchema.schema, DragStartBehaviorSchema.id: DragStartBehaviorSchema.schema, DrawerThemeDataSchema.id: DrawerThemeDataSchema.schema, @@ -92,6 +96,7 @@ class Schemas { InputDecorationThemeSchema.id: InputDecorationThemeSchema.schema, InteractiveInkFeatureFactorySchema.id: InteractiveInkFeatureFactorySchema.schema, + ListTileControlAffinitySchema.id: ListTileControlAffinitySchema.schema, ListTileStyleSchema.id: ListTileStyleSchema.schema, ListTileThemeDataSchema.id: ListTileThemeDataSchema.schema, ListTileTitleAlignmentSchema.id: ListTileTitleAlignmentSchema.schema, @@ -166,7 +171,9 @@ class Schemas { SystemUiOverlayStyleSchema.id: SystemUiOverlayStyleSchema.schema, TabAlignmentSchema.id: TabAlignmentSchema.schema, TabBarIndicatorSizeSchema.id: TabBarIndicatorSizeSchema.schema, + TabBarThemeDataSchema.id: TabBarThemeDataSchema.schema, TabBarThemeSchema.id: TabBarThemeSchema.schema, + TabIndicatorAnimationSchema.id: TabIndicatorAnimationSchema.schema, TableBorderSchema.id: TableBorderSchema.schema, TableColumnWidthSchema.id: TableColumnWidthSchema.schema, TargetPlatformSchema.id: TargetPlatformSchema.schema, @@ -183,6 +190,7 @@ class Schemas { TextInputTypeSchema.id: TextInputTypeSchema.schema, TextLeadingDistributionSchema.id: TextLeadingDistributionSchema.schema, TextOverflowSchema.id: TextOverflowSchema.schema, + TextScalerSchema.id: TextScalerSchema.schema, TextSelectionThemeDataSchema.id: TextSelectionThemeDataSchema.schema, TextSpanSchema.id: TextSpanSchema.schema, TextStyleSchema.id: TextStyleSchema.schema, diff --git a/json_theme/lib/src/schema/schemas/enums.dart b/json_theme/lib/src/schema/schemas/enums.dart index ddbca10..b145208 100644 --- a/json_theme/lib/src/schema/schemas/enums.dart +++ b/json_theme/lib/src/schema/schemas/enums.dart @@ -5,6 +5,7 @@ class Enums { static List all = [ AlignmentDirectionalSchema.id, AndroidOverscrollIndicatorSchema.id, + AnimationStyleSchema.id, AxisSchema.id, AutovalidateModeSchema.id, BlendModeSchema.id, @@ -23,6 +24,7 @@ class Enums { CrossAxisAlignmentSchema.id, CrossFadeStateSchema.id, DecorationPositionSchema.id, + DismissDirectionSchema.id, DragStartBehaviorSchema.id, FilterQualitySchema.id, FlexFitSchema.id, diff --git a/json_theme/lib/src/schema/schemas/enums/animation_style_schema.dart b/json_theme/lib/src/schema/schemas/enums/animation_style_schema.dart new file mode 100644 index 0000000..83b823e --- /dev/null +++ b/json_theme/lib/src/schema/schemas/enums/animation_style_schema.dart @@ -0,0 +1,16 @@ +import 'package:json_theme/json_theme_schemas.dart'; + +class AnimationStyleSchema { + static const id = + 'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/animation_style.json'; + + static final schema = { + r'$schema': 'http://json-schema.org/draft-07/schema#', + r'$id': id, + 'type': 'string', + 'title': 'AnimationStyle', + 'oneOf': SchemaHelper.enumSchema([ + 'noAnimation', + ]), + }; +} diff --git a/json_theme/lib/src/schema/schemas/enums/dismiss_direction_schema.dart b/json_theme/lib/src/schema/schemas/enums/dismiss_direction_schema.dart new file mode 100644 index 0000000..80c56a5 --- /dev/null +++ b/json_theme/lib/src/schema/schemas/enums/dismiss_direction_schema.dart @@ -0,0 +1,22 @@ +import 'package:json_theme/json_theme_schemas.dart'; + +class DismissDirectionSchema { + static const id = + 'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/dismiss_direction.json'; + + static final schema = { + r'$schema': 'http://json-schema.org/draft-07/schema#', + r'$id': id, + 'type': 'string', + 'title': 'DismissDirection', + 'oneOf': SchemaHelper.enumSchema([ + 'down', + 'endToStart', + 'horizontal', + 'none', + 'startToEnd', + 'up', + 'vertical', + ]), + }; +} diff --git a/json_theme/lib/src/schema/schemas/enums/list_tile_control_affinity_schema.dart b/json_theme/lib/src/schema/schemas/enums/list_tile_control_affinity_schema.dart new file mode 100644 index 0000000..28467cb --- /dev/null +++ b/json_theme/lib/src/schema/schemas/enums/list_tile_control_affinity_schema.dart @@ -0,0 +1,18 @@ +import 'package:json_theme/json_theme_schemas.dart'; + +class ListTileControlAffinitySchema { + static const id = + 'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/list_tile_control_affinity.json'; + + static final schema = { + r'$schema': 'http://json-schema.org/draft-07/schema#', + r'$id': id, + 'title': 'ListTileControlAffinity', + 'type': 'string', + 'oneOf': SchemaHelper.enumSchema([ + 'leading', + 'platform', + 'trailing', + ]), + }; +} diff --git a/json_theme/lib/src/schema/schemas/enums/tab_indicator_animation_schema.dart b/json_theme/lib/src/schema/schemas/enums/tab_indicator_animation_schema.dart new file mode 100644 index 0000000..3b41792 --- /dev/null +++ b/json_theme/lib/src/schema/schemas/enums/tab_indicator_animation_schema.dart @@ -0,0 +1,17 @@ +import 'package:json_theme/json_theme_schemas.dart'; + +class TabIndicatorAnimationSchema { + static const id = + 'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/tab_indicator_animation.json'; + + static final schema = { + r'$schema': 'http://json-schema.org/draft-07/schema#', + r'$id': id, + 'type': 'string', + 'title': 'TabIndicatorAnimationSchema', + 'oneOf': SchemaHelper.enumSchema([ + 'elastic', + 'linear', + ]), + }; +} diff --git a/json_theme/lib/src/schema/schemas/enums/text_scaler_schema.dart b/json_theme/lib/src/schema/schemas/enums/text_scaler_schema.dart new file mode 100644 index 0000000..0c384e9 --- /dev/null +++ b/json_theme/lib/src/schema/schemas/enums/text_scaler_schema.dart @@ -0,0 +1,16 @@ +import 'package:json_theme/json_theme_schemas.dart'; + +class TextScalerSchema { + static const id = + 'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/text_scaler.json'; + + static final schema = { + r'$schema': 'http://json-schema.org/draft-07/schema#', + r'$id': id, + 'type': 'string', + 'title': 'TextScaler', + 'oneOf': SchemaHelper.enumSchema([ + 'noScaling', + ]), + }; +} diff --git a/json_theme/lib/src/schema/schemas/objects/card_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/card_theme_data_schema.dart new file mode 100644 index 0000000..5ed89b1 --- /dev/null +++ b/json_theme/lib/src/schema/schemas/objects/card_theme_data_schema.dart @@ -0,0 +1,24 @@ +import 'package:json_theme/json_theme_schemas.dart'; + +class CardThemeDataSchema { + static const id = + 'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/card_theme_data.json'; + + static final schema = { + r'$schema': 'http://json-schema.org/draft-07/schema#', + r'$id': id, + r'$comment': + 'https://api.flutter.dev/flutter/material/CardThemeData-class.html', + 'title': 'CardTheme', + 'type': 'object', + 'properties': { + 'clipBehavior': SchemaHelper.objectSchema(ClipSchema.id), + 'color': SchemaHelper.objectSchema(ColorSchema.id), + 'elevation': SchemaHelper.numberSchema, + 'margin': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), + 'shadowColor': SchemaHelper.objectSchema(ColorSchema.id), + 'shape': SchemaHelper.objectSchema(ShapeBorderSchema.id), + 'surfaceTintColor': SchemaHelper.objectSchema(ColorSchema.id), + }, + }; +} diff --git a/json_theme/lib/src/schema/schemas/objects/card_theme_schema.dart b/json_theme/lib/src/schema/schemas/objects/card_theme_schema.dart index 496d2a2..aaa0c1b 100644 --- a/json_theme/lib/src/schema/schemas/objects/card_theme_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/card_theme_schema.dart @@ -14,6 +14,7 @@ class CardThemeSchema { 'properties': { 'clipBehavior': SchemaHelper.objectSchema(ClipSchema.id), 'color': SchemaHelper.objectSchema(ColorSchema.id), + 'data': SchemaHelper.objectSchema(CardThemeDataSchema.id), 'elevation': SchemaHelper.numberSchema, 'margin': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), 'shadowColor': SchemaHelper.objectSchema(ColorSchema.id), diff --git a/json_theme/lib/src/schema/schemas/objects/chip_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/chip_theme_data_schema.dart index 3729391..9330410 100644 --- a/json_theme/lib/src/schema/schemas/objects/chip_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/chip_theme_data_schema.dart @@ -12,10 +12,14 @@ class ChipThemeDataSchema { 'title': 'ChipThemeData', 'type': 'object', 'properties': { + 'avatarIconBoxConstraints': + SchemaHelper.objectSchema(BoxConstraintsSchema.id), 'backgroundColor': SchemaHelper.objectSchema(ColorSchema.id), 'brightness': SchemaHelper.objectSchema(BrightnessSchema.id), 'checkmarkColor': SchemaHelper.objectSchema(ColorSchema.id), 'color': SchemaHelper.objectSchema(WidgetStatePropertyColorSchema.id), + 'deleteIconBoxConstraints': + SchemaHelper.objectSchema(BoxConstraintsSchema.id), 'deleteIconColor': SchemaHelper.objectSchema(ColorSchema.id), 'disabledColor': SchemaHelper.objectSchema(ColorSchema.id), 'elevation': SchemaHelper.numberSchema, diff --git a/json_theme/lib/src/schema/schemas/objects/cupertino_text_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/cupertino_text_theme_data_schema.dart index 4780538..9f4ccfb 100644 --- a/json_theme/lib/src/schema/schemas/objects/cupertino_text_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/cupertino_text_theme_data_schema.dart @@ -12,6 +12,7 @@ class CupertinoTextThemeDataSchema { 'title': 'CupertinoTextThemeData', 'type': 'object', 'properties': { + 'actionSmallTextStyle': SchemaHelper.objectSchema(TextStyleSchema.id), 'actionTextStyle': SchemaHelper.objectSchema(TextStyleSchema.id), 'dateTimePickerTextStyle': SchemaHelper.objectSchema(TextStyleSchema.id), 'navActionTextStyle': SchemaHelper.objectSchema(TextStyleSchema.id), diff --git a/json_theme/lib/src/schema/schemas/objects/data_table_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/data_table_theme_data_schema.dart index 98fdfcd..6ec8945 100644 --- a/json_theme/lib/src/schema/schemas/objects/data_table_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/data_table_theme_data_schema.dart @@ -25,6 +25,9 @@ class DataTableThemeDataSchema { 'dividerThickness': SchemaHelper.numberSchema, 'headingCellCursor': SchemaHelper.objectSchema(WidgetStatePropertyMouseCursorSchema.id), + 'headingRowAlignment': SchemaHelper.objectSchema( + MainAxisAlignmentSchema.id, + ), 'headingRowColor': SchemaHelper.objectSchema(WidgetStatePropertyColorSchema.id), 'headingRowHeight': SchemaHelper.numberSchema, diff --git a/json_theme/lib/src/schema/schemas/objects/date_picker_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/date_picker_theme_data_schema.dart index 836b80e..f542cd7 100644 --- a/json_theme/lib/src/schema/schemas/objects/date_picker_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/date_picker_theme_data_schema.dart @@ -24,6 +24,9 @@ class DatePickerThemeDataSchema { 'dayOverlayColor': SchemaHelper.objectSchema( WidgetStatePropertyColorSchema.id, ), + 'dayShape': SchemaHelper.objectSchema( + WidgetStatePropertyOutlinedBorderSchema.id, + ), 'dayStyle': SchemaHelper.objectSchema(TextStyleSchema.id), 'dividerColor': SchemaHelper.objectSchema(ColorSchema.id), 'elevation': SchemaHelper.numberSchema, @@ -31,6 +34,7 @@ class DatePickerThemeDataSchema { 'headerForegroundColor': SchemaHelper.objectSchema(ColorSchema.id), 'headerHeadlineStyle': SchemaHelper.objectSchema(TextStyleSchema.id), 'headerHelpStyle': SchemaHelper.objectSchema(TextStyleSchema.id), + 'locale': SchemaHelper.objectSchema(LocaleSchema.id), 'rangePickerBackgroundColor': SchemaHelper.objectSchema(ColorSchema.id), 'rangePickerElevation': SchemaHelper.numberSchema, 'rangePickerHeaderBackgroundColor': SchemaHelper.objectSchema( diff --git a/json_theme/lib/src/schema/schemas/objects/dialog_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/dialog_theme_data_schema.dart new file mode 100644 index 0000000..bc8523d --- /dev/null +++ b/json_theme/lib/src/schema/schemas/objects/dialog_theme_data_schema.dart @@ -0,0 +1,29 @@ +import 'package:json_theme/json_theme_schemas.dart'; + +class DialogThemeDataSchema { + static const id = + 'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/dialog_theme_data.json'; + + static final schema = { + r'$schema': 'http://json-schema.org/draft-07/schema#', + r'$id': id, + r'$comment': + 'https://api.flutter.dev/flutter/material/DialogThemeData-class.html', + 'title': 'DialogThemeData', + 'type': 'object', + 'properties': { + 'actionsPadding': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), + 'alignment': SchemaHelper.objectSchema(AlignmentSchema.id), + 'backgroundColor': SchemaHelper.objectSchema(ColorSchema.id), + 'barrierColor': SchemaHelper.objectSchema(ColorSchema.id), + 'clipBehavior': SchemaHelper.objectSchema(ClipSchema.id), + 'contentTextStyle': SchemaHelper.objectSchema(TextStyleSchema.id), + 'elevation': SchemaHelper.numberSchema, + 'iconCoor': SchemaHelper.objectSchema(ColorSchema.id), + 'shadowColor': SchemaHelper.objectSchema(ShapeBorderSchema.id), + 'shape': SchemaHelper.objectSchema(ShapeBorderSchema.id), + 'surfaceTintColor': SchemaHelper.objectSchema(ColorSchema.id), + 'titleTextStyle': SchemaHelper.objectSchema(TextStyleSchema.id), + }, + }; +} diff --git a/json_theme/lib/src/schema/schemas/objects/dialog_theme_schema.dart b/json_theme/lib/src/schema/schemas/objects/dialog_theme_schema.dart index ae48d64..8845381 100644 --- a/json_theme/lib/src/schema/schemas/objects/dialog_theme_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/dialog_theme_schema.dart @@ -15,7 +15,10 @@ class DialogThemeSchema { 'actionsPadding': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), 'alignment': SchemaHelper.objectSchema(AlignmentSchema.id), 'backgroundColor': SchemaHelper.objectSchema(ColorSchema.id), + 'barrierColor': SchemaHelper.objectSchema(ColorSchema.id), + 'clipBehavior': SchemaHelper.objectSchema(ClipSchema.id), 'contentTextStyle': SchemaHelper.objectSchema(TextStyleSchema.id), + 'data': SchemaHelper.objectSchema(DialogThemeDataSchema.id), 'elevation': SchemaHelper.numberSchema, 'iconCoor': SchemaHelper.objectSchema(ColorSchema.id), 'shadowColor': SchemaHelper.objectSchema(ShapeBorderSchema.id), diff --git a/json_theme/lib/src/schema/schemas/objects/expansion_tile_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/expansion_tile_theme_data_schema.dart index 453da63..1d55d96 100644 --- a/json_theme/lib/src/schema/schemas/objects/expansion_tile_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/expansion_tile_theme_data_schema.dart @@ -20,6 +20,9 @@ class ExpansionTileThemeDataSchema { 'collapsedShape': SchemaHelper.objectSchema(ShapeBorderSchema.id), 'collapsedTextColor': SchemaHelper.objectSchema(ColorSchema.id), 'expandedAlignment': SchemaHelper.objectSchema(AlignmentSchema.id), + 'expansionAnimationStyle': SchemaHelper.objectSchema( + AnimationStyleSchema.id, + ), 'iconColor': SchemaHelper.objectSchema(ColorSchema.id), 'shape': SchemaHelper.objectSchema(ShapeBorderSchema.id), 'textColor': SchemaHelper.objectSchema(ColorSchema.id), diff --git a/json_theme/lib/src/schema/schemas/objects/icon_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/icon_data_schema.dart index d893bc2..a791df0 100644 --- a/json_theme/lib/src/schema/schemas/objects/icon_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/icon_data_schema.dart @@ -17,6 +17,17 @@ class IconDataSchema { 'properties': { 'codePoint': SchemaHelper.numberSchema, 'fontFamily': SchemaHelper.stringSchema, + 'fontFamilyFallback': { + 'anyOf': [ + { + 'type': 'string', + }, + { + 'type': 'array', + 'items': {'type': 'string'}, + }, + ], + }, 'fontPackage': SchemaHelper.stringSchema, 'matchTextDirection': SchemaHelper.boolSchema, }, diff --git a/json_theme/lib/src/schema/schemas/objects/icon_schema.dart b/json_theme/lib/src/schema/schemas/objects/icon_schema.dart index dfeabb6..36b45fb 100644 --- a/json_theme/lib/src/schema/schemas/objects/icon_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/icon_schema.dart @@ -15,6 +15,8 @@ class IconSchema { 'icon', ], 'properties': { + 'applyTextScaling': SchemaHelper.boolSchema, + 'blendMode': SchemaHelper.objectSchema(BlendModeSchema.id), 'color': SchemaHelper.objectSchema(ColorSchema.id), 'fill': SchemaHelper.numberSchema, 'grade': SchemaHelper.numberSchema, diff --git a/json_theme/lib/src/schema/schemas/objects/icon_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/icon_theme_data_schema.dart index 709b54c..636d452 100644 --- a/json_theme/lib/src/schema/schemas/objects/icon_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/icon_theme_data_schema.dart @@ -12,6 +12,7 @@ class IconThemeDataSchema { 'title': 'IconThemeData', 'type': 'object', 'properties': { + 'applyTextScaling': SchemaHelper.boolSchema, 'color': SchemaHelper.objectSchema(ColorSchema.id), 'fill': SchemaHelper.numberSchema, 'grade': SchemaHelper.numberSchema, diff --git a/json_theme/lib/src/schema/schemas/objects/input_decoration_theme_schema.dart b/json_theme/lib/src/schema/schemas/objects/input_decoration_theme_schema.dart index f4e6b86..156e5cd 100644 --- a/json_theme/lib/src/schema/schemas/objects/input_decoration_theme_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/input_decoration_theme_schema.dart @@ -44,8 +44,14 @@ class InputDecorationThemeSchema { 'labelStyle': SchemaHelper.objectSchema(TextStyleSchema.id), 'outlineBorder': SchemaHelper.objectSchema(BorderSideSchema.id), 'prefixIconColor': SchemaHelper.objectSchema(ColorSchema.id), + 'prefixIconConstraints': SchemaHelper.objectSchema( + BoxConstraintsSchema.id, + ), 'prefixStyle': SchemaHelper.objectSchema(TextStyleSchema.id), 'suffixIconColor': SchemaHelper.objectSchema(ColorSchema.id), + 'suffixIconConstraints': SchemaHelper.objectSchema( + BoxConstraintsSchema.id, + ), 'suffixStyle': SchemaHelper.objectSchema(TextStyleSchema.id), }, }; diff --git a/json_theme/lib/src/schema/schemas/objects/list_tile_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/list_tile_theme_data_schema.dart index 20b133d..4e60a97 100644 --- a/json_theme/lib/src/schema/schemas/objects/list_tile_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/list_tile_theme_data_schema.dart @@ -13,6 +13,9 @@ class ListTileThemeDataSchema { 'type': 'object', 'properties': { 'contentPadding': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), + 'controlAffinity': SchemaHelper.objectSchema( + ListTileControlAffinitySchema.id, + ), 'dense': SchemaHelper.boolSchema, 'enableFeedback': SchemaHelper.boolSchema, 'horizontalTitleGap': SchemaHelper.numberSchema, @@ -21,6 +24,7 @@ class ListTileThemeDataSchema { TextStyleSchema.id, ), 'minLeadingWidth': SchemaHelper.numberSchema, + 'minTileHeight': SchemaHelper.numberSchema, 'minVerticalPadding': SchemaHelper.numberSchema, 'mouseCursor': SchemaHelper.objectSchema( WidgetStatePropertyMouseCursorSchema.id, diff --git a/json_theme/lib/src/schema/schemas/objects/navigation_bar_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/navigation_bar_theme_data_schema.dart index f923508..720037c 100644 --- a/json_theme/lib/src/schema/schemas/objects/navigation_bar_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/navigation_bar_theme_data_schema.dart @@ -27,6 +27,9 @@ class NavigationBarThemeDataSchema { 'labelTextStyle': SchemaHelper.objectSchema( WidgetStatePropertyTextStyleSchema.id, ), + 'overlayColor': SchemaHelper.objectSchema( + WidgetStatePropertyColorSchema.id, + ), 'shadowColor': SchemaHelper.objectSchema(ColorSchema.id), 'surfaceTintColor': SchemaHelper.objectSchema(ColorSchema.id), }, diff --git a/json_theme/lib/src/schema/schemas/objects/popup_menu_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/popup_menu_theme_data_schema.dart index fd2da14..79e06b9 100644 --- a/json_theme/lib/src/schema/schemas/objects/popup_menu_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/popup_menu_theme_data_schema.dart @@ -21,6 +21,7 @@ class PopupMenuThemeDataSchema { 'labelTextStyle': SchemaHelper.objectSchema( WidgetStatePropertyTextStyleSchema.id, ), + 'menuPadding': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), 'mouseCursor': SchemaHelper.objectSchema( WidgetStatePropertyMouseCursorSchema.id, ), diff --git a/json_theme/lib/src/schema/schemas/objects/slider_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/slider_theme_data_schema.dart index aba88d3..7f5e1d8 100644 --- a/json_theme/lib/src/schema/schemas/objects/slider_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/slider_theme_data_schema.dart @@ -63,6 +63,7 @@ class SliderThemeDataSchema { 'valueIndicatorShape': SchemaHelper.objectSchema( SliderComponentShapeSchema.id, ), + 'valueIndicatorStrokeColor': SchemaHelper.objectSchema(ColorSchema.id), 'valueIndicatorTextStyle': SchemaHelper.objectSchema(TextStyleSchema.id), }, }; diff --git a/json_theme/lib/src/schema/schemas/objects/snack_bar_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/snack_bar_theme_data_schema.dart index eb4f101..e563b9f 100644 --- a/json_theme/lib/src/schema/schemas/objects/snack_bar_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/snack_bar_theme_data_schema.dart @@ -22,6 +22,7 @@ class SnackBarThemeDataSchema { 'disabledActionBackgroundColor': SchemaHelper.objectSchema(ColorSchema.id), 'disabledActionTextColor': SchemaHelper.objectSchema(ColorSchema.id), + 'dismissDirection': SchemaHelper.objectSchema(DismissDirectionSchema.id), 'elevation': SchemaHelper.numberSchema, 'insetPadding': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), 'shape': SchemaHelper.objectSchema(ShapeBorderSchema.id), diff --git a/json_theme/lib/src/schema/schemas/objects/switch_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/switch_theme_data_schema.dart index 12d52ad..303eb82 100644 --- a/json_theme/lib/src/schema/schemas/objects/switch_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/switch_theme_data_schema.dart @@ -19,6 +19,7 @@ class SwitchThemeDataSchema { 'overlayColor': SchemaHelper.objectSchema( WidgetStatePropertyColorSchema.id, ), + 'padding': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), 'splashRadius': SchemaHelper.numberSchema, 'thumbColor': SchemaHelper.objectSchema( WidgetStatePropertyColorSchema.id, diff --git a/json_theme/lib/src/schema/schemas/objects/tab_bar_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/tab_bar_theme_data_schema.dart new file mode 100644 index 0000000..2c21a10 --- /dev/null +++ b/json_theme/lib/src/schema/schemas/objects/tab_bar_theme_data_schema.dart @@ -0,0 +1,37 @@ +import 'package:json_theme/json_theme_schemas.dart'; + +class TabBarThemeDataSchema { + static const id = + 'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/tab_bar_theme_data.json'; + + static final schema = { + r'$schema': 'http://json-schema.org/draft-07/schema#', + r'$id': id, + 'title': 'TabBarThemeDataS', + 'type': 'object', + 'properties': { + 'dividerColor': SchemaHelper.objectSchema(ColorSchema.id), + 'dividerHeight': SchemaHelper.numberSchema, + 'indicatorAnimation': SchemaHelper.objectSchema( + TabIndicatorAnimationSchema.id, + ), + 'indicatorColor': SchemaHelper.objectSchema(ColorSchema.id), + 'indicatorSize': SchemaHelper.objectSchema(TabBarIndicatorSizeSchema.id), + 'labelPadding': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), + 'labelColor': SchemaHelper.objectSchema(ColorSchema.id), + 'labelStyle': SchemaHelper.objectSchema(TextStyleSchema.id), + 'mouseCursor': SchemaHelper.objectSchema( + WidgetStatePropertyMouseCursorSchema.id, + ), + 'overlayColor': SchemaHelper.objectSchema( + WidgetStatePropertyColorSchema.id, + ), + 'splashFactory': SchemaHelper.objectSchema( + InteractiveInkFeatureFactorySchema.id, + ), + 'tabAlignment': SchemaHelper.objectSchema(TabAlignmentSchema.id), + 'unselectedLabelColor': SchemaHelper.objectSchema(ColorSchema.id), + 'unselectedLabelStyle': SchemaHelper.objectSchema(TextStyleSchema.id), + }, + }; +} diff --git a/json_theme/lib/src/schema/schemas/objects/tab_bar_theme_schema.dart b/json_theme/lib/src/schema/schemas/objects/tab_bar_theme_schema.dart index 15c2426..1721a6d 100644 --- a/json_theme/lib/src/schema/schemas/objects/tab_bar_theme_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/tab_bar_theme_schema.dart @@ -12,6 +12,7 @@ class TabBarThemeSchema { 'title': 'TabBarTheme', 'type': 'object', 'properties': { + 'data': SchemaHelper.objectSchema(TabBarThemeDataSchema.id), 'dividerColor': SchemaHelper.objectSchema(ColorSchema.id), 'dividerHeight': SchemaHelper.numberSchema, 'indicatorColor': SchemaHelper.objectSchema(ColorSchema.id), diff --git a/json_theme/lib/src/schema/schemas/objects/time_picker_theme_data_schema.dart b/json_theme/lib/src/schema/schemas/objects/time_picker_theme_data_schema.dart index 8e24510..bd7056c 100644 --- a/json_theme/lib/src/schema/schemas/objects/time_picker_theme_data_schema.dart +++ b/json_theme/lib/src/schema/schemas/objects/time_picker_theme_data_schema.dart @@ -36,6 +36,12 @@ class TimePickerThemeDataSchema { ), 'padding': SchemaHelper.objectSchema(EdgeInsetsGeometrySchema.id), 'shape': SchemaHelper.objectSchema(ShapeBorderSchema.id), + 'timeSelectorSeparatorColor': SchemaHelper.objectSchema( + WidgetStatePropertyColorSchema.id, + ), + 'timeSelectorSeparatorTextStyle': SchemaHelper.objectSchema( + WidgetStatePropertyTextStyleSchema.id, + ), }, }; } diff --git a/json_theme/pubspec.yaml b/json_theme/pubspec.yaml index 9134a9d..892b90f 100644 --- a/json_theme/pubspec.yaml +++ b/json_theme/pubspec.yaml @@ -1,7 +1,7 @@ name: 'json_theme' description: 'A library to dynamically generate a ThemeData object from a JSON file or dynamic map object' homepage: 'https://github.com/peiffer-innovations/json_theme' -version: '7.0.0-dev.1' +version: '7.0.0' environment: sdk: '>=3.2.0 <4.0.0' diff --git a/json_theme/test/json_theme_test.dart b/json_theme/test/json_theme_test.dart index b68c64e..25854fb 100644 --- a/json_theme/test/json_theme_test.dart +++ b/json_theme/test/json_theme_test.dart @@ -444,6 +444,28 @@ void main() { ); }); + test('AnimationStyle', () { + expect(ThemeDecoder.decodeAnimationStyle(null), null); + expect(ThemeEncoder.encodeAnimationStyle(null), null); + + expect( + ThemeDecoder.decodeAnimationStyle( + AnimationStyle.noAnimation, + ), + AnimationStyle.noAnimation, + ); + + expect( + ThemeDecoder.decodeAnimationStyle('noAnimation'), + AnimationStyle.noAnimation, + ); + + expect( + ThemeEncoder.encodeAnimationStyle(AnimationStyle.noAnimation), + 'noAnimation', + ); + }); + test('AppBarTheme', () { expect(ThemeDecoder.decodeAppBarTheme(null), null); expect(ThemeEncoder.encodeAppBarTheme(null), null); @@ -1946,9 +1968,133 @@ void main() { test('CardTheme', () { expect(ThemeDecoder.decodeCardTheme(null), null); + expect(ThemeEncoder.encodeCardTheme(null), null); + + const corner = { + 'type': 'elliptical', + 'x': 12.0, + 'y': 12.0, + }; + + var entry = ThemeDecoder.decodeCardTheme({ + 'clipBehavior': 'hardEdge', + 'color': '#ff111111', + 'elevation': 3.0, + 'margin': { + 'bottom': 10.0, + 'left': 10.0, + 'right': 10.0, + 'top': 10.0, + }, + 'shadowColor': '#ff222222', + 'shape': { + 'borderRadius': { + 'bottomLeft': corner, + 'bottomRight': corner, + 'topLeft': corner, + 'topRight': corner, + 'type': 'only' + }, + 'side': { + 'color': '#ff000000', + 'strokeAlign': -1.0, + 'style': 'none', + 'width': 0.0, + }, + 'type': 'rounded' + } + }); + + expect(ThemeDecoder.decodeCardTheme(entry), entry); + + var encoded = ThemeEncoder.encodeCardTheme(entry); + + expect(encoded, { + 'data': { + 'clipBehavior': 'hardEdge', + 'color': '#ff111111', + 'elevation': 3.0, + 'margin': { + 'bottom': 10.0, + 'left': 10.0, + 'right': 10.0, + 'top': 10.0, + }, + 'shadowColor': '#ff222222', + 'shape': { + 'borderRadius': { + 'bottomLeft': corner, + 'bottomRight': corner, + 'topLeft': corner, + 'topRight': corner, + 'type': 'only' + }, + 'side': { + 'color': '#ff000000', + 'strokeAlign': -1.0, + 'style': 'none', + 'width': 0.0, + }, + 'type': 'rounded' + } + } + }); + + entry = CardTheme( + data: CardThemeData( + clipBehavior: Clip.hardEdge, + color: const Color(0xff111111), + elevation: 3.0, + margin: const EdgeInsets.all(10.0), + shadowColor: const Color(0xff222222), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), + side: BorderSide.none, + ), + ), + ); + + expect(ThemeDecoder.decodeCardTheme(entry), entry); + + encoded = ThemeEncoder.encodeCardTheme(entry); + + expect(encoded, { + 'data': { + 'clipBehavior': 'hardEdge', + 'color': '#ff111111', + 'elevation': 3.0, + 'margin': { + 'bottom': 10.0, + 'left': 10.0, + 'right': 10.0, + 'top': 10.0, + }, + 'shadowColor': '#ff222222', + 'shape': { + 'borderRadius': { + 'bottomLeft': corner, + 'bottomRight': corner, + 'topLeft': corner, + 'topRight': corner, + 'type': 'only' + }, + 'side': { + 'color': '#ff000000', + 'strokeAlign': -1.0, + 'style': 'none', + 'width': 0.0, + }, + 'type': 'rounded' + } + } + }); + }); + + test('CardThemeData', () { + expect(ThemeDecoder.decodeCardThemeData(null), null); expect(ThemeEncoder.encodeCardThemeData(null), null); - final entry = CardTheme( + final entry = CardThemeData( clipBehavior: Clip.hardEdge, color: const Color(0xff111111), elevation: 3.0, @@ -1960,7 +2106,7 @@ void main() { ), ); - expect(ThemeDecoder.decodeCardTheme(entry), entry); + expect(ThemeDecoder.decodeCardThemeData(entry), entry); const corner = { 'type': 'elliptical', @@ -1968,10 +2114,8 @@ void main() { 'y': 12.0, }; - final encoded = ThemeEncoder.encodeCardThemeData( - entry.data, - ); - final decoded = ThemeDecoder.decodeCardTheme(encoded); + final encoded = ThemeEncoder.encodeCardThemeData(entry); + final decoded = ThemeDecoder.decodeCardThemeData(encoded); expect(encoded, { 'clipBehavior': 'hardEdge', @@ -2061,12 +2205,14 @@ void main() { expect(ThemeEncoder.encodeChipThemeData(null), null); final entry = ChipThemeData( + avatarBoxConstraints: BoxConstraints(minWidth: 10), backgroundColor: const Color(0xff111111), brightness: Brightness.light, checkmarkColor: const Color(0xff222222), color: WidgetStateProperty.all( const Color(0xff555555), ), + deleteIconBoxConstraints: BoxConstraints(minWidth: 20), deleteIconColor: const Color(0xff333333), disabledColor: const Color(0xff444444), elevation: 2.0, @@ -2097,10 +2243,18 @@ void main() { expect( encoded, { + 'avatarBoxConstraints': { + 'minHeight': 0.0, + 'minWidth': 10.0, + }, 'backgroundColor': '#ff111111', 'brightness': 'light', 'checkmarkColor': '#ff222222', 'color': _materializeState('#ff555555'), + 'deleteIconBoxConstraints': { + 'minHeight': 0.0, + 'minWidth': 20.0, + }, 'deleteIconColor': '#ff333333', 'disabledColor': '#ff444444', 'elevation': 2.0, @@ -2400,6 +2554,7 @@ void main() { expect(ThemeEncoder.encodeCupertinoTextThemeData(null), null); const entry = CupertinoTextThemeData( + actionSmallTextStyle: _kTextStyle, actionTextStyle: _kTextStyle, dateTimePickerTextStyle: _kTextStyle, navActionTextStyle: _kTextStyle, @@ -2416,6 +2571,7 @@ void main() { final encoded = ThemeEncoder.encodeCupertinoTextThemeData(entry); final decoded = ThemeDecoder.decodeCupertinoTextThemeData( { + 'actionSmallTextStyle': _kTextStyleJson, 'actionTextStyle': _kTextStyleJson, 'dateTimePickerTextStyle': _kTextStyleJson, 'navActionTextStyle': _kTextStyleJson, @@ -2431,6 +2587,7 @@ void main() { expect( encoded, { + 'actionSmallTextStyle': _kTextStyleJson, 'actionTextStyle': _kTextStyleJson, 'dateTimePickerTextStyle': _kTextStyleJson, 'navActionTextStyle': _kTextStyleJson, @@ -2442,11 +2599,14 @@ void main() { }, ); + expect( + decoded.actionSmallTextStyle, + entry.actionSmallTextStyle, + ); expect( decoded.actionTextStyle, entry.actionTextStyle, ); - expect( decoded.dateTimePickerTextStyle, entry.dateTimePickerTextStyle, @@ -2514,6 +2674,14 @@ void main() { 'primaryContrastingColor': '#ff333333', 'scaffoldBackgroundColor': '#ff444444', 'textTheme': { + 'actionSmallTextStyle': { + 'color': '#ff555555', + 'decoration': 'none', + 'fontFamily': 'CupertinoSystemText', + 'fontSize': 15.0, + 'inherit': false, + 'letterSpacing': -0.23 + }, 'actionTextStyle': { 'color': '#11111111', 'inherit': true, @@ -2643,6 +2811,7 @@ void main() { decoration: const BoxDecoration(color: _kColor), dividerThickness: 1.0, headingCellCursor: const WidgetStatePropertyAll(SystemMouseCursors.click), + headingRowAlignment: MainAxisAlignment.center, headingRowColor: WidgetStateProperty.all( const Color(0xff555555), ), @@ -2694,6 +2863,7 @@ void main() { 'scrolledUnder': {'cursor': 'click', 'type': 'system'}, 'selected': {'cursor': 'click', 'type': 'system'} }, + 'headingRowAlignment': 'center', 'headingRowColor': _materializeState('#ff555555'), 'headingRowHeight': 1.0, 'headingTextStyle': { @@ -2847,12 +3017,13 @@ void main() { test('DialogTheme', () { expect(ThemeDecoder.decodeDialogTheme(null), null); - expect(ThemeEncoder.encodeDialogThemeData(null), null); + expect(ThemeEncoder.encodeDialogTheme(null), null); const entry = DialogTheme( actionsPadding: EdgeInsets.all(8.0), alignment: Alignment.bottomLeft, backgroundColor: _kColor, + clipBehavior: Clip.hardEdge, contentTextStyle: _kTextStyle, elevation: 1.0, shadowColor: _kColor, @@ -2862,10 +3033,82 @@ void main() { expect(ThemeDecoder.decodeDialogTheme(entry), entry); - final encoded = ThemeEncoder.encodeDialogThemeData( - entry.data, + final encoded = ThemeEncoder.encodeDialogTheme(entry); + + expect( + encoded, + { + 'data': { + 'actionsPadding': { + 'bottom': 8.0, + 'left': 8.0, + 'right': 8.0, + 'top': 8.0, + }, + 'alignment': 'bottomLeft', + 'backgroundColor': _kColorStr, + 'clipBehavior': 'hardEdge', + 'contentTextStyle': _kTextStyleJson, + 'elevation': 1.0, + 'shadowColor': _kColorStr, + 'shape': { + 'borderRadius': { + 'bottomLeft': { + 'type': 'elliptical', + 'x': 0.0, + 'y': 0.0, + }, + 'bottomRight': { + 'type': 'elliptical', + 'x': 0.0, + 'y': 0.0, + }, + 'topLeft': { + 'type': 'elliptical', + 'x': 0.0, + 'y': 0.0, + }, + 'topRight': { + 'type': 'elliptical', + 'x': 0.0, + 'y': 0.0, + }, + 'type': 'only' + }, + 'side': { + 'color': '#ff000000', + 'strokeAlign': -1, + 'style': 'none', + 'width': 0.0, + }, + 'type': 'rounded' + }, + 'surfaceTintColor': _kColorStr, + }, + }, + ); + }); + + test('DialogThemeData', () { + expect(ThemeDecoder.decodeDialogThemeData(null), null); + expect(ThemeEncoder.encodeDialogThemeData(null), null); + + const entry = DialogThemeData( + actionsPadding: EdgeInsets.all(8.0), + alignment: Alignment.bottomLeft, + backgroundColor: _kColor, + clipBehavior: Clip.hardEdge, + contentTextStyle: _kTextStyle, + elevation: 1.0, + shadowColor: _kColor, + shape: RoundedRectangleBorder(), + surfaceTintColor: _kColor, ); - final decoded = ThemeDecoder.decodeDialogTheme(encoded); + + expect(ThemeDecoder.decodeDialogThemeData(entry), entry); + + final encoded = ThemeEncoder.encodeDialogThemeData(entry); + final decoded = ThemeDecoder.decodeDialogThemeData(encoded); expect( encoded, @@ -2878,6 +3121,7 @@ void main() { }, 'alignment': 'bottomLeft', 'backgroundColor': _kColorStr, + 'clipBehavior': 'hardEdge', 'contentTextStyle': _kTextStyleJson, 'elevation': 1.0, 'shadowColor': _kColorStr, @@ -2923,6 +3167,76 @@ void main() { ); }); + test('DismissDirection', () { + expect(ThemeDecoder.decodeDismissDirection(null), null); + expect(ThemeEncoder.encodeDismissDirection(null), null); + + expect( + ThemeDecoder.decodeDismissDirection( + DismissDirection.down, + ), + DismissDirection.down, + ); + + expect( + ThemeDecoder.decodeDismissDirection('down'), + DismissDirection.down, + ); + expect( + ThemeDecoder.decodeDismissDirection('endToStart'), + DismissDirection.endToStart, + ); + expect( + ThemeDecoder.decodeDismissDirection('horizontal'), + DismissDirection.horizontal, + ); + expect( + ThemeDecoder.decodeDismissDirection('none'), + DismissDirection.none, + ); + expect( + ThemeDecoder.decodeDismissDirection('startToEnd'), + DismissDirection.startToEnd, + ); + expect( + ThemeDecoder.decodeDismissDirection('up'), + DismissDirection.up, + ); + expect( + ThemeDecoder.decodeDismissDirection('vertical'), + DismissDirection.vertical, + ); + + expect( + ThemeEncoder.encodeDismissDirection(DismissDirection.down), + 'down', + ); + expect( + ThemeEncoder.encodeDismissDirection(DismissDirection.endToStart), + 'endToStart', + ); + expect( + ThemeEncoder.encodeDismissDirection(DismissDirection.horizontal), + 'horizontal', + ); + expect( + ThemeEncoder.encodeDismissDirection(DismissDirection.none), + 'none', + ); + expect( + ThemeEncoder.encodeDismissDirection(DismissDirection.startToEnd), + 'startToEnd', + ); + expect( + ThemeEncoder.encodeDismissDirection(DismissDirection.up), + 'up', + ); + expect( + ThemeEncoder.encodeDismissDirection(DismissDirection.vertical), + 'vertical', + ); + }); + test('DividerThemeData', () { expect(ThemeDecoder.decodeDividerThemeData(null), null); expect(ThemeEncoder.encodeDividerThemeData(null), null); @@ -3245,12 +3559,13 @@ void main() { expect(ThemeDecoder.decodeExpansionTileThemeData(null), null); expect(ThemeEncoder.encodeExpansionTileThemeData(null), null); - const entry = ExpansionTileThemeData( + final entry = ExpansionTileThemeData( backgroundColor: Color(0xff111111), childrenPadding: EdgeInsets.all(8.0), collapsedBackgroundColor: Color(0xff222222), collapsedIconColor: Color(0xff333333), expandedAlignment: Alignment.bottomCenter, + expansionAnimationStyle: AnimationStyle.noAnimation, iconColor: Color(0xff444444), textColor: Color(0xff555555), tilePadding: EdgeInsets.all(8.0), @@ -3276,6 +3591,7 @@ void main() { 'collapsedBackgroundColor': '#ff222222', 'collapsedIconColor': '#ff333333', 'expandedAlignment': 'bottomCenter', + 'expansionAnimationStyle': 'noAnimation', 'iconColor': '#ff444444', 'textColor': '#ff555555', 'tilePadding': { @@ -4014,6 +4330,8 @@ void main() { ); const entry = Icon( data, + applyTextScaling: false, + blendMode: BlendMode.colorBurn, color: _kColor, fill: 0.1, grade: 0.2, @@ -4031,6 +4349,8 @@ void main() { expect( encoded, { + 'applyTextScaling': false, + 'blendMode': 'colorBurn', 'color': _kColorStr, 'fill': 0.1, 'grade': 0.2, @@ -4187,6 +4507,7 @@ void main() { const entry = IconData( 2, fontFamily: 'foo', + fontFamilyFallback: ['baz', 'baaaz'], fontPackage: 'bar', matchTextDirection: true, ); @@ -4201,6 +4522,7 @@ void main() { { 'codePoint': 2, 'fontFamily': 'foo', + 'fontFamilyFallback': ['baz', 'baaaz'], 'fontPackage': 'bar', 'matchTextDirection': true, }, @@ -4217,6 +4539,7 @@ void main() { expect(ThemeEncoder.encodeIconThemeData(null), null); const entry = IconThemeData( + applyTextScaling: false, color: _kColor, fill: 0.5, grade: 3.0, @@ -4234,6 +4557,7 @@ void main() { expect( encoded, { + 'applyTextScaling': false, 'color': _kColorStr, 'fill': 0.5, 'grade': 3.0, @@ -4472,9 +4796,17 @@ void main() { style: BorderStyle.solid, width: 2.0, ), + prefixIconConstraints: BoxConstraints( + minHeight: 1.0, + minWidth: 2.0, + ), prefixIconColor: const Color(0xff334433), prefixStyle: const TextStyle(color: Color(0xff999999)), suffixIconColor: const Color(0xff445544), + suffixIconConstraints: BoxConstraints( + minHeight: 10.0, + minWidth: 20.0, + ), suffixStyle: const TextStyle(color: Color(0xff000000)), ); @@ -4744,11 +5076,19 @@ void main() { 'width': 2.0, }, 'prefixIconColor': '#ff334433', + 'prefixIconConstraints': { + 'minHeight': 1.0, + 'minWidth': 2.0, + }, 'prefixStyle': { 'color': '#ff999999', 'inherit': true, }, 'suffixIconColor': '#ff445544', + 'suffixIconConstraints': { + 'minHeight': 10.0, + 'minWidth': 20.0, + }, 'suffixStyle': { 'color': '#ff000000', 'inherit': true, @@ -4800,6 +5140,41 @@ void main() { ); }); + test('ListTileControlAffinity', () { + expect(ThemeDecoder.decodeListTileControlAffinity(null), null); + expect(ThemeEncoder.encodeListTileControlAffinity(null), null); + + expect( + ThemeDecoder.decodeListTileStyle( + ListTileStyle.drawer, + ), + ListTileStyle.drawer, + ); + + expect(ThemeDecoder.decodeListTileControlAffinity('leading'), + ListTileControlAffinity.leading); + expect(ThemeDecoder.decodeListTileControlAffinity('platform'), + ListTileControlAffinity.platform); + expect(ThemeDecoder.decodeListTileControlAffinity('trailing'), + ListTileControlAffinity.trailing); + + expect( + ThemeEncoder.encodeListTileControlAffinity( + ListTileControlAffinity.leading), + 'leading', + ); + expect( + ThemeEncoder.encodeListTileControlAffinity( + ListTileControlAffinity.platform), + 'platform', + ); + expect( + ThemeEncoder.encodeListTileControlAffinity( + ListTileControlAffinity.trailing), + 'trailing', + ); + }); + test('ListTileStyle', () { expect(ThemeDecoder.decodeListTileStyle(null), null); expect(ThemeEncoder.encodeListTileStyle(null), null); @@ -4885,11 +5260,13 @@ void main() { 3, 4, ), + controlAffinity: ListTileControlAffinity.trailing, dense: true, enableFeedback: false, horizontalTitleGap: 5, iconColor: Color(0xff111111), minLeadingWidth: 6, + minTileHeight: 10.0, minVerticalPadding: 7, selectedColor: Color(0xff222222), selectedTileColor: Color(0xff333333), @@ -4911,11 +5288,13 @@ void main() { 'right': 3, 'bottom': 4, }, + 'controlAffinity': 'trailing', 'dense': true, 'enableFeedback': false, 'horizontalTitleGap': 5, 'iconColor': '#ff111111', 'minLeadingWidth': 6, + 'minTileHeight': 10.0, 'minVerticalPadding': 7, 'selectedColor': '#ff222222', 'selectedTileColor': '#ff333333', @@ -6168,12 +6547,15 @@ void main() { expect(ThemeDecoder.decodeNavigationBarThemeData(null), null); expect(ThemeEncoder.encodeNavigationBarThemeData(null), null); - const entry = NavigationBarThemeData( + final entry = NavigationBarThemeData( backgroundColor: Color(0xff111111), elevation: 4.0, height: 12.0, indicatorColor: Color(0xff222222), labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected, + overlayColor: WidgetStateProperty.all( + Color(0xff222222), + ), shadowColor: Color(0xff333333), surfaceTintColor: Color(0xff444444), ); @@ -6187,6 +6569,7 @@ void main() { 'height': 12.0, 'indicatorColor': '#ff222222', 'labelBehavior': 'onlyShowSelected', + 'overlayColor': _materializeState('#ff222222'), 'shadowColor': '#ff333333', 'surfaceTintColor': '#ff444444', }); @@ -6826,6 +7209,7 @@ void main() { enableFeedback: true, iconColor: _kColor, iconSize: 16.0, + menuPadding: EdgeInsets.only(top: 20.0), position: PopupMenuPosition.over, shadowColor: Color(0xff111111), shape: RoundedRectangleBorder(), @@ -6846,6 +7230,12 @@ void main() { 'enableFeedback': true, 'iconColor': _kColorStr, 'iconSize': 16.0, + 'menuPadding': { + 'bottom': 0.0, + 'left': 0.0, + 'right': 0.0, + 'top': 20.0, + }, 'position': 'over', 'shadowColor': '#ff111111', 'shape': { @@ -8311,6 +8701,7 @@ void main() { trackShape: const RectangularSliderTrackShape(), valueIndicatorColor: const Color(0xffcccccc), valueIndicatorShape: SliderComponentShape.noOverlay, + valueIndicatorStrokeColor: const Color(0xffcccccc), valueIndicatorTextStyle: _kTextStyle, ); @@ -8354,6 +8745,7 @@ void main() { }, 'valueIndicatorColor': '#ffcccccc', 'valueIndicatorShape': 'noOverlay', + 'valueIndicatorStrokeColor': '#ffcccccc', 'valueIndicatorTextStyle': { 'color': '#00123456', 'inherit': true, @@ -8470,6 +8862,7 @@ void main() { behavior: SnackBarBehavior.floating, contentTextStyle: TextStyle(color: Color(0xff333333)), disabledActionTextColor: Color(0xff444444), + dismissDirection: DismissDirection.endToStart, elevation: 1.0, shape: RoundedRectangleBorder(), width: 12.0, @@ -8486,6 +8879,7 @@ void main() { 'behavior': 'floating', 'contentTextStyle': {'color': '#ff333333', 'inherit': true}, 'disabledActionTextColor': '#ff444444', + 'dismissDirection': 'endToStart', 'elevation': 1.0, 'shape': { 'borderRadius': { @@ -8642,6 +9036,7 @@ void main() { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, mouseCursor: WidgetStateProperty.all(MouseCursor.defer), overlayColor: WidgetStateProperty.all(_kColor), + padding: EdgeInsets.all(8.0), splashRadius: 20.0, thumbColor: WidgetStateProperty.all(_kColor), trackColor: WidgetStateProperty.all(_kColor), @@ -8672,6 +9067,12 @@ void main() { 'scrolledUnder': '#00123456', 'selected': '#00123456', }, + 'padding': { + 'bottom': 8.0, + 'left': 8.0, + 'right': 8.0, + 'top': 8.0, + }, 'splashRadius': 20.0, 'thumbColor': { 'disabled': '#00123456', @@ -8897,7 +9298,7 @@ void main() { test('TabBarTheme', () { expect(ThemeDecoder.decodeTabBarTheme(null), null); - expect(ThemeEncoder.encodeTabBarThemeData(null), null); + expect(ThemeEncoder.encodeTabBarTheme(null), null); try { ThemeDecoder.decodeTabBarTheme({'indicator': 'foo'}); @@ -8911,16 +9312,66 @@ void main() { labelColor: Color(0xff111111), labelPadding: EdgeInsets.all(1.0), labelStyle: _kTextStyle, + textScaler: TextScaler.noScaling, unselectedLabelColor: Color(0xff222222), unselectedLabelStyle: TextStyle(color: Color(0xff333333)), ); expect(ThemeDecoder.decodeTabBarTheme(entry), entry); + final encoded = ThemeEncoder.encodeTabBarTheme(entry); + + expect( + encoded, + { + 'data': { + 'indicatorSize': 'label', + 'labelColor': '#ff111111', + 'labelPadding': { + 'bottom': 1.0, + 'left': 1.0, + 'right': 1.0, + 'top': 1.0, + }, + 'labelStyle': _kTextStyleJson, + 'textScaler': 'noScaling', + 'unselectedLabelColor': '#ff222222', + 'unselectedLabelStyle': { + 'color': '#ff333333', + 'inherit': true, + }, + }, + }, + ); + }); + + test('TabBarThemeData', () { + expect(ThemeDecoder.decodeTabBarThemeData(null), null); + expect(ThemeEncoder.encodeTabBarThemeData(null), null); + + try { + ThemeDecoder.decodeTabBarTheme({'indicator': 'foo'}); + fail('exception expected'); + } catch (e) { + // pass + } + + const entry = TabBarThemeData( + indicatorSize: TabBarIndicatorSize.label, + labelColor: Color(0xff111111), + labelPadding: EdgeInsets.all(1.0), + labelStyle: _kTextStyle, + textScaler: TextScaler.noScaling, + unselectedLabelColor: Color(0xff222222), + unselectedLabelStyle: TextStyle(color: Color(0xff333333)), + ); + + expect(ThemeDecoder.decodeTabBarThemeData(entry), entry); + final encoded = ThemeEncoder.encodeTabBarThemeData( - entry.data, + entry, ); - final decoded = ThemeDecoder.decodeTabBarTheme(encoded); + final decoded = ThemeDecoder.decodeTabBarThemeData(encoded); expect( encoded, @@ -8934,6 +9385,7 @@ void main() { 'top': 1.0, }, 'labelStyle': _kTextStyleJson, + 'textScaler': 'noScaling', 'unselectedLabelColor': '#ff222222', 'unselectedLabelStyle': { 'color': '#ff333333', @@ -8948,6 +9400,36 @@ void main() { ); }); + test('TabIndicatorAnimation', () { + expect(ThemeDecoder.decodeTabIndicatorAnimation(null), null); + expect(ThemeEncoder.encodeTabIndicatorAnimation(null), null); + + expect( + ThemeDecoder.decodeTabIndicatorAnimation( + TabIndicatorAnimation.elastic, + ), + TabIndicatorAnimation.elastic, + ); + + expect( + ThemeDecoder.decodeTabIndicatorAnimation('elastic'), + TabIndicatorAnimation.elastic, + ); + expect( + ThemeDecoder.decodeTabIndicatorAnimation('linear'), + TabIndicatorAnimation.linear, + ); + + expect( + ThemeEncoder.encodeTabIndicatorAnimation(TabIndicatorAnimation.elastic), + 'elastic', + ); + expect( + ThemeEncoder.encodeTabIndicatorAnimation(TabIndicatorAnimation.linear), + 'linear', + ); + }); + test('TableBorder', () { expect(ThemeDecoder.decodeTableBorder(null), null); expect(ThemeEncoder.encodeTableBorder(null), null); @@ -9899,6 +10381,28 @@ void main() { expect(ThemeEncoder.encodeTextOverflow(TextOverflow.visible), 'visible'); }); + test('TextScaler', () { + expect(ThemeDecoder.decodeTextScaler(null), null); + expect(ThemeEncoder.encodeTextScaler(null), null); + + expect( + ThemeDecoder.decodeTextScaler( + TextScaler.noScaling, + ), + TextScaler.noScaling, + ); + + expect( + ThemeDecoder.decodeTextScaler('noScaling'), + TextScaler.noScaling, + ); + + expect( + ThemeEncoder.encodeTextScaler(TextScaler.noScaling), + 'noScaling', + ); + }); + test('TextSelectionThemeData', () { expect(ThemeDecoder.decodeTextSelectionThemeData(null), null); expect(ThemeEncoder.encodeTextSelectionThemeData(null), null); @@ -10422,10 +10926,12 @@ void main() { color: Color(0xee555555), ), ), - timePickerTheme: - const TimePickerThemeData(backgroundColor: Color(0x11111111)), - toggleButtonsTheme: - const ToggleButtonsThemeData(color: Color(0xbb222222)), + timePickerTheme: const TimePickerThemeData( + backgroundColor: Color(0x11111111), + ), + toggleButtonsTheme: const ToggleButtonsThemeData( + color: Color(0xbb222222), + ), tooltipTheme: const TooltipThemeData(height: 19.0), typography: Typography.material2018(), unselectedWidgetColor: const Color(0xbb444444),