Fix/custom client styles (#7373)

* Fix. qs styles

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* custom client, options

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Move logo.svg to icon.svg

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Refact. Custom client, connection status ui.

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Custom client ui. Disable settings, hide "Change password"

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Custom client, logo align center

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Custom client, refact, outgoing ui

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Custom client, outgoing, settings icon

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Custom client, powered by RustDesk

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Custom client, remove unused SizeBox

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Update config.rs

* Update flutter_ffi.rs

---------

Signed-off-by: fufesou <shuanglongchen@yeah.net>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
fufesou
2024-03-14 11:36:14 +08:00
committed by GitHub
parent a314f59db9
commit 5253d67e04
49 changed files with 350 additions and 124 deletions

View File

@@ -13,6 +13,7 @@ import 'package:flutter_hbb/desktop/pages/connection_page.dart';
import 'package:flutter_hbb/desktop/pages/desktop_setting_page.dart';
import 'package:flutter_hbb/desktop/pages/desktop_tab_page.dart';
import 'package:flutter_hbb/desktop/widgets/scroll_wrapper.dart';
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
import 'package:flutter_hbb/models/platform_model.dart';
import 'package:flutter_hbb/models/server_model.dart';
import 'package:flutter_hbb/plugin/ui_manager.dart';
@@ -51,38 +52,43 @@ class _DesktopHomePageState extends State<DesktopHomePage>
Timer? _updateTimer;
bool isCardClosed = false;
RxBool _editHover = false.obs;
final GlobalKey _childKey = GlobalKey();
bool _isInHomePage() {
final controller = Get.find<DesktopTabController>();
return controller.state.value.selected == 0;
}
@override
Widget build(BuildContext context) {
super.build(context);
final children = [buildLeftPane(context)];
if (!bind.isIncomingOnly()) {
children.addAll([
const VerticalDivider(width: 1),
Expanded(child: buildRightPane(context)),
]);
}
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
children: [
buildLeftPane(context),
if (!bind.isIncomingOnly()) const VerticalDivider(width: 1),
if (!bind.isIncomingOnly()) Expanded(child: buildRightPane(context)),
],
);
}
Widget buildLeftPane(BuildContext context) {
final children = <Widget>[
buildTip(context),
buildIDBoard(context),
buildPasswordBoard(context),
if (!bind.isOutgoingOnly()) buildIDBoard(context),
if (!bind.isOutgoingOnly()) buildPasswordBoard(context),
FutureBuilder<Widget>(
future: buildHelpCards(),
builder: (_, data) {
if (data.hasData) {
if (bind.isIncomingOnly()) {
Future.delayed(Duration(milliseconds: 300), () {
_updateWindowSize();
});
if (_isInHomePage()) {
Future.delayed(Duration(milliseconds: 300), () {
_updateWindowSize();
});
}
}
return data.data!;
} else {
@@ -97,10 +103,19 @@ class _DesktopHomePageState extends State<DesktopHomePage>
Divider(),
Container(
margin: EdgeInsets.fromLTRB(0, 0, 8, 6),
child: OnlineStatusWidget(),
child: OnlineStatusWidget(
onSvcStatusChanged: () {
if (_isInHomePage()) {
Future.delayed(Duration(milliseconds: 300), () {
_updateWindowSize();
});
}
},
),
),
]);
}
final textColor = Theme.of(context).textTheme.titleLarge?.color;
return ChangeNotifierProvider.value(
value: gFFI.serverModel,
child: Container(
@@ -108,13 +123,45 @@ class _DesktopHomePageState extends State<DesktopHomePage>
color: Theme.of(context).colorScheme.background,
child: DesktopScrollWrapper(
scrollController: _leftPaneScrollController,
child: SingleChildScrollView(
controller: _leftPaneScrollController,
physics: DraggableNeverScrollableScrollPhysics(),
child: Column(
key: _childKey,
children: children,
),
child: Stack(
children: [
SingleChildScrollView(
controller: _leftPaneScrollController,
physics: DraggableNeverScrollableScrollPhysics(),
child: Column(
key: _childKey,
children: children,
),
),
if (bind.isOutgoingOnly() && !bind.isDisableSettings())
Positioned(
child: Divider(),
bottom: 26,
left: 0,
right: 0,
),
if (bind.isOutgoingOnly() && !bind.isDisableSettings())
Positioned(
bottom: 6,
left: 12,
child: Align(
alignment: Alignment.centerLeft,
child: InkWell(
child: Obx(
() => Icon(
Icons.settings,
color: _editHover.value
? textColor
: Colors.grey.withOpacity(0.5),
size: 22,
),
),
onTap: () => DesktopSettingPage.switch2page(1),
onHover: (value) => _editHover.value = value,
),
),
)
],
),
),
),
@@ -197,6 +244,10 @@ class _DesktopHomePageState extends State<DesktopHomePage>
}
Widget buildPopupMenu(BuildContext context) {
if (bind.isDisableSettings()) {
return Offstage();
}
final textColor = Theme.of(context).textTheme.titleLarge?.color;
RxBool hover = false.obs;
return InkWell(
@@ -287,21 +338,22 @@ class _DesktopHomePageState extends State<DesktopHomePage>
)))),
onHover: (value) => refreshHover.value = value,
).marginOnly(right: 8, top: 4),
InkWell(
child: Obx(
() => Tooltip(
message: translate('Change Password'),
child: Icon(
Icons.edit,
color: editHover.value
? textColor
: Color(0xFFDDDDDD),
size: 22,
)).marginOnly(right: 8, top: 4),
if (!bind.isDisableSettings())
InkWell(
child: Obx(
() => Tooltip(
message: translate('Change Password'),
child: Icon(
Icons.edit,
color: editHover.value
? textColor
: Color(0xFFDDDDDD),
size: 22,
)).marginOnly(right: 8, top: 4),
),
onTap: () => DesktopSettingPage.switch2page(1),
onHover: (value) => editHover.value = value,
),
onTap: () => DesktopSettingPage.switch2page(1),
onHover: (value) => editHover.value = value,
),
],
),
],
@@ -314,6 +366,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
}
buildTip(BuildContext context) {
final logo = loadLogo();
return Padding(
padding:
const EdgeInsets.only(left: 20.0, right: 16, top: 16.0, bottom: 5),
@@ -321,29 +374,68 @@ class _DesktopHomePageState extends State<DesktopHomePage>
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
translate("Your Desktop"),
style: Theme.of(context).textTheme.titleLarge,
// style: TextStyle(
// // color: MyTheme.color(context).text,
// fontWeight: FontWeight.normal,
// fontSize: 19),
Align(
alignment: Alignment.center,
child: logo == null ? Offstage() : logo.marginOnly(bottom: 0.0),
),
Column(
children: [
Align(
alignment: Alignment.centerLeft,
child: Text(
translate("Your Desktop"),
style: Theme.of(context).textTheme.titleLarge,
// style: TextStyle(
// // color: MyTheme.color(context).text,
// fontWeight: FontWeight.normal,
// fontSize: 19),
),
),
if (bind.isCustomClient())
Align(
alignment: Alignment.centerRight,
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
launchUrl(Uri.parse('https://rustdesk.com'));
},
child: Text(
translate("powered by RustDesk"),
overflow: TextOverflow.clip,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(color: Colors.grey.withOpacity(0.7)),
),
),
),
),
],
),
SizedBox(
height: 10.0,
),
Text(
translate("desk_tip"),
overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall,
)
if (!bind.isOutgoingOnly())
Text(
translate("desk_tip"),
overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall,
),
if (bind.isOutgoingOnly())
Text(
translate("outgoing_only_desk_tip"),
overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall,
),
],
),
);
}
Future<Widget> buildHelpCards() async {
if (updateUrl.isNotEmpty &&
if (!bind.isCustomClient() &&
updateUrl.isNotEmpty &&
!isCardClosed &&
bind.mainUriPrefixSync().contains('rustdesk')) {
return buildInstallCard(
@@ -357,7 +449,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
if (systemError.isNotEmpty) {
return buildInstallCard("", systemError, "", () {});
}
if (Platform.isWindows) {
if (Platform.isWindows && !bind.isDisableInstallation()) {
if (!bind.mainIsInstalled()) {
return buildInstallCard("", "install_tip", "Install", () async {
await rustDeskWinManager.closeAllSubWindows();
@@ -372,7 +464,8 @@ class _DesktopHomePageState extends State<DesktopHomePage>
});
}
} else if (Platform.isMacOS) {
if (!bind.mainIsCanScreenRecording(prompt: false)) {
if (!(bind.isOutgoingOnly() ||
bind.mainIsCanScreenRecording(prompt: false))) {
return buildInstallCard("Permissions", "config_screen", "Configure",
() async {
bind.mainIsCanScreenRecording(prompt: true);
@@ -407,6 +500,9 @@ class _DesktopHomePageState extends State<DesktopHomePage>
// });
// }
} else if (Platform.isLinux) {
if (bind.isOutgoingOnly()) {
return Container();
}
final LinuxCards = <Widget>[];
if (bind.isSelinuxEnforcing()) {
// Check is SELinux enforcing, but show user a tip of is SELinux enabled for simple.
@@ -473,8 +569,8 @@ class _DesktopHomePageState extends State<DesktopHomePage>
return Stack(
children: [
Container(
margin:
EdgeInsets.fromLTRB(0, marginTop, 0, bind.isIncomingOnly() ? marginTop : 0),
margin: EdgeInsets.fromLTRB(
0, marginTop, 0, bind.isIncomingOnly() ? marginTop : 0),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
@@ -701,10 +797,17 @@ class _DesktopHomePageState extends State<DesktopHomePage>
}
_updateWindowSize() {
RenderBox renderBox =
_childKey.currentContext?.findRenderObject() as RenderBox;
desktopQsHomeLeftPaneSize = renderBox.size;
windowManager.setSize(getDesktopQsHomeSize());
RenderObject? renderObject = _childKey.currentContext?.findRenderObject();
if (renderObject == null) {
return;
}
if (renderObject is RenderBox) {
final size = renderObject.size;
if (size != imcomingOnlyHomeSize) {
imcomingOnlyHomeSize = size;
windowManager.setSize(getIncomingOnlyHomeSize());
}
}
}
@override