Skip to content

Commit

Permalink
refactor!: [DX-3717] Upgrade to Flutter 3.27.1
Browse files Browse the repository at this point in the history
  • Loading branch information
witwash committed Jan 10, 2025
1 parent 61dba6e commit 209f31a
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 142 deletions.
2 changes: 1 addition & 1 deletion .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.24.2
flutter-version: 3.27.1

- name: Get ID Token
uses: actions/github-script@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
- name: Set up Flutter
uses: subosito/flutter-action@ea686d7c56499339ad176e9f19c516ff6cf05a31
with:
flutter-version: 3.24.2
flutter-version: 3.27.1
cache: true

- name: Set up environment paths
Expand Down
2 changes: 1 addition & 1 deletion optimus/lib/src/common/field_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class _ColoredTransitionState extends State<_ColoredTransition> {
color: widget.state == OptimusStatusBarState.empty
? _previousState
.getStatusBarColor(context.tokens)
.withOpacity(0.5)
.withValues(alpha: 0.5)
: widget.state.getStatusBarColor(context.tokens),
),
);
Expand Down
30 changes: 0 additions & 30 deletions optimus/lib/src/common/state_property.dart

This file was deleted.

13 changes: 6 additions & 7 deletions optimus/lib/src/lists/nav_list_tile.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:optimus/optimus.dart';
import 'package:optimus/src/common/gesture_wrapper.dart';
import 'package:optimus/src/common/state_property.dart';
import 'package:optimus/src/lists/base_list_tile.dart';

/// Lists are vertically organized groups of data. Optimized for reading
Expand Down Expand Up @@ -83,12 +82,12 @@ class _OptimusNavListTileState extends State<OptimusNavListTile>
}
}

InteractiveStateColor get _backgroundColor => InteractiveStateColor(
defaultColor: tokens.backgroundInteractiveNeutralSubtleDefault,
disabled: Colors.transparent,
pressed: tokens.backgroundInteractiveNeutralSubtleActive,
hovered: tokens.backgroundInteractiveNeutralSubtleHover,
);
WidgetStateColor get _backgroundColor => WidgetStateColor.fromMap({
WidgetState.disabled: Colors.transparent,
WidgetState.pressed: tokens.backgroundInteractiveNeutralSubtleActive,
WidgetState.hovered: tokens.backgroundInteractiveNeutralSubtleHover,
WidgetState.any: tokens.backgroundInteractiveNeutralSubtleDefault,
});

