Merge pull request #3448 from 21pages/style

disabled color
This commit is contained in:
RustDesk 2023-03-01 17:23:13 +08:00 committed by GitHub
commit 556daeea71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 86 additions and 18 deletions

View File

@ -218,19 +218,30 @@ class MyTheme {
labelColor: Colors.white70,
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(Colors.grey[500])
thumbColor: MaterialStateProperty.all(Colors.grey[500]),
),
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
splashFactory: isDesktop ? NoSplash.splashFactory : null,
outlinedButtonTheme: OutlinedButtonThemeData(
style:
OutlinedButton.styleFrom(side: BorderSide(color: Colors.white38))),
style: OutlinedButton.styleFrom(
side: BorderSide(color: Colors.white38),
disabledForegroundColor: Colors.white70,
),
),
textButtonTheme: isDesktop
? TextButtonThemeData(
style: ButtonStyle(splashFactory: NoSplash.splashFactory),
)
style: TextButton.styleFrom(
splashFactory: NoSplash.splashFactory,
disabledForegroundColor: Colors.white70,
))
: null,
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
disabledForegroundColor: Colors.white70,
disabledBackgroundColor: Colors.white10,
),
),
checkboxTheme:
const CheckboxThemeData(checkColor: MaterialStatePropertyAll(dark)),
colorScheme: ColorScheme.fromSwatch(

View File

@ -538,6 +538,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
translate('Screen Share'),
translate('Deny remote access'),
],
enabled: enabled,
initialKey: initialKey,
onChanged: (mode) async {
String modeValue;
@ -667,6 +668,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
return _Card(title: 'Password', children: [
_ComboBox(
enabled: !locked,
keys: modeKeys,
values: modeValues,
initialKey: modeInitialKey,
@ -1722,7 +1724,6 @@ class _ComboBox extends StatelessWidget {
required this.values,
required this.initialKey,
required this.onChanged,
// ignore: unused_element
this.enabled = true,
}) : super(key: key);
@ -1735,7 +1736,9 @@ class _ComboBox extends StatelessWidget {
var ref = values[index].obs;
current = keys[index];
return Container(
decoration: BoxDecoration(border: Border.all(color: MyTheme.border)),
decoration: BoxDecoration(
border: Border.all(
color: _disabledTextColor(context, enabled) ?? MyTheme.border)),
height: 30,
child: Obx(() => DropdownButton<String>(
isExpanded: true,
@ -1744,6 +1747,7 @@ class _ComboBox extends StatelessWidget {
underline: Container(
height: 25,
),
style: TextStyle(color: _disabledTextColor(context, enabled)),
icon: const Icon(
Icons.expand_more_sharp,
size: 20,

View File

@ -1,7 +1,9 @@
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
import 'package:flutter_hbb/models/platform_model.dart';
import 'package:flutter_hbb/models/state_model.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:window_manager/window_manager.dart';
@ -13,7 +15,51 @@ class InstallPage extends StatefulWidget {
State<InstallPage> createState() => _InstallPageState();
}
class _InstallPageState extends State<InstallPage> with WindowListener {
class _InstallPageState extends State<InstallPage> {
final tabController = DesktopTabController(tabType: DesktopTabType.main);
@override
void initState() {
super.initState();
Get.put<DesktopTabController>(tabController);
const lable = "install";
tabController.add(TabInfo(
key: lable,
label: lable,
closable: false,
page: _InstallPageBody(
key: const ValueKey(lable),
)));
}
@override
void dispose() {
super.dispose();
Get.delete<DesktopTabController>();
}
@override
Widget build(BuildContext context) {
return DragToResizeArea(
resizeEdgeSize: stateGlobal.resizeEdgeSize.value,
child: Container(
child: Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
body: DesktopTab(controller: tabController)),
),
);
}
}
class _InstallPageBody extends StatefulWidget {
const _InstallPageBody({Key? key}) : super(key: key);
@override
State<_InstallPageBody> createState() => _InstallPageBodyState();
}
class _InstallPageBodyState extends State<_InstallPageBody>
with WindowListener {
late final TextEditingController controller;
final RxBool startmenu = true.obs;
final RxBool desktopicon = true.obs;

View File

@ -53,6 +53,7 @@ enum DesktopTabType {
remoteScreen,
fileTransfer,
portForward,
install,
}
class DesktopTabState {
@ -249,8 +250,9 @@ class DesktopTab extends StatelessWidget {
this.unSelectedTabBackgroundColor,
}) : super(key: key) {
tabType = controller.tabType;
isMainWindow =
tabType == DesktopTabType.main || tabType == DesktopTabType.cm;
isMainWindow = tabType == DesktopTabType.main ||
tabType == DesktopTabType.cm ||
tabType == DesktopTabType.install;
}
static RxString labelGetterAlias(String peerId) {
@ -361,7 +363,8 @@ class DesktopTab extends StatelessWidget {
/// - hide single item when only has one item (home) on [DesktopTabPage].
bool isHideSingleItem() {
return state.value.tabs.length == 1 &&
controller.tabType == DesktopTabType.main;
(controller.tabType == DesktopTabType.main ||
controller.tabType == DesktopTabType.install);
}
Widget _buildBar() {
@ -524,8 +527,8 @@ class WindowActionPanelState extends State<WindowActionPanel>
}
void _setMaximize(bool maximize) {
stateGlobal.setMaximize(maximize);
setState(() {});
stateGlobal.setMaximize(maximize);
setState(() {});
}
@override
@ -759,7 +762,8 @@ class _ListView extends StatelessWidget {
/// - hide single item when only has one item (home) on [DesktopTabPage].
bool isHideSingleItem() {
return state.value.tabs.length == 1 &&
controller.tabType == DesktopTabType.main;
controller.tabType == DesktopTabType.main ||
controller.tabType == DesktopTabType.install;
}
@override

View File

@ -293,16 +293,19 @@ void runInstallPage() async {
await windowManager.ensureInitialized();
await initEnv(kAppTypeMain);
_runApp('', const InstallPage(), MyTheme.currentThemeMode());
windowManager.waitUntilReadyToShow(
WindowOptions(size: Size(800, 600), center: true), () async {
WindowOptions windowOptions =
getHiddenTitleBarWindowOptions(size: Size(800, 600), center: true);
windowManager.waitUntilReadyToShow(windowOptions, () async {
windowManager.show();
windowManager.focus();
windowManager.setOpacity(1);
windowManager.setAlignment(Alignment.center); // ensure
windowManager.setTitle(getWindowName());
});
}
WindowOptions getHiddenTitleBarWindowOptions({Size? size}) {
WindowOptions getHiddenTitleBarWindowOptions(
{Size? size, bool center = false}) {
var defaultTitleBarStyle = TitleBarStyle.hidden;
// we do not hide titlebar on win7 because of the frame overflow.
if (kUseCompatibleUiMode) {
@ -310,7 +313,7 @@ WindowOptions getHiddenTitleBarWindowOptions({Size? size}) {
}
return WindowOptions(
size: size,
center: false,
center: center,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: defaultTitleBarStyle,