Skip to content

Commit

Permalink
Flutter 3.19
Browse files Browse the repository at this point in the history
  • Loading branch information
jpeiffer committed Feb 20, 2024
1 parent 90b006c commit 37eca8c
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 44 deletions.
6 changes: 4 additions & 2 deletions json_theme/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## [6.4.0+1] - February 20, 2024
## [6.4.1] - February 20th, 2024

* Automated dependency updates
* Dependency updates
* Added `OverflowBoxFit`
* Update for Flutter 3.19


## [6.4.0] - November 17th, 2023
Expand Down
73 changes: 42 additions & 31 deletions json_theme/lib/src/codec/theme_decoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:json_class/json_class.dart';
import 'package:json_theme_annotation/json_theme_annotation.dart';
Expand Down Expand Up @@ -9093,6 +9093,46 @@ class ThemeDecoder {
return result;
}

/// Decodes the [value] to a [OverflowBoxFit]. Supported values are:
/// * `deferToChild`
/// * `max`
static OverflowBoxFit? decodeOverflowBoxFit(
dynamic value, {
bool validate = true,
}) {
OverflowBoxFit? result;

if (value is OverflowBoxFit) {
result = value;
} else if (value != null) {
_checkSupported(
'OverflowBoxFit',
[
'deferToChild',
'max',
],
value,
);
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/overflow_box_fit',
value: value,
validate: validate,
));

switch (value) {
case 'deferToChild':
result = OverflowBoxFit.deferToChild;
break;

case 'max':
result = OverflowBoxFit.max;
break;
}
}

return result;
}

/// Decodes the [value] to a [PageTransitionsBuilder]. Supported values are:
/// * `cupertino`
/// * `fadeUpwards`
Expand Down Expand Up @@ -13422,11 +13462,7 @@ class ThemeDecoder {
validate: validate,
));
result = ThemeData(
// accentColor: @deprecated
// accentColorBrightness: @deprecated
// accentIconTheme: @deprecated
// accentTextTheme: @deprecated
// androidOverscrollIndicator: @deprecated
// adaptations: @unencodable,
actionIconTheme: decodeActionIconThemeData(
value['actionIconThemeData'],
validate: false,
Expand All @@ -13438,7 +13474,6 @@ class ThemeDecoder {
applyElevationOverlayColor: JsonClass.maybeParseBool(
value['applyElevationOverlayColor'],
),
// backgroundColor: @deprecated,
badgeTheme: decodeBadgeThemeData(
value['badgeTheme'],
validate: false,
Expand Down Expand Up @@ -13468,9 +13503,6 @@ class ThemeDecoder {
value['buttonBarTheme'],
validate: false,
),

// buttonColor: @deprecated

buttonTheme: decodeButtonThemeData(
value['buttonTheme'],
validate: false,
Expand Down Expand Up @@ -13507,9 +13539,6 @@ class ThemeDecoder {
value['cupertinoOverrideTheme'],
validate: false,
),

// cursorColor: @deprecated

datePickerTheme: decodeDatePickerThemeData(
value['datePickerThemeData'],
validate: false,
Expand Down Expand Up @@ -13554,21 +13583,15 @@ class ThemeDecoder {
value['expansionTileTheme'],
validate: false,
),

// errorColor: @deprecated,
// extensions: @unencodable,

filledButtonTheme: decodeFilledButtonThemeData(
value['filledButtonTheme'],
validate: false,
),

// fixTextFieldOutlineLabel: @deprecated
floatingActionButtonTheme: decodeFloatingActionButtonThemeData(
value['floatingActionButtonTheme'],
validate: false,
),

focusColor: decodeColor(
value['focusColor'],
validate: false,
Expand Down Expand Up @@ -13660,9 +13683,6 @@ class ThemeDecoder {
value['primaryColor'],
validate: false,
),

// primaryColorBrightness: @deprecated

primaryColorDark: decodeColor(
value['primaryColorDark'],
validate: false,
Expand Down Expand Up @@ -13715,8 +13735,6 @@ class ThemeDecoder {
value['segmentedButtonTheme'],
validate: false,
),
// selectedRowColor: @deprecated

shadowColor: decodeColor(
value['shadowColor'],
validate: false,
Expand Down Expand Up @@ -13749,10 +13767,6 @@ class ThemeDecoder {
value['textButtonTheme'],
validate: false,
),

// textSelectionColor: @deprecated,
// textSelectionHandleColor: @deprecated,

textSelectionTheme: decodeTextSelectionThemeData(
value['textSelectionTheme'],
validate: false,
Expand Down Expand Up @@ -13783,9 +13797,6 @@ class ThemeDecoder {
validate: false,
),
useMaterial3: JsonClass.maybeParseBool(value['useMaterial3']),

// useTextSelectionTheme: @deprecated,

visualDensity: decodeVisualDensity(
value['visualDensity'],
validate: false,
Expand Down
22 changes: 21 additions & 1 deletion json_theme/lib/src/codec/theme_encoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:json_theme_annotation/json_theme_annotation.dart';

Expand Down Expand Up @@ -4947,6 +4947,26 @@ class ThemeEncoder {
return _stripDynamicNull(result);
}

/// Encodes the [value] to a [String]. Supported values are:
/// * `deferToChild`
/// * `max`
static String? encodeOverflowBoxFit(OverflowBoxFit? value) {
String? result;

if (value != null) {
switch (value) {
case OverflowBoxFit.deferToChild:
result = 'deferToChild';
break;

case OverflowBoxFit.max:
result = 'max';
break;
}
}
return _stripDynamicNull(result);
}

/// Encodes the [value] to a [String]. Supported values are:
/// * `cupertino`
/// * `fadeUpwards`
Expand Down
1 change: 1 addition & 0 deletions json_theme/lib/src/schema/all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export 'schemas/enums/max_length_enforcement_schema.dart';
export 'schemas/enums/navigation_destination_label_behavior_schema.dart';
export 'schemas/enums/navigation_rail_label_type_schema.dart';
export 'schemas/enums/notched_shape_schema.dart';
export 'schemas/enums/overflow_box_fit_schema.dart';
export 'schemas/enums/page_transitions_builder_schema.dart';
export 'schemas/enums/pan_axis_schema.dart';
export 'schemas/enums/pointer_device_kind_schema.dart';
Expand Down
1 change: 1 addition & 0 deletions json_theme/lib/src/schema/schemas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class Schemas {
OrdinalSortKeySchema.id: OrdinalSortKeySchema.schema,
OutlinedBorderSchema.id: OutlinedBorderSchema.schema,
OutlinedButtonThemeDataSchema.id: OutlinedButtonThemeDataSchema.schema,
OverflowBoxFitSchema.id: OverflowBoxFitSchema.schema,
PanAxisSchema.id: PanAxisSchema.schema,
PageTransitionsBuilderSchema.id: PageTransitionsBuilderSchema.schema,
PageTransitionsThemeSchema.id: PageTransitionsThemeSchema.schema,
Expand Down
1 change: 1 addition & 0 deletions json_theme/lib/src/schema/schemas/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Enums {
NavigationRailLabelTypeSchema.id,
NavigationDestinationLabelBehaviorSchema.id,
NotchedShapeSchema.id,
OverflowBoxFitSchema.id,
PageTransitionsBuilderSchema.id,
PanAxisSchema.id,
PointerDeviceKindSchema.id,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:json_theme/json_theme_schemas.dart';

class OverflowBoxFitSchema {
static const id =
'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/overflow_box_fit.json';

static final schema = {
r'$schema': 'http://json-schema.org/draft-07/schema#',
r'$id': id,
r'$comment':
'https://api.flutter.dev/flutter/rendering/OverflowBoxFit.html',
'title': 'OverflowBoxFit',
'type': 'string',
'oneOf': SchemaHelper.enumSchema([
'deferToChild',
'max',
]),
};
}
18 changes: 9 additions & 9 deletions json_theme/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
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: '6.4.0+1'
version: '6.4.1'

environment:
environment:
sdk: '>=3.2.0 <4.0.0'

analyzer:
exclude:
analyzer:
exclude:
- 'lib/generated/**'
- 'lib/**/*.g.dart'

dependencies:
flutter:
dependencies:
flutter:
sdk: 'flutter'
json_class: '^3.0.0+12'
json_schema: '^5.1.3'
json_theme_annotation: '^1.0.3+3'
logging: '^1.2.0'
meta: '^1.10.0'

dev_dependencies:
dev_dependencies:
analyzer: '^6.4.1'
build: '^2.4.1'
build_runner: '^2.4.8'
code_builder: '^4.10.0'
flutter_lints: '^3.0.1'
flutter_test:
flutter_test:
sdk: 'flutter'
json_theme_codegen: '^1.1.2+9'
recase: '^4.1.0'
source_gen: '^1.5.0'

ignore_updates:
ignore_updates:
- 'archive'
- 'async'
- 'boolean_selector'
Expand Down
30 changes: 29 additions & 1 deletion json_theme/test/json_theme_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:json_class/json_class.dart';
Expand Down Expand Up @@ -7387,6 +7387,34 @@ void main() {
);
});

test('OverflowBoxFit', () {
expect(ThemeDecoder.decodeOverflowBoxFit(null), null);
expect(ThemeEncoder.encodeOverflowBoxFit(null), null);

expect(
ThemeDecoder.decodeOverflowBoxFit(OverflowBoxFit.deferToChild),
OverflowBoxFit.deferToChild,
);

expect(
ThemeDecoder.decodeOverflowBoxFit('deferToChild'),
OverflowBoxFit.deferToChild,
);
expect(
ThemeDecoder.decodeOverflowBoxFit('max'),
OverflowBoxFit.max,
);

expect(
ThemeEncoder.encodeOverflowBoxFit(OverflowBoxFit.deferToChild),
'deferToChild',
);
expect(
ThemeEncoder.encodeOverflowBoxFit(OverflowBoxFit.max),
'max',
);
});

test('PageTransitionsBuilder', () {
expect(ThemeDecoder.decodePageTransitionsBuilder(null), null);
expect(ThemeEncoder.encodePageTransitionsBuilder(null), null);
Expand Down

0 comments on commit 37eca8c

Please sign in to comment.