mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 02:57:22 +00:00
refact: web ui (#9217)
* refact: web ui Signed-off-by: fufesou <linlong1266@gmail.com> * refact: remove AppBar shadow Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -736,7 +736,8 @@ class RustdeskImpl {
|
||||
}
|
||||
|
||||
Future<String> mainGetLicense({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
// TODO: implement
|
||||
return Future(() => '');
|
||||
}
|
||||
|
||||
Future<String> mainGetVersion({dynamic hint}) {
|
||||
@@ -975,10 +976,11 @@ class RustdeskImpl {
|
||||
|
||||
Future<void> mainSetUserDefaultOption(
|
||||
{required String key, required String value, dynamic hint}) {
|
||||
return js.context.callMethod('getByName', [
|
||||
js.context.callMethod('setByName', [
|
||||
'option:user:default',
|
||||
jsonEncode({'name': key, 'value': value})
|
||||
]);
|
||||
return Future.value();
|
||||
}
|
||||
|
||||
String mainGetUserDefaultOption({required String key, dynamic hint}) {
|
||||
@@ -1052,7 +1054,7 @@ class RustdeskImpl {
|
||||
}
|
||||
|
||||
Future<String> mainGetLangs({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('getByName', ['langs']));
|
||||
}
|
||||
|
||||
Future<String> mainGetTemporaryPassword({dynamic hint}) {
|
||||
@@ -1064,7 +1066,8 @@ class RustdeskImpl {
|
||||
}
|
||||
|
||||
Future<String> mainGetFingerprint({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
// TODO: implement
|
||||
return Future.value('');
|
||||
}
|
||||
|
||||
Future<String> cmGetClientsState({dynamic hint}) {
|
||||
@@ -1106,7 +1109,7 @@ class RustdeskImpl {
|
||||
}
|
||||
|
||||
String mainSupportedHwdecodings({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return '{}';
|
||||
}
|
||||
|
||||
Future<bool> mainIsRoot({dynamic hint}) {
|
||||
@@ -1295,8 +1298,7 @@ class RustdeskImpl {
|
||||
}
|
||||
|
||||
Future<String> mainGetBuildDate({dynamic hint}) {
|
||||
// TODO
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('getByName', ['build_date']));
|
||||
}
|
||||
|
||||
String translate(
|
||||
|
||||
98
flutter/lib/web/settings_page.dart
Normal file
98
flutter/lib/web/settings_page.dart
Normal file
@@ -0,0 +1,98 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/desktop/pages/desktop_setting_page.dart';
|
||||
import 'package:flutter_hbb/mobile/pages/scan_page.dart';
|
||||
import 'package:flutter_hbb/mobile/pages/settings_page.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../common.dart';
|
||||
import '../../common/widgets/login.dart';
|
||||
import '../../models/model.dart';
|
||||
|
||||
class WebSettingsPage extends StatelessWidget {
|
||||
const WebSettingsPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (isWebDesktop) {
|
||||
return _buildDesktopButton(context);
|
||||
} else {
|
||||
return _buildMobileMenu(context);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildDesktopButton(BuildContext context) {
|
||||
return IconButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) =>
|
||||
DesktopSettingPage(initialTabkey: SettingsTabKey.general),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMobileMenu(BuildContext context) {
|
||||
Provider.of<FfiModel>(context);
|
||||
return PopupMenuButton<String>(
|
||||
tooltip: "",
|
||||
icon: const Icon(Icons.more_vert),
|
||||
itemBuilder: (context) {
|
||||
return (isIOS
|
||||
? [
|
||||
const PopupMenuItem(
|
||||
value: "scan",
|
||||
child: Icon(Icons.qr_code_scanner, color: Colors.black),
|
||||
)
|
||||
]
|
||||
: <PopupMenuItem<String>>[]) +
|
||||
[
|
||||
PopupMenuItem(
|
||||
value: "server",
|
||||
child: Text(translate('ID/Relay Server')),
|
||||
)
|
||||
] +
|
||||
[
|
||||
PopupMenuItem(
|
||||
value: "login",
|
||||
child: Text(gFFI.userModel.userName.value.isEmpty
|
||||
? translate("Login")
|
||||
: '${translate("Logout")} (${gFFI.userModel.userName.value})'),
|
||||
)
|
||||
] +
|
||||
[
|
||||
PopupMenuItem(
|
||||
value: "about",
|
||||
child: Text(translate('About RustDesk')),
|
||||
)
|
||||
];
|
||||
},
|
||||
onSelected: (value) {
|
||||
if (value == 'server') {
|
||||
showServerSettings(gFFI.dialogManager);
|
||||
}
|
||||
if (value == 'about') {
|
||||
showAbout(gFFI.dialogManager);
|
||||
}
|
||||
if (value == 'login') {
|
||||
if (gFFI.userModel.userName.value.isEmpty) {
|
||||
loginDialog();
|
||||
} else {
|
||||
logOutConfirmDialog();
|
||||
}
|
||||
}
|
||||
if (value == 'scan') {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) => ScanPage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user