fix connect status colors

This commit is contained in:
rustdesk 2022-09-23 15:12:50 +08:00
parent 95a241bdf4
commit 4f92555399
4 changed files with 23 additions and 16 deletions

View File

@ -1,6 +1,7 @@
import 'package:contextmenu/contextmenu.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hbb/consts.dart';
import 'package:get/get.dart';
import '../../common.dart';
@ -156,13 +157,7 @@ class _PeerCardState extends State<_PeerCard>
child: Column(
children: [
Row(children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 4, 4, 4),
child: CircleAvatar(
radius: 5,
backgroundColor: peer.online
? Colors.green
: Colors.yellow)),
getOnline(4, peer.online),
Expanded(
child: Text(
alias.isEmpty ? formatID(peer.id) : alias,
@ -256,13 +251,7 @@ class _PeerCardState extends State<_PeerCard>
children: [
Expanded(
child: Row(children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 4, 8, 4),
child: CircleAvatar(
radius: 5,
backgroundColor: peer.online
? Colors.green
: Colors.yellow)),
getOnline(4, peer.online),
Expanded(
child: Text(
peer.alias.isEmpty ? formatID(peer.id) : peer.alias,
@ -991,3 +980,13 @@ void _rdpDialog(String id) async {
);
});
}
Widget getOnline(int rightMargin, bool online) {
return Tooltip(
message: translate(online ? 'Online' : 'Offline'),
waitDuration: const Duration(seconds: 1),
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 4, 8, 4),
child: CircleAvatar(
radius: 3, backgroundColor: online ? Colors.green : kColorWarn)));
}

View File

@ -11,6 +11,8 @@ const String kAppTypeDesktopPortForward = "port forward";
const String kTabLabelHomePage = "Home";
const String kTabLabelSettingPage = "Settings";
const Color kColorWarn = Color.fromARGB(255, 245, 133, 59);
const int kMobileDefaultDisplayWidth = 720;
const int kMobileDefaultDisplayHeight = 1280;

View File

@ -5,6 +5,7 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_hbb/common/widgets/address_book.dart';
import 'package:flutter_hbb/consts.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher_string.dart';
@ -297,7 +298,11 @@ class _ConnectionPageState extends State<ConnectionPage> {
width: 8,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: svcStopped.value ? Colors.redAccent : Colors.green,
color: svcStopped.value || svcStatusCode.value == 0
? kColorWarn
: (svcStatusCode.value == 1
? Color.fromARGB(255, 50, 190, 166)
: Color.fromARGB(255, 224, 79, 95)),
),
).paddingSymmetric(horizontal: 12.0);
if (svcStopped.value) {

View File

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/desktop/pages/desktop_home_page.dart';
import 'package:flutter_hbb/models/platform_model.dart';
import 'package:flutter_hbb/models/server_model.dart';
@ -474,7 +475,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
_OptionCheckBox(context, 'Deny remote access', 'stop-service',
checkedIcon: const Icon(
Icons.warning_amber_rounded,
color: Color.fromARGB(255, 255, 204, 0),
color: kColorWarn,
),
enabled: enabled),
Offstage(