Skip to content

Commit

Permalink
fix: rework color palette
Browse files Browse the repository at this point in the history
  • Loading branch information
inpt333 authored and borgoat committed Dec 10, 2024
1 parent 33a9ec5 commit c2fd21b
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 80 deletions.
93 changes: 48 additions & 45 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/foundation.dart'; // ignore: unused_import
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -28,51 +27,57 @@ class ParApp extends StatelessWidget {
distinct: true,
converter: _ViewModel.fromStore,
onInit: store.dispatch(AppStartedAction()),
builder: (context, vm) => DynamicColorBuilder(
builder: (lightDynamic, darkDynamic) {
final override = vm.overrideColour;
const defaultColour = Color(0xFF34558B);
builder: (context, vm) {
ColorScheme lightColorScheme = ColorScheme.fromSeed(
seedColor: Color(0xFF34558B),
secondary: Color(0xFF00A4B8),
tertiary: Color(0xFF8BE585),
);

ColorScheme lightColorScheme;
ColorScheme darkColorScheme;
ColorScheme darkColorScheme = ColorScheme.fromSeed(
brightness: Brightness.dark,
seedColor: Color(0xFF93920B),
secondary: Color(0xFF00623F),
tertiary: Color(0xFF257F1F),
);

if (lightDynamic != null && darkDynamic != null) {
lightColorScheme =
lightDynamic.harmonized().copyWith(secondary: override);
darkColorScheme =
darkDynamic.harmonized().copyWith(secondary: override);
} else {
// Otherwise, use fallback schemes.
lightColorScheme =
ColorScheme.fromSeed(seedColor: override ?? defaultColour);
darkColorScheme = ColorScheme.fromSeed(
seedColor: override ?? defaultColour,
brightness: Brightness.dark);
}
// Light theme colors for reference
Color(0xFF34558B);
Color(0xFF007DAF);
Color(0xFF00A4B8);
Color(0xFF00C8A5);
Color(0xFF8BE585);
Color(0xFFF9F871);

return MaterialApp.router(
title: 'Grup',
localizationsDelegates: const [
...AppLocalizations.localizationsDelegates,
FormBuilderLocalizations.delegate,
SupabaseAuthUILocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales,
themeMode: vm.themeMode,
locale: vm.locale,
darkTheme: ThemeData(
colorScheme: darkColorScheme,
fontFamily: GoogleFonts.cabin().fontFamily,
),
theme: ThemeData(
// TODO(borgoat): dynamic color scheme using dynamic_color package
colorScheme: lightColorScheme,
fontFamily: GoogleFonts.cabin().fontFamily,
),
routerConfig: router,
);
},
),
// Dark theme colors for reference
Color(0xFF000025);
Color(0xFF001749);
Color(0xFF003E52);
Color(0xFF00623F);
Color(0xFF257F1F);
Color(0xFF93920B);

return MaterialApp.router(
title: 'Grup',
localizationsDelegates: const [
...AppLocalizations.localizationsDelegates,
FormBuilderLocalizations.delegate,
SupabaseAuthUILocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales,
themeMode: vm.themeMode,
locale: vm.locale,
darkTheme: ThemeData(
colorScheme: darkColorScheme,
fontFamily: GoogleFonts.cabin().fontFamily,
),
theme: ThemeData(
colorScheme: lightColorScheme,
fontFamily: GoogleFonts.cabin().fontFamily,
),
routerConfig: router,
);
},
),
);
}
Expand All @@ -83,14 +88,12 @@ sealed class _ViewModel with _$ViewModel {
const factory _ViewModel({
required ThemeMode themeMode,
Locale? locale,
Color? overrideColour,
}) = __ViewModel;

factory _ViewModel.fromStore(Store<AppState> store) {
return _ViewModel(
themeMode: themeModeSelector(store.state),
locale: localeSelector(store.state),
overrideColour: null, // TODO Where could this come from?
);
}
}
1 change: 1 addition & 0 deletions lib/presentation/screens/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AuthScreen extends StatelessWidget {
style: GoogleFonts.sniglet(
color: theme.colorScheme.primary,
textStyle: theme.textTheme.headlineLarge,
fontWeight: FontWeight.bold,
),
),
// TODO(borgoat): this shouldn't be needed: fix the navigation stack instead
Expand Down
4 changes: 0 additions & 4 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@

