Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Future<void> init() async {
windowManager.setPreventClose(true);
}
windowManager.waitUntilReadyToShow().then((_) async {
await windowManager.setMinimumSize(const Size(500, 600));
await windowManager.setMinimumSize(const Size(700, 700));
await windowManager.setTitle(_appName);
await windowManager.show();
});
Expand All @@ -38,7 +38,7 @@ Future<void> init() async {
Future<void> initTrayIcon([Brightness platformBrightness = Brightness.light]) async {
// tray icon init
try {
final iconName = platformBrightness.isDark ? 'icon_light' : 'icon_dark';
final iconName = platformBrightness == Brightness.dark ? 'icon_light' : 'icon_dark';
await trayManager.setIcon(Platform.isWindows ? 'assets/tray/$iconName.ico' : 'assets/tray/$iconName.png');
if (Platform.isLinux) {
// Don't show title on macOS (takes up more space in menu bar)
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _MyAppState extends State<MyApp> {
title: 'scrcpy buddy 🤝',
themeMode: brightness.data == null
? ThemeMode.system
: (brightness.data!.isDark ? ThemeMode.dark : ThemeMode.light),
: (brightness.data! == Brightness.dark ? ThemeMode.dark : ThemeMode.light),
theme: FluentThemeData(accentColor: SystemTheme.accentColor.accent.toAccentColor()),
darkTheme: FluentThemeData(
brightness: Brightness.dark,
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/devices/widget/devices_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class DevicesHeader extends AppStatelessWidget {
}

Color backgroundColor(Brightness brightness) {
return brightness.isLight ? Colors.grey[30] : Colors.grey[150];
return brightness == Brightness.light ? Colors.grey[30] : Colors.grey[150];
}

Color separatorColor(Brightness brightness) {
return brightness.isLight ? Colors.grey[40] : Colors.grey[160];
return brightness == Brightness.light ? Colors.grey[40] : Colors.grey[160];
}
}
2 changes: 1 addition & 1 deletion lib/presentation/extension/context_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension ContextExtension on BuildContext {

Size get windowSize => read<Size>();

Color get errorColor => theme.brightness.isDark ? Colors.red.lighter : Colors.errorPrimaryColor;
Color get errorColor => theme.brightness == Brightness.dark ? Colors.red.lighter : Colors.errorPrimaryColor;

Future<T?> openDialog<T>(Widget child) =>
showDialog<T>(context: this, barrierDismissible: true, builder: (_) => child);
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/home/console_section/console_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _ConsoleSectionState extends AppModuleState<ConsoleSection> {
curve: context.theme.animationCurve,
child: Container(
color: context.theme.resources.solidBackgroundFillColorTertiary.lerpWith(
context.theme.brightness.isDark ? Colors.white : Colors.black,
context.theme.brightness == Brightness.dark ? Colors.white : Colors.black,
0.1,
),
child: Column(
Expand Down
9 changes: 5 additions & 4 deletions lib/presentation/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,12 @@ class _HomeScreenState extends AppModuleState<HomeScreen> with WindowListener, T
selected: selectedIndex,
footerItems: footerItems,
),
appBar: NavigationAppBar(
automaticallyImplyLeading: false,
titleBar: TitleBar(
height: 56,
isBackButtonVisible: false,
title: Text(context.translatedText(key: 'appName'), style: typography.bodyStrong),
actions: Padding(
padding: const EdgeInsets.only(top: 12, right: 16),
captionControls: Padding(
padding: const EdgeInsets.only(right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
65 changes: 38 additions & 27 deletions lib/presentation/settings/widget/theme_brightness_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,45 @@ class ThemeBrightnessSetting extends AppStatelessWidget {

@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...Brightness.values.map(
(brightness) => Padding(
padding: const EdgeInsets.only(bottom: 8),
child: RadioButton(
checked: brightnessPreference.getValue() == brightness,
onChanged: (checked) {
if (checked) {
brightnessPreference.setValue(brightness);
}
},
content: Text(translatedText(context, key: brightness.name)),
),
),
return StreamBuilder<Brightness?>(
stream: brightnessPreference,
builder: (context, brightness) => RadioGroup<AppThemeBrightness>(
groupValue: AppThemeBrightness.fromBrightness(brightness.data),
onChanged: (newValue) => brightnessPreference.setValue(newValue?.toBrightness()),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: AppThemeBrightness.values
.map(
(brightness) => Padding(
padding: const EdgeInsets.only(bottom: 8),
child: RadioButton(
value: brightness,
content: Text(translatedText(context, key: brightness.name)),
),
),
)
.toList(),
),
RadioButton(
checked: brightnessPreference.getValue() == null,
onChanged: (checked) {
if (checked) {
brightnessPreference.setValue(null);
}
},
content: Text(translatedText(context, key: 'system')),
),
],
),
);
}
}

enum AppThemeBrightness {
light,
dark,
system;

Brightness? toBrightness() => switch (this) {
dark => Brightness.dark,
system => null,
light => Brightness.light,
};

static AppThemeBrightness fromBrightness(Brightness? brightness) => switch (brightness) {
Brightness.dark => dark,
null => system,
Brightness.light => light,
};
}
56 changes: 24 additions & 32 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.4.1"
checked_yaml:
dependency: transitive
description:
Expand Down Expand Up @@ -341,10 +341,10 @@ packages:
dependency: "direct main"
description:
name: fluent_ui
sha256: "64223237a1d873b426d578d4d8b2703b8f7d9731608a5beb7b9745194568d484"
sha256: ccddccb8256f2d7c93838be8e01021cfe337070bb6b880d0f005c137d3e29224
url: "https://pub.dev"
source: hosted
version: "4.13.0"
version: "4.15.1"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -370,10 +370,10 @@ packages:
dependency: "direct main"
description:
name: flutter_i18n
sha256: fe2bd740fe522d9dd791850baa6cba492f00c283f3c0b0012995d538ce66570c
sha256: af7d625e4bfd04764d1554a6411d349dd62d4dc204105cc819a81a35a77bd9b6
url: "https://pub.dev"
source: hosted
version: "0.36.3"
version: "0.37.1"
flutter_launcher_icons:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -501,14 +501,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.5"
js:
dependency: transitive
description:
name: js
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
json_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -569,26 +561,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.dev"
source: hosted
version: "0.12.17"
version: "0.12.19"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.13.0"
math_expressions:
dependency: transitive
description:
name: math_expressions
sha256: "218dc65bed4726562bb31c53d8daa3cc824664b26fb72d77bc592757edf74ba0"
sha256: "2e1ceb974c2b1893c809a68c7005f1b63f7324db0add800a0e792b1ac8ff9f03"
url: "https://pub.dev"
source: hosted
version: "2.7.0"
version: "3.1.0"
menu_base:
dependency: transitive
description:
Expand Down Expand Up @@ -745,10 +737,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675"
url: "https://pub.dev"
source: hosted
version: "6.1.0"
version: "7.0.2"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -1110,26 +1102,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7"
sha256: "280d6d890011ca966ad08df7e8a4ddfab0fb3aa49f96ed6de56e3521347a9ae7"
url: "https://pub.dev"
source: hosted
version: "1.26.3"
version: "1.30.0"
test_api:
dependency: transitive
description:
name: test_api
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
url: "https://pub.dev"
source: hosted
version: "0.7.7"
version: "0.7.10"
test_core:
dependency: transitive
description:
name: test_core
sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0"
sha256: "0381bd1585d1a924763c308100f2138205252fb90c9d4eeaf28489ee65ccde51"
url: "https://pub.dev"
source: hosted
version: "0.6.12"
version: "0.6.16"
text_scroll:
dependency: "direct main"
description:
Expand All @@ -1142,10 +1134,10 @@ packages:
dependency: transitive
description:
name: toml
sha256: d968d149c8bd06dc14e09ea3a140f90a3f2ba71949e7a91df4a46f3107400e71
sha256: "35cd2a1351c14bd213f130f8efcbd3e0c18181bff0c8ca7a08f6822a2bede786"
url: "https://pub.dev"
source: hosted
version: "0.16.0"
version: "0.17.0"
tray_manager:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1302,10 +1294,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
url: "https://pub.dev"
source: hosted
version: "6.5.0"
version: "6.6.1"
xml2json:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ dependencies:
sdk: flutter

# UI
fluent_ui: ^4.13.0
fluent_ui: ^4.15.1
system_theme: ^3.1.2
go_router: ^17.0.0
flutter_acrylic: ^1.1.4
flutter_i18n: ^0.36.3
flutter_i18n: ^0.37.1
window_manager: ^0.5.1
text_scroll: ^0.2.1

Expand Down
Loading