An open-source cross-platform alternative to AirDrop
feat: add Yaru theme (#912)
Tien Do Nam71ff31899ba9
diff --git a/app/assets/CHANGELOG.md b/app/assets/CHANGELOG.mdindex 68c69c9b..8f65c0c5 100644--- a/app/assets/CHANGELOG.md+++ b/app/assets/CHANGELOG.md@@ -2,6 +2,7 @@- feat: ignore duplicate files when selected from file picker (@programmermager)- feat: add donation options (@Tienisto)+- feat: add Yaru theme (@Tienisto)- feat(macos): add Command+W shortcut to close the window (@Q1CHENL)- fix: also show an OLED color mode option when dynamic colors are not supported by OS (@dhruvanbhalara)- fix(ios): fix permission error when picking directory (@Tienisto)diff --git a/app/lib/model/persistence/color_mode.dart b/app/lib/model/persistence/color_mode.dartindex 08d4e79b..29bf8162 100644--- a/app/lib/model/persistence/color_mode.dart+++ b/app/lib/model/persistence/color_mode.dart@@ -2,4 +2,5 @@ enum ColorMode {system, // dynamic colorslocalsend,oled,+ yaru,}diff --git a/app/lib/pages/receive_page.dart b/app/lib/pages/receive_page.dartindex 7e19da78..9fbc8f62 100644--- a/app/lib/pages/receive_page.dart+++ b/app/lib/pages/receive_page.dart@@ -3,11 +3,13 @@ import 'dart:async';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:localsend_app/gen/strings.g.dart';+import 'package:localsend_app/model/persistence/color_mode.dart';import 'package:localsend_app/model/session_status.dart';import 'package:localsend_app/pages/progress_page.dart';import 'package:localsend_app/pages/receive_options_page.dart';import 'package:localsend_app/provider/network/server/server_provider.dart';import 'package:localsend_app/provider/selection/selected_receiving_files_provider.dart';+import 'package:localsend_app/provider/settings_provider.dart';import 'package:localsend_app/theme.dart';import 'package:localsend_app/util/ip_helper.dart';import 'package:localsend_app/util/native/platform_check.dart';@@ -73,6 +75,7 @@ class _ReceivePageState extends State<ReceivePage> with Refena {);}final selectedFiles = ref.watch(selectedReceivingFilesProvider);+ final colorMode = ref.watch(settingsProvider.select((state) => state.colorMode));return WillPopScope(onWillPop: () async {@@ -182,8 +185,8 @@ class _ReceivePageState extends State<ReceivePage> with Refena {padding: const EdgeInsets.only(left: 20),child: ElevatedButton(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ backgroundColor: Theme.of(context).colorScheme.primary,+ foregroundColor: Theme.of(context).colorScheme.onPrimary,),onPressed: () {// ignore: discarded_futures@@ -254,8 +257,9 @@ class _ReceivePageState extends State<ReceivePage> with Refena {children: [ElevatedButton.icon(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).colorScheme.error,- foregroundColor: Theme.of(context).colorScheme.onError,+ elevation: colorMode == ColorMode.yaru ? 0 : null,+ backgroundColor: colorMode == ColorMode.yaru ? Theme.of(context).colorScheme.background : Theme.of(context).colorScheme.error,+ foregroundColor: colorMode == ColorMode.yaru ? Theme.of(context).colorScheme.onBackground : Theme.of(context).colorScheme.onError,),onPressed: () {_decline();@@ -267,8 +271,8 @@ class _ReceivePageState extends State<ReceivePage> with Refena {const SizedBox(width: 20),ElevatedButton.icon(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ backgroundColor: Theme.of(context).colorScheme.primary,+ foregroundColor: Theme.of(context).colorScheme.onPrimary,),onPressed: selectedFiles.isEmpty? nulldiff --git a/app/lib/pages/tabs/receive_tab.dart b/app/lib/pages/tabs/receive_tab.dartindex 839f85f7..d4ede7c0 100644--- a/app/lib/pages/tabs/receive_tab.dart+++ b/app/lib/pages/tabs/receive_tab.dart@@ -76,8 +76,8 @@ class ReceiveTab extends StatelessWidget {child: vm.quickSaveSettings? ElevatedButton(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ backgroundColor: Theme.of(context).colorScheme.primary,+ foregroundColor: Theme.of(context).colorScheme.onPrimary,),onPressed: () async => vm.onSetQuickSave(context, false),child: Text('${t.general.quickSave}: ${t.general.on}'),diff --git a/app/lib/pages/tabs/settings_tab.dart b/app/lib/pages/tabs/settings_tab.dartindex 40478b75..0295d2c1 100644--- a/app/lib/pages/tabs/settings_tab.dart+++ b/app/lib/pages/tabs/settings_tab.dart@@ -625,13 +625,11 @@ extension on ThemeMode {extension on ColorMode {String get humanName {- switch (this) {- case ColorMode.system:- return t.settingsTab.general.colorOptions.system;- case ColorMode.localsend:- return t.appName;- case ColorMode.oled:- return t.settingsTab.general.colorOptions.oled;- }+ return switch (this) {+ ColorMode.system => t.settingsTab.general.colorOptions.system,+ ColorMode.localsend => t.appName,+ ColorMode.oled => t.settingsTab.general.colorOptions.oled,+ ColorMode.yaru => 'Yaru',+ };}}diff --git a/app/lib/pages/troubleshoot_page.dart b/app/lib/pages/troubleshoot_page.dartindex 69a3c15c..0c32bf4e 100644--- a/app/lib/pages/troubleshoot_page.dart+++ b/app/lib/pages/troubleshoot_page.dart@@ -156,8 +156,8 @@ class _FixButton extends StatelessWidget {Widget build(BuildContext context) {return ElevatedButton(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ backgroundColor: Theme.of(context).colorScheme.primary,+ foregroundColor: Theme.of(context).colorScheme.onPrimary,),onPressed: () async {if (onTap != null) {diff --git a/app/lib/theme.dart b/app/lib/theme.dartindex d560f90b..4dbe4303 100644--- a/app/lib/theme.dart+++ b/app/lib/theme.dart@@ -6,10 +6,15 @@ import 'package:localsend_app/provider/device_info_provider.dart';import 'package:localsend_app/util/native/platform_check.dart';import 'package:localsend_app/util/ui/dynamic_colors.dart';import 'package:refena_flutter/refena_flutter.dart';+import 'package:yaru/yaru.dart' as yaru;final _borderRadius = BorderRadius.circular(5);ThemeData getTheme(ColorMode colorMode, Brightness brightness, DynamicColors? dynamicColors) {+ if (colorMode == ColorMode.yaru) {+ return _getYaruTheme(brightness);+ }+final colorScheme = _determineColorScheme(colorMode, brightness, dynamicColors);final lightInputBorder = OutlineInputBorder(@@ -134,7 +139,50 @@ ColorScheme _determineColorScheme(ColorMode mode, Brightness brightness, Dynamicbackground: Colors.black,surface: Colors.black,),+ ColorMode.yaru => throw 'Should reach here',};return colorScheme ?? defaultColorScheme;}++ThemeData _getYaruTheme(Brightness brightness) {+ final baseTheme = brightness == Brightness.light ? yaru.yaruLight : yaru.yaruDark;+ final colorScheme = baseTheme.colorScheme;++ final lightInputBorder = OutlineInputBorder(+ borderSide: BorderSide(color: colorScheme.secondaryContainer),+ borderRadius: _borderRadius,+ );++ final darkInputBorder = OutlineInputBorder(+ borderSide: BorderSide(color: colorScheme.secondaryContainer),+ borderRadius: _borderRadius,+ );++ return baseTheme.copyWith(+ navigationBarTheme: colorScheme.brightness == Brightness.dark+ ? NavigationBarThemeData(+ iconTheme: MaterialStateProperty.all(const IconThemeData(color: Colors.white)),+ )+ : null,+ inputDecorationTheme: InputDecorationTheme(+ filled: true,+ fillColor: colorScheme.secondaryContainer,+ border: colorScheme.brightness == Brightness.light ? lightInputBorder : darkInputBorder,+ focusedBorder: colorScheme.brightness == Brightness.light ? lightInputBorder : darkInputBorder,+ enabledBorder: colorScheme.brightness == Brightness.light ? lightInputBorder : darkInputBorder,+ contentPadding: const EdgeInsets.symmetric(vertical: 0, horizontal: 10),+ ),+ elevatedButtonTheme: ElevatedButtonThemeData(+ style: ElevatedButton.styleFrom(+ foregroundColor: colorScheme.brightness == Brightness.dark ? Colors.white : null,+ padding: checkPlatformIsDesktop() ? const EdgeInsets.all(16) : const EdgeInsets.symmetric(horizontal: 16, vertical: 8),+ ),+ ),+ textButtonTheme: TextButtonThemeData(+ style: TextButton.styleFrom(+ padding: checkPlatformIsDesktop() ? const EdgeInsets.all(16) : const EdgeInsets.symmetric(horizontal: 16, vertical: 8),+ ),+ ),+ );+}diff --git a/app/lib/widget/dialogs/file_name_input_dialog.dart b/app/lib/widget/dialogs/file_name_input_dialog.dartindex f7ddfea2..8d62a9ce 100644--- a/app/lib/widget/dialogs/file_name_input_dialog.dart+++ b/app/lib/widget/dialogs/file_name_input_dialog.dart@@ -60,8 +60,8 @@ class _FileNameInputDialogState extends State<FileNameInputDialog> {),ElevatedButton(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ backgroundColor: Theme.of(context).colorScheme.primary,+ foregroundColor: Theme.of(context).colorScheme.onPrimary,),onPressed: _submit,child: Text(t.general.confirm),diff --git a/app/lib/widget/dialogs/message_input_dialog.dart b/app/lib/widget/dialogs/message_input_dialog.dartindex db16fed9..f1d89fc1 100644--- a/app/lib/widget/dialogs/message_input_dialog.dart+++ b/app/lib/widget/dialogs/message_input_dialog.dart@@ -43,8 +43,8 @@ class _MessageInputDialogState extends State<MessageInputDialog> {),ElevatedButton(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ backgroundColor: Theme.of(context).colorScheme.primary,+ foregroundColor: Theme.of(context).colorScheme.onPrimary,),onPressed: () => context.pop(_textController.text),child: Text(t.general.confirm),diff --git a/app/lib/widget/dialogs/quick_actions_dialog.dart b/app/lib/widget/dialogs/quick_actions_dialog.dartindex fcd991a6..8a01256d 100644--- a/app/lib/widget/dialogs/quick_actions_dialog.dart+++ b/app/lib/widget/dialogs/quick_actions_dialog.dart@@ -112,8 +112,8 @@ class _QuickActionsDialogState extends State<QuickActionsDialog> with Refena {),ElevatedButton(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ backgroundColor: Theme.of(context).colorScheme.primary,+ foregroundColor: Theme.of(context).colorScheme.onPrimary,),onPressed: () {switch (_action) {diff --git a/app/lib/widget/dialogs/text_field_tv.dart b/app/lib/widget/dialogs/text_field_tv.dartindex 7b618f3c..ef27c8ea 100644--- a/app/lib/widget/dialogs/text_field_tv.dart+++ b/app/lib/widget/dialogs/text_field_tv.dart@@ -50,8 +50,8 @@ class _TextFieldTvState extends State<TextFieldTv> with Refena {actions: [ElevatedButton(style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ backgroundColor: Theme.of(context).colorScheme.primary,+ foregroundColor: Theme.of(context).colorScheme.onPrimary,),onPressed: () => context.pop(),child: Text(t.general.confirm),diff --git a/app/linux/flutter/generated_plugin_registrant.cc b/app/linux/flutter/generated_plugin_registrant.ccindex da9a7982..999deafd 100644--- a/app/linux/flutter/generated_plugin_registrant.cc+++ b/app/linux/flutter/generated_plugin_registrant.cc@@ -9,6 +9,7 @@#include <desktop_drop/desktop_drop_plugin.h>#include <dynamic_color/dynamic_color_plugin.h>#include <file_selector_linux/file_selector_plugin.h>+#include <gtk/gtk_plugin.h>#include <pasteboard/pasteboard_plugin.h>#include <screen_retriever/screen_retriever_plugin.h>#include <system_tray/system_tray_plugin.h>@@ -25,6 +26,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {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);+ g_autoptr(FlPluginRegistrar) gtk_registrar =+ fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");+ gtk_plugin_register_with_registrar(gtk_registrar);g_autoptr(FlPluginRegistrar) pasteboard_registrar =fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin");pasteboard_plugin_register_with_registrar(pasteboard_registrar);diff --git a/app/linux/flutter/generated_plugins.cmake b/app/linux/flutter/generated_plugins.cmakeindex a549c821..bf78cd7d 100644--- a/app/linux/flutter/generated_plugins.cmake+++ b/app/linux/flutter/generated_plugins.cmake@@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LISTdesktop_dropdynamic_colorfile_selector_linux+ gtkpasteboardscreen_retrieversystem_traydiff --git a/app/pubspec.lock b/app/pubspec.lockindex 88ff2f04..c1cee4a4 100644--- a/app/pubspec.lock+++ b/app/pubspec.lock@@ -580,6 +580,14 @@ packages:url: "https://pub.dev"source: hostedversion: "2.3.1"+ gtk:+ dependency: transitive+ description:+ name: gtk+ sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c+ url: "https://pub.dev"+ source: hosted+ version: "2.1.0"html:dependency: transitivedescription:@@ -1731,6 +1739,14 @@ packages:url: "https://pub.dev"source: hostedversion: "3.1.2"+ yaru:+ dependency: "direct main"+ description:+ name: yaru+ sha256: "037219db9ffe757eae0d929cb9dc1a8b27af9850dc6c0d89ecf597dc4f78a5b6"+ url: "https://pub.dev"+ source: hosted+ version: "1.2.0"sdks:dart: ">=3.1.1 <4.0.0"flutter: ">=3.13.1"diff --git a/app/pubspec.yaml b/app/pubspec.yamlindex d9a0380f..4395f595 100644--- a/app/pubspec.yaml+++ b/app/pubspec.yaml@@ -68,6 +68,7 @@ dependencies:wakelock_plus: 1.1.3wechat_assets_picker: 8.7.1window_manager: 0.3.7+ yaru: 1.2.0dev_dependencies:build_runner: 2.4.6