#include "generated_plugin_registrant.h"

#include <dynamic_color/dynamic_color_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <gtk/gtk_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
Expand Down
1 change: 0 additions & 1 deletion linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
dynamic_color
file_selector_linux
gtk
url_launcher_linux
Expand Down
2 changes: 0 additions & 2 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import FlutterMacOS
import Foundation

import app_links
import dynamic_color
import file_selector_macos
import google_sign_in_ios
import path_provider_foundation
Expand All @@ -17,7 +16,6 @@ import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
Expand Down
24 changes: 9 additions & 15 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ PODS:
- AppAuth/Core (1.7.6)
- AppAuth/ExternalUserAgent (1.7.6):
- AppAuth/Core
- dynamic_color (0.0.2):
- FlutterMacOS
- file_selector_macos (0.0.1):
- FlutterMacOS
- FlutterMacOS (1.0.0)
Expand Down Expand Up @@ -45,7 +43,6 @@ PODS:

DEPENDENCIES:
- app_links (from `Flutter/ephemeral/.symlinks/plugins/app_links/macos`)
- dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`)
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- google_sign_in_ios (from `Flutter/ephemeral/.symlinks/plugins/google_sign_in_ios/darwin`)
Expand All @@ -65,8 +62,6 @@ SPEC REPOS:
EXTERNAL SOURCES:
app_links:
:path: Flutter/ephemeral/.symlinks/plugins/app_links/macos
dynamic_color:
:path: Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos
file_selector_macos:
:path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos
FlutterMacOS:
Expand All @@ -85,21 +80,20 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos

SPEC CHECKSUMS:
app_links: 9028728e32c83a0831d9db8cf91c526d16cc5468
app_links: 10e0a0ab602ffaf34d142cd4862f29d34b303b2a
AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73
dynamic_color: b820c000cc68df65e7ba7ff177cb98404ce56651
file_selector_macos: 6280b52b459ae6c590af5d78fc35c7267a3c4b31
file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
google_sign_in_ios: 0ab078e60da6dfe23cbc55c83502b52bba1aad63
google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38
GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
share_plus: 510bf0af1a42cd602274b4629920c9649c52f4cc
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sign_in_with_apple: 6673c03c9e3643f6c8d33601943fbfa9ae99f94e
url_launcher_macos: 0fba8ddabfc33ce0a9afe7c5fef5aab3d8d2d673
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
share_plus: 1fa619de8392a4398bfaf176d441853922614e89
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sign_in_with_apple: a9e97e744e8edc36aefc2723111f652102a7a727
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404

PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3

COCOAPODS: 1.16.2
COCOAPODS: 1.15.2
8 changes: 0 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.1.6"
dynamic_color:
dependency: "direct main"
description:
name: dynamic_color
sha256: eae98052fa6e2826bdac3dd2e921c6ce2903be15c6b7f8b6d8a5d49b5086298d
url: "https://pub.dev"
source: hosted
version: "1.7.0"
email_validator:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ dependencies:
app_links: ^6.3.2
base32: ^2.1.3
collection: ^1.18.0
dynamic_color: ^1.6.8
flutter_native_splash: ^2.4.2
font_awesome_flutter: ^10.6.0
google_fonts: ^6.2.1
Expand Down
3 changes: 0 additions & 3 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
#include "generated_plugin_registrant.h"

#include <app_links/app_links_plugin_c_api.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h>
#include <file_selector_windows/file_selector_windows.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
AppLinksPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
DynamicColorPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
SharePlusWindowsPluginCApiRegisterWithRegistrar(
Expand Down
1 change: 0 additions & 1 deletion windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

list(APPEND FLUTTER_PLUGIN_LIST
app_links
dynamic_color
file_selector_windows
share_plus
url_launcher_windows
Expand Down

0 comments on commit c2fd21b

Please sign in to comment.