void _handleHoverChanged(bool isHovered) {
setState(() => _controller.update(WidgetState.hovered, isHovered));
Expand Down
33 changes: 16 additions & 17 deletions optimus/lib/src/radio/radio_circle.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:optimus/optimus.dart';
import 'package:optimus/src/common/state_property.dart';

class RadioCircle extends StatelessWidget {
const RadioCircle({
Expand All @@ -13,28 +12,28 @@ class RadioCircle extends StatelessWidget {
final bool isSelected;
final WidgetStatesController controller;

InteractiveStateColor _getBorderColor(OptimusTokens tokens) =>
InteractiveStateColor(
defaultColor: isSelected
? tokens.backgroundInteractivePrimaryDefault
: tokens.borderInteractiveSecondaryDefault,
disabled:
WidgetStateColor _getBorderColor(OptimusTokens tokens) =>
WidgetStateColor.fromMap({
WidgetState.disabled:
isSelected ? tokens.backgroundDisabled : tokens.borderDisabled,
pressed: isSelected
WidgetState.pressed: isSelected
? tokens.backgroundInteractivePrimaryActive
: tokens.borderInteractiveSecondaryActive,
hovered: isSelected
WidgetState.hovered: isSelected
? tokens.backgroundInteractivePrimaryHover
: tokens.borderInteractiveSecondaryHover,
);
WidgetState.any: isSelected
? tokens.backgroundInteractivePrimaryDefault
: tokens.borderInteractiveSecondaryDefault,
});

InteractiveStateColor _getFillColor(OptimusTokens tokens) =>
InteractiveStateColor(
defaultColor: tokens.backgroundInteractiveNeutralSubtleDefault,
disabled: tokens.backgroundInteractiveNeutralSubtleDefault,
pressed: tokens.backgroundInteractiveNeutralSubtleActive,
hovered: tokens.backgroundInteractiveNeutralSubtleHover,
);
WidgetStateColor _getFillColor(OptimusTokens tokens) =>
WidgetStateColor.fromMap({
WidgetState.disabled: tokens.backgroundInteractiveNeutralSubtleDefault,
WidgetState.pressed: tokens.backgroundInteractiveNeutralSubtleActive,
WidgetState.hovered: tokens.backgroundInteractiveNeutralSubtleHover,
WidgetState.any: tokens.backgroundInteractiveNeutralSubtleDefault,
});

@override
Widget build(BuildContext context) {
Expand Down
53 changes: 24 additions & 29 deletions optimus/lib/src/selection_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter/widgets.dart';
import 'package:optimus/optimus.dart';
import 'package:optimus/src/checkbox/checkbox_tick.dart';
import 'package:optimus/src/common/gesture_wrapper.dart';
import 'package:optimus/src/common/state_property.dart';
import 'package:optimus/src/radio/radio_circle.dart';

enum OptimusSelectionCardVariant { vertical, horizontal }
Expand Down Expand Up @@ -75,45 +74,41 @@ class _OptimusSelectionCardState extends State<OptimusSelectionCard>
super.dispose();
}

InteractiveStateColor get _backgroundColor => InteractiveStateColor(
defaultColor: widget.isSelected
? tokens.backgroundInteractiveSecondaryDefault
: tokens.backgroundStaticFlat,
disabled: tokens.backgroundStaticFlat,
pressed: widget.isSelected
WidgetStateColor get _backgroundColor => WidgetStateColor.fromMap({
WidgetState.disabled: tokens.backgroundStaticFlat,
WidgetState.pressed: widget.isSelected
? tokens.backgroundInteractiveSecondaryActive
: tokens.backgroundStaticFlat,
hovered: widget.isSelected
WidgetState.hovered: widget.isSelected
? tokens.backgroundInteractiveSecondaryHover
: tokens.backgroundStaticFlat,
);
WidgetState.any: widget.isSelected
? tokens.backgroundInteractiveSecondaryDefault
: tokens.backgroundStaticFlat,
});

InteractiveStateColor get _borderColor => InteractiveStateColor(
defaultColor: widget.isSelected
? tokens.borderInteractivePrimaryDefault
: tokens.borderInteractiveSecondaryDefault,
disabled: tokens.borderDisabled,
pressed: widget.isSelected
WidgetStateColor get _borderColor => WidgetStateColor.fromMap({
WidgetState.disabled: tokens.borderDisabled,
WidgetState.pressed: widget.isSelected
? tokens.borderInteractivePrimaryActive
: tokens.borderInteractiveSecondaryActive,
hovered: widget.isSelected
WidgetState.hovered: widget.isSelected
? tokens.borderInteractivePrimaryHover
: tokens.borderInteractiveSecondaryHover,
);
WidgetState.any: widget.isSelected
? tokens.borderInteractivePrimaryDefault
: tokens.borderInteractiveSecondaryDefault,
});

InteractiveStateColor get _titleColor => InteractiveStateColor(
defaultColor: tokens.textStaticPrimary,
disabled: tokens.textDisabled,
pressed: tokens.textStaticPrimary,
hovered: tokens.textStaticPrimary,
);
WidgetStateColor get _titleColor => WidgetStateColor.fromMap({
WidgetState.disabled: tokens.textDisabled,
WidgetState.any: tokens.textStaticPrimary,
});

InteractiveStateColor get _descriptionColor => InteractiveStateColor(
defaultColor: tokens.textStaticTertiary,
disabled: tokens.textDisabled,
pressed: tokens.textStaticTertiary,
hovered: tokens.textStaticTertiary,
);
WidgetStateColor get _descriptionColor => WidgetStateColor.fromMap({
WidgetState.disabled: tokens.textDisabled,
WidgetState.any: tokens.textStaticTertiary,
});

@override
void didUpdateWidget(covariant OptimusSelectionCard oldWidget) {
Expand Down
2 changes: 1 addition & 1 deletion optimus/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository: https://github.com/MewsSystems/mews-flutter

environment:
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.24.0"
flutter: ">=3.27.0"

dependencies:
dfunc: ^0.10.0
Expand Down
Loading

0 comments on commit 209f31a

Please sign in to comment.