mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
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:
parent
2a88b32eee
commit
cd41766e69
6 changed files with 43 additions and 4 deletions
22
cw_core/lib/window_size.dart
Normal file
22
cw_core/lib/window_size.dart
Normal 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}'.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ import 'package:uni_links/uni_links.dart';
|
||||||
import 'package:cw_core/unspent_coins_info.dart';
|
import 'package:cw_core/unspent_coins_info.dart';
|
||||||
import 'package:cake_wallet/monero/monero.dart';
|
import 'package:cake_wallet/monero/monero.dart';
|
||||||
import 'package:cw_core/cake_hive.dart';
|
import 'package:cw_core/cake_hive.dart';
|
||||||
|
import 'package:cw_core/window_size.dart';
|
||||||
|
|
||||||
final navigatorKey = GlobalKey<NavigatorState>();
|
final navigatorKey = GlobalKey<NavigatorState>();
|
||||||
final rootKey = GlobalKey<RootState>();
|
final rootKey = GlobalKey<RootState>();
|
||||||
|
@ -60,6 +61,8 @@ Future<void> main() async {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
await setDefaultMinimumWindowSize();
|
||||||
|
|
||||||
await CakeHive.close();
|
await CakeHive.close();
|
||||||
|
|
||||||
await initializeAppConfigs();
|
await initializeAppConfigs();
|
||||||
|
|
|
@ -22,7 +22,7 @@ class DropDownItemWidget extends StatelessWidget {
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||||
),
|
),
|
||||||
|
|
|
@ -38,7 +38,7 @@ class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.fromLTRB(24, 24, 24, 4),
|
||||||
child: Text(
|
child: Text(
|
||||||
S.current.settings,
|
S.current.settings,
|
||||||
style: textXLarge(),
|
style: textXLarge(),
|
||||||
|
|
|
@ -171,7 +171,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: DeviceInfo.instance.isDesktop ? 18 : 20,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<CakeTextTheme>()!
|
.extension<CakeTextTheme>()!
|
||||||
|
|
|
@ -24,7 +24,21 @@ class AppDelegate: FlutterAppDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
result(secRandom(count: count))
|
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:
|
default:
|
||||||
result(FlutterMethodNotImplemented)
|
result(FlutterMethodNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue