Skip to content

Commit

Permalink
Use withValues in place of withOpacity
Browse files Browse the repository at this point in the history
  • Loading branch information
kra-mo committed Dec 20, 2024
1 parent 5c607b9 commit 35e434c
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
4 changes: 2 additions & 2 deletions lib/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ final lightThemeData = ThemeData(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
disabledColor: const Color(0xFFDADBDF),
focusColor: const Color(0xFF212A40).withOpacity(0.12),
hoverColor: const Color(0xFF212A40).withOpacity(0.06),
focusColor: const Color(0xFF212A40).withValues(alpha: 0.12),
hoverColor: const Color(0xFF212A40).withValues(alpha: 0.06),
colorScheme: ColorScheme(
brightness: Brightness.light,
primary: const Color(0xFF2E3133),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class _SlySliderState extends State<SlySlider> {
return SliderTheme(
data: SliderThemeData(
secondaryActiveTrackColor:
Theme.of(context).colorScheme.primary.withOpacity(0.35),
Theme.of(context).colorScheme.primary.withValues(alpha: 0.35),
inactiveTrackColor: Theme.of(context).disabledColor,
trackHeight: 18,
thumbShape: InsetSliderThumbShape(),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/slider_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class _SlySliderRowState extends State<SlySliderRow> {
.textTheme
.bodyMedium
?.color
?.withOpacity(0.7),
?.withValues(alpha: 0.7),
fontFeatures: const <FontFeature>[
FontFeature.tabularFigures(),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/switch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class _SlySwitchState extends State<SlySwitch> {
inactiveTrackColor: Theme.of(context).disabledColor,
overlayColor: WidgetStateProperty.resolveWith((states) {
return states.contains(WidgetState.focused)
? Theme.of(context).colorScheme.onPrimary.withOpacity(0.2)
? Theme.of(context).colorScheme.onPrimary.withValues(alpha: 0.2)
: Colors.transparent;
}),
value: value,
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/unique/editor_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ class SlyEditorScaffold extends StatelessWidget {
focusColor: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.1),
.withValues(alpha: 0.1),
hoverColor: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.1),
.withValues(alpha: 0.1),
splashColor: Colors.transparent,
elevation: 0,
hoverElevation: 0,
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/unique/histogram.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ LineChart _buildHistogram(Uint8List imagdeData) {
show: true,
gradient: LinearGradient(
colors: [colors[i][0], colors[i][1]]
.map((color) => color.withOpacity(1 / 3))
.map((color) => color.withValues(alpha: 1 / 3))
.toList(),
),
),
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/unique/image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class SlyImageView extends StatelessWidget {
key: const Key('cropImageView'),
gridThickWidth: wideLayout ? 6 : 8,
gridCornerColor: Theme.of(context).colorScheme.primary,
gridColor: Theme.of(context).colorScheme.primary.withOpacity(0.6),
gridColor:
Theme.of(context).colorScheme.primary.withValues(alpha: 0.6),
controller: cropController,
image: Image.memory(
originalImageData!,
Expand Down
4 changes: 4 additions & 0 deletions macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}

override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
}

0 comments on commit 35e434c

Please sign in to comment.