Skip to content

Commit

Permalink
Fixed dynamic colour to be white when not available (on linux)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackv24 committed Jun 27, 2022
1 parent 9718feb commit f8e83d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 2 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void main() {
if (isDesktop) {
doWhenWindowReady(() {
appWindow.minSize = const Size(800, 600);
appWindow.size = const Size(900, 650);
appWindow.size = const Size(1100, 800);
appWindow.alignment = Alignment.center;
appWindow.title = appTitle;
appWindow.show();
Expand All @@ -49,11 +49,7 @@ class MyApp extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final themeMode = ref.watch(themeModeProvider);
final asyncColor = ref.watch(colorSchemeSeedProvider);
final seedColor = asyncColor.when(
data: (data) => data,
error: (err, stack) => Colors.white,
loading: () => null,
);
final seedColor = asyncColor.value ?? Colors.white;

return MaterialApp(
title: 'Palette Swap Tool',
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/color.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final colorSchemeSeedProvider = FutureProvider((ref) async {
return await DynamicColorPlugin.getAccentColor();
return await DynamicColorPlugin.getAccentColor() ?? Colors.white;
});

0 comments on commit f8e83d2

Please sign in to comment.