Desktop-Enhancements (#1434)

* feat: Add minimum size for macos app

* fix: Adjust font sizing and spaces in wallet list page and wallet selection dropdown
This commit is contained in:
Adegoke David 2024-05-06 20:14:43 +01:00 committed by GitHub
parent 2a88b32eee
commit cd41766e69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 43 additions and 4 deletions

View file

@ -0,0 +1,22 @@
import 'dart:io';
import 'package:flutter/services.dart';
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
Future<void> setDefaultMinimumWindowSize() async {
if (!Platform.isMacOS) return;
try {
final result = await _channel.invokeMethod(
'setMinWindowSize',
{'width': 500, 'height': 700},
) as bool;
if (!result) {
print("Failed to set minimum window size.");
}
} on PlatformException catch (e) {
print("Failed to set minimum window size: '${e.message}'.");
}
}

View file

@ -41,6 +41,7 @@ import 'package:uni_links/uni_links.dart';
import 'package:cw_core/unspent_coins_info.dart';
import 'package:cake_wallet/monero/monero.dart';
import 'package:cw_core/cake_hive.dart';
import 'package:cw_core/window_size.dart';
final navigatorKey = GlobalKey<NavigatorState>();
final rootKey = GlobalKey<RootState>();
@ -60,6 +61,8 @@ Future<void> main() async {
return true;
};
await setDefaultMinimumWindowSize();
await CakeHive.close();
await initializeAppConfigs();

View file

@ -22,7 +22,7 @@ class DropDownItemWidget extends StatelessWidget {
child: Text(
title,
style: TextStyle(
fontSize: 22,
fontSize: 18,
fontWeight: FontWeight.w500,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
),

View file

@ -38,7 +38,7 @@ class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(24),
padding: const EdgeInsets.fromLTRB(24, 24, 24, 4),
child: Text(
S.current.settings,
style: textXLarge(),

View file

@ -171,7 +171,7 @@ class WalletListBodyState extends State<WalletListBody> {
maxLines: null,
softWrap: true,
style: TextStyle(
fontSize: 20,
fontSize: DeviceInfo.instance.isDesktop ? 18 : 20,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.extension<CakeTextTheme>()!

View file

@ -24,7 +24,21 @@ class AppDelegate: FlutterAppDelegate {
}
result(secRandom(count: count))
case "setMinWindowSize":
guard let self = self else {
result(false)
return
}
if let arguments = call.arguments as? [String: Any],
let width = arguments["width"] as? Double,
let height = arguments["height"] as? Double {
DispatchQueue.main.async {
self.mainFlutterWindow?.minSize = CGSize(width: width, height: height)
}
result(true)
} else {
result(false)
}
default:
result(FlutterMethodNotImplemented)
}