fix some minors of custom client

This commit is contained in:
rustdesk
2024-03-15 00:26:53 +08:00
parent 228582296c
commit a9b0bc0409
8 changed files with 100 additions and 99 deletions

View File

@@ -3082,7 +3082,7 @@ Color? disabledTextColor(BuildContext context, bool enabled) {
: Theme.of(context).textTheme.titleLarge?.color?.withOpacity(0.6);
}
// max 200 x 40
// max 300 x 60
Widget? loadLogo() {
bool isFound = true;
final image = Image.asset(
@@ -3095,9 +3095,9 @@ Widget? loadLogo() {
);
if (isFound) {
return Container(
constraints: BoxConstraints(maxWidth: 200, maxHeight: 40),
constraints: BoxConstraints(maxWidth: 300, maxHeight: 60),
child: image,
).marginOnly(bottom: 10);
).marginOnly(bottom: 16);
} else {
return null;
}

View File

@@ -64,6 +64,7 @@ class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
@override
Widget build(BuildContext context) {
final isIncomingOnly = bind.isIncomingOnly();
return Container(
height: height,
child: Obx(() => Row(
@@ -83,7 +84,7 @@ class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
),
).marginSymmetric(horizontal: em),
Container(
width: bind.isIncomingOnly() ? 240 : null,
width: isIncomingOnly ? 226 : null,
child: _buildConnStatusMsg(),
),
// stop
@@ -101,39 +102,40 @@ class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
),
// ready && public
// No need to show the guide if is custom client.
if (!bind.isIncomingOnly()) Flexible(
child: Offstage(
offstage: !(!_svcStopped.value &&
stateGlobal.svcStatus.value == SvcStatus.ready &&
_svcIsUsingPublicServer.value),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(', ', style: TextStyle(fontSize: em)),
Flexible(
child: InkWell(
onTap: onUsePublicServerGuide,
child: Row(
children: [
Flexible(
child: Text(
translate('setup_server_tip'),
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: em),
if (!isIncomingOnly)
Flexible(
child: Offstage(
offstage: !(!_svcStopped.value &&
stateGlobal.svcStatus.value == SvcStatus.ready &&
_svcIsUsingPublicServer.value),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(', ', style: TextStyle(fontSize: em)),
Flexible(
child: InkWell(
onTap: onUsePublicServerGuide,
child: Row(
children: [
Flexible(
child: Text(
translate('setup_server_tip'),
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: em),
),
),
),
],
],
),
),
),
)
],
)
],
),
),
),
)
)
],
)),
).paddingOnly(right: bind.isIncomingOnly() ? 8 : 0);
).paddingOnly(right: isIncomingOnly ? 8 : 0);
}
_buildConnStatusMsg() {
@@ -258,6 +260,7 @@ class _ConnectionPageState extends State<ConnectionPage>
@override
Widget build(BuildContext context) {
final isOutgoingOnly = bind.isOutgoingOnly();
return Column(
children: [
Expanded(
@@ -273,8 +276,8 @@ class _ConnectionPageState extends State<ConnectionPage>
Expanded(child: PeerTabPage()),
],
).paddingOnly(left: 12.0)),
if (!bind.isOutgoingOnly()) const Divider(height: 1),
if (!bind.isOutgoingOnly()) OnlineStatusWidget()
if (!isOutgoingOnly) const Divider(height: 1),
if (!isOutgoingOnly) OnlineStatusWidget()
],
);
}

View File

@@ -64,26 +64,49 @@ class _DesktopHomePageState extends State<DesktopHomePage>
@override
Widget build(BuildContext context) {
super.build(context);
final isIncomingOnly = bind.isIncomingOnly();
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildLeftPane(context),
if (!bind.isIncomingOnly()) const VerticalDivider(width: 1),
if (!bind.isIncomingOnly()) Expanded(child: buildRightPane(context)),
if (!isIncomingOnly) const VerticalDivider(width: 1),
if (!isIncomingOnly) Expanded(child: buildRightPane(context)),
],
);
}
Widget buildLeftPane(BuildContext context) {
final isIncomingOnly = bind.isIncomingOnly();
final isOutgoingOnly = bind.isOutgoingOnly();
final children = <Widget>[
if (bind.isCustomClient())
Align(
alignment: Alignment.center,
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
launchUrl(Uri.parse('https://rustdesk.com'));
},
child: Opacity(
opacity: 0.5,
child: Text(
translate("powered_by_me"),
overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 9, decoration: TextDecoration.underline),
)),
),
).marginOnly(top: 6),
),
buildTip(context),
if (!bind.isOutgoingOnly()) buildIDBoard(context),
if (!bind.isOutgoingOnly()) buildPasswordBoard(context),
if (!isOutgoingOnly) buildIDBoard(context),
if (!isOutgoingOnly) buildPasswordBoard(context),
FutureBuilder<Widget>(
future: buildHelpCards(),
builder: (_, data) {
if (data.hasData) {
if (bind.isIncomingOnly()) {
if (isIncomingOnly) {
if (_isInHomePage()) {
Future.delayed(Duration(milliseconds: 300), () {
_updateWindowSize();
@@ -98,7 +121,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
),
buildPluginEntry(),
];
if (bind.isIncomingOnly()) {
if (isIncomingOnly) {
children.addAll([
Divider(),
Container(
@@ -119,7 +142,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
return ChangeNotifierProvider.value(
value: gFFI.serverModel,
child: Container(
width: bind.isIncomingOnly() ? 280.0 : 200.0,
width: isIncomingOnly ? 280.0 : 200.0,
color: Theme.of(context).colorScheme.background,
child: DesktopScrollWrapper(
scrollController: _leftPaneScrollController,
@@ -133,14 +156,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
children: children,
),
),
if (bind.isOutgoingOnly() && !bind.isDisableSettings())
Positioned(
child: Divider(),
bottom: 26,
left: 0,
right: 0,
),
if (bind.isOutgoingOnly() && !bind.isDisableSettings())
if (isOutgoingOnly)
Positioned(
bottom: 6,
left: 12,
@@ -156,7 +172,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
size: 22,
),
),
onTap: () => DesktopSettingPage.switch2page(1),
onTap: () => DesktopSettingPage.switch2page(0),
onHover: (value) => _editHover.value = value,
),
),
@@ -244,10 +260,6 @@ 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(
@@ -351,7 +363,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
size: 22,
)).marginOnly(right: 8, top: 4),
),
onTap: () => DesktopSettingPage.switch2page(1),
onTap: () => DesktopSettingPage.switch2page(0),
onHover: (value) => editHover.value = value,
),
],
@@ -366,6 +378,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
}
buildTip(BuildContext context) {
final isOutgoingOnly = bind.isOutgoingOnly();
final logo = loadLogo();
return Padding(
padding:
@@ -380,35 +393,12 @@ class _DesktopHomePageState extends State<DesktopHomePage>
),
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())
if (!isOutgoingOnly)
Align(
alignment: Alignment.centerRight,
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
launchUrl(Uri.parse('https://rustdesk.com'));
},
child: Text(
translate("powered_by_me"),
overflow: TextOverflow.clip,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(color: Colors.grey.withOpacity(0.7)),
),
),
alignment: Alignment.centerLeft,
child: Text(
translate("Your Desktop"),
style: Theme.of(context).textTheme.titleLarge,
),
),
],
@@ -416,13 +406,13 @@ class _DesktopHomePageState extends State<DesktopHomePage>
SizedBox(
height: 10.0,
),
if (!bind.isOutgoingOnly())
if (!isOutgoingOnly)
Text(
translate("desk_tip"),
overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall,
),
if (bind.isOutgoingOnly())
if (isOutgoingOnly)
Text(
translate("outgoing_only_desk_tip"),
overflow: TextOverflow.clip,
@@ -449,9 +439,12 @@ class _DesktopHomePageState extends State<DesktopHomePage>
if (systemError.isNotEmpty) {
return buildInstallCard("", systemError, "", () {});
}
if (Platform.isWindows && !bind.isDisableInstallation()) {
if (!bind.mainIsInstalled()) {
return buildInstallCard("", "install_tip", "Install", () async {
return buildInstallCard(
"", bind.isOutgoingOnly() ? "" : "install_tip", "Install",
() async {
await rustDeskWinManager.closeAllSubWindows();
bind.mainGotoInstall();
});
@@ -598,14 +591,15 @@ class _DesktopHomePageState extends State<DesktopHomePage>
]
: <Widget>[]) +
<Widget>[
Text(
translate(content),
style: TextStyle(
height: 1.5,
color: Colors.white,
fontWeight: FontWeight.normal,
fontSize: 13),
).marginOnly(bottom: 20)
if (content.isNotEmpty)
Text(
translate(content),
style: TextStyle(
height: 1.5,
color: Colors.white,
fontWeight: FontWeight.normal,
fontSize: 13),
).marginOnly(bottom: 20)
] +
(btnText.isNotEmpty
? <Widget>[

View File

@@ -106,10 +106,11 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
List<_TabInfo> _settingTabs() {
final List<_TabInfo> settingTabs = <_TabInfo>[
_TabInfo('General', Icons.settings_outlined, Icons.settings),
if (!bind.isOutgoingOnly())
if (!bind.isOutgoingOnly() && !bind.isDisableSettings())
_TabInfo('Security', Icons.enhanced_encryption_outlined,
Icons.enhanced_encryption),
_TabInfo('Network', Icons.link_outlined, Icons.link),
if (!bind.isDisableSettings())
_TabInfo('Network', Icons.link_outlined, Icons.link),
if (!bind.isIncomingOnly())
_TabInfo(
'Display', Icons.desktop_windows_outlined, Icons.desktop_windows),
@@ -125,8 +126,8 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
List<Widget> _children() {
final children = [
_General(),
if (!bind.isOutgoingOnly()) _Safety(),
_Network(),
if (!bind.isOutgoingOnly() && !bind.isDisableSettings()) _Safety(),
if (!bind.isDisableSettings()) _Network(),
if (!bind.isIncomingOnly()) _Display(),
if (!bind.isIncomingOnly() && bind.pluginFeatureIsEnabled()) _Plugin(),
if (!bind.isDisableAccount()) _Account(),