mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-15 01:21:30 +03:00
opt: dark theme, add follow system mode
This commit is contained in:
@@ -205,22 +205,28 @@ class _GeneralState extends State<_General> {
|
||||
}
|
||||
|
||||
Widget theme() {
|
||||
change() {
|
||||
MyTheme.changeTo(!isDarkTheme());
|
||||
final current = MyTheme.getThemeModePreference().toShortString();
|
||||
onChanged(String value) {
|
||||
MyTheme.changeDarkMode(MyTheme.themeModeFromString(value));
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
return _Card(title: 'Theme', children: [
|
||||
GestureDetector(
|
||||
onTap: change,
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(value: isDarkTheme(), onChanged: (_) => change())
|
||||
.marginOnly(right: 5),
|
||||
Expanded(child: Text(translate('Dark Theme'))),
|
||||
],
|
||||
).marginOnly(left: _kCheckBoxLeftMargin),
|
||||
)
|
||||
_Radio<String>(context,
|
||||
value: "light",
|
||||
groupValue: current,
|
||||
label: "Light",
|
||||
onChanged: onChanged),
|
||||
_Radio<String>(context,
|
||||
value: "dark",
|
||||
groupValue: current,
|
||||
label: "Dark",
|
||||
onChanged: onChanged),
|
||||
_Radio<String>(context,
|
||||
value: "system",
|
||||
groupValue: current,
|
||||
label: "Follow System",
|
||||
onChanged: onChanged),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ class _PortForwardPageState extends State<PortForwardPage>
|
||||
height: _kRowHeight,
|
||||
decoration: BoxDecoration(
|
||||
color: index % 2 == 0
|
||||
? isDarkTheme()
|
||||
? MyTheme.currentThemeMode() == ThemeMode.dark
|
||||
? const Color(0xFF202020)
|
||||
: const Color(0xFFF4F5F6)
|
||||
: MyTheme.color(context).bg),
|
||||
|
||||
Reference in New Issue
Block a user