From 35e434c4e2d26103a95ccd38bd048e2e390e3071 Mon Sep 17 00:00:00 2001 From: kramo Date: Fri, 20 Dec 2024 02:54:26 +0100 Subject: [PATCH] Use withValues in place of withOpacity --- .gitignore | 2 ++ lib/theme.dart | 4 ++-- lib/widgets/slider.dart | 2 +- lib/widgets/slider_row.dart | 2 +- lib/widgets/switch.dart | 2 +- lib/widgets/unique/editor_scaffold.dart | 4 ++-- lib/widgets/unique/histogram.dart | 2 +- lib/widgets/unique/image.dart | 3 ++- macos/Runner/AppDelegate.swift | 4 ++++ 9 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 29a3a50..79c113f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,11 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ migrate_working_dir/ # IntelliJ related diff --git a/lib/theme.dart b/lib/theme.dart index b443997..179d532 100644 --- a/lib/theme.dart +++ b/lib/theme.dart @@ -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), diff --git a/lib/widgets/slider.dart b/lib/widgets/slider.dart index 06afdf8..05ac549 100644 --- a/lib/widgets/slider.dart +++ b/lib/widgets/slider.dart @@ -60,7 +60,7 @@ class _SlySliderState extends State { 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(), diff --git a/lib/widgets/slider_row.dart b/lib/widgets/slider_row.dart index eb2cfc8..f893fb0 100644 --- a/lib/widgets/slider_row.dart +++ b/lib/widgets/slider_row.dart @@ -116,7 +116,7 @@ class _SlySliderRowState extends State { .textTheme .bodyMedium ?.color - ?.withOpacity(0.7), + ?.withValues(alpha: 0.7), fontFeatures: const [ FontFeature.tabularFigures(), ], diff --git a/lib/widgets/switch.dart b/lib/widgets/switch.dart index 22cb569..bac5f54 100644 --- a/lib/widgets/switch.dart +++ b/lib/widgets/switch.dart @@ -33,7 +33,7 @@ class _SlySwitchState extends State { 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, diff --git a/lib/widgets/unique/editor_scaffold.dart b/lib/widgets/unique/editor_scaffold.dart index aec811c..e202842 100644 --- a/lib/widgets/unique/editor_scaffold.dart +++ b/lib/widgets/unique/editor_scaffold.dart @@ -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, diff --git a/lib/widgets/unique/histogram.dart b/lib/widgets/unique/histogram.dart index 3c14d01..9b1a365 100644 --- a/lib/widgets/unique/histogram.dart +++ b/lib/widgets/unique/histogram.dart @@ -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(), ), ), diff --git a/lib/widgets/unique/image.dart b/lib/widgets/unique/image.dart index 4a52992..6a10737 100644 --- a/lib/widgets/unique/image.dart +++ b/lib/widgets/unique/image.dart @@ -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!, diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift index 8e02df2..b3c1761 100644 --- a/macos/Runner/AppDelegate.swift +++ b/macos/Runner/AppDelegate.swift @@ -6,4 +6,8 @@ class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } }