optimize ui

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-08-11 21:29:43 +08:00
parent 94353cf90b
commit 327a712c36
2 changed files with 47 additions and 40 deletions

View File

@ -249,9 +249,12 @@ class _DesktopHomePageState extends State<DesktopHomePage>
Expanded(
child: GestureDetector(
onDoubleTap: () {
if (model.verificationMethod !=
kUsePermanentPassword) {
Clipboard.setData(
ClipboardData(text: model.serverPasswd.text));
showToast(translate("Copied"));
}
},
child: TextFormField(
controller: model.serverPasswd,

View File

@ -7,7 +7,6 @@ import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:get/get.dart';
const double _kTabBarHeight = kDesktopRemoteTabBarHeight;
const double _kTabFixedWidth = 150;
const double _kIconSize = 18;
const double _kDividerIndent = 10;
const double _kAddIconSize = _kTabBarHeight - 15;
@ -55,17 +54,16 @@ class DesktopTabBar extends StatelessWidget {
offstage: !mainTab,
child: Row(children: [
Image.asset('assets/logo.ico'),
Text("RustDesk"),
Text("RustDesk").paddingOnly(left: 5),
]).paddingSymmetric(horizontal: 12, vertical: 5),
),
Flexible(
child: Obx(() => TabBar(
indicator: BoxDecoration(),
indicatorColor: Colors.transparent,
indicatorColor: _theme.indicatorColor,
labelPadding: const EdgeInsets.symmetric(
vertical: 0, horizontal: 0),
isScrollable: true,
indicatorWeight: 0.1,
indicatorPadding: EdgeInsets.only(bottom: 2),
physics: BouncingScrollPhysics(),
controller: controller.value,
tabs: tabs.asMap().entries.map((e) {
@ -179,17 +177,17 @@ class _Tab extends StatelessWidget {
bool is_selected = index == selected;
bool show_divider = index != selected - 1 && index != selected;
return Ink(
width: _kTabFixedWidth,
child: InkWell(
onHover: (hover) => _hover.value = hover,
onTap: () => onSelected(),
child: Row(
children: [
Expanded(
child: Tab(
key: this.key,
Tab(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
icon,
@ -197,24 +195,27 @@ class _Tab extends StatelessWidget {
color: is_selected
? theme.selectedtabIconColor
: theme.unSelectedtabIconColor,
).paddingSymmetric(horizontal: 5),
Expanded(
child: Text(
).paddingOnly(right: 5),
Text(
translate(label),
textAlign: TextAlign.center,
style: TextStyle(
color: is_selected
? theme.selectedTextColor
: theme.unSelectedTextColor),
),
],
),
Obx((() => _CloseButton(
visiable: _hover.value && closable,
Offstage(
offstage: !closable,
child: Obx((() => _CloseButton(
visiable: _hover.value,
tabSelected: is_selected,
onClose: () => onClose(),
theme: theme,
))),
])),
),
)
])).paddingSymmetric(horizontal: 10),
Offstage(
offstage: !show_divider,
child: VerticalDivider(
@ -289,7 +290,7 @@ class _CloseButton extends StatelessWidget {
: theme.unSelectedIconColor,
),
),
)).paddingSymmetric(horizontal: 5);
)).paddingOnly(left: 5);
}
}
@ -301,6 +302,7 @@ class _Theme {
late Color selectedIconColor;
late Color unSelectedIconColor;
late Color dividerColor;
late Color indicatorColor;
_Theme.light() {
unSelectedtabIconColor = Color.fromARGB(255, 162, 203, 241);
@ -310,6 +312,7 @@ class _Theme {
selectedIconColor = Color.fromARGB(255, 26, 26, 26);
unSelectedIconColor = Color.fromARGB(255, 96, 96, 96);
dividerColor = Color.fromARGB(255, 238, 238, 238);
indicatorColor = MyTheme.accent;
}
_Theme.dark() {
@ -320,5 +323,6 @@ class _Theme {
selectedIconColor = Color.fromARGB(255, 215, 215, 215);
unSelectedIconColor = Color.fromARGB(255, 255, 255, 255);
dividerColor = Color.fromARGB(255, 64, 64, 64);
indicatorColor = MyTheme.accent;
}
}