mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new & opt.: server page font size
This commit is contained in:
@@ -1424,6 +1424,18 @@ abstract class S {
|
|||||||
/// **'Test'**
|
/// **'Test'**
|
||||||
String get test;
|
String get test;
|
||||||
|
|
||||||
|
/// No description provided for @textScaler.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Text scaler'**
|
||||||
|
String get textScaler;
|
||||||
|
|
||||||
|
/// No description provided for @textScalerTip.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'1.0 => 100% (original size), only works on server page part of the font, not recommended to change.'**
|
||||||
|
String get textScalerTip;
|
||||||
|
|
||||||
/// No description provided for @theme.
|
/// No description provided for @theme.
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
|
|||||||
@@ -697,6 +697,12 @@ class SDe extends S {
|
|||||||
@override
|
@override
|
||||||
String get test => 'Prüfung';
|
String get test => 'Prüfung';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScaler => 'Skalierung der Schriftart';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScalerTip => '1.0 => 100% (Originalgröße), funktioniert nur auf der Serverseite Teil der Schrift, nicht empfohlen zu ändern.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get theme => 'Themen';
|
String get theme => 'Themen';
|
||||||
|
|
||||||
|
|||||||
@@ -697,6 +697,12 @@ class SEn extends S {
|
|||||||
@override
|
@override
|
||||||
String get test => 'Test';
|
String get test => 'Test';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScaler => 'Text scaler';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScalerTip => '1.0 => 100% (original size), only works on server page part of the font, not recommended to change.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get theme => 'Theme';
|
String get theme => 'Theme';
|
||||||
|
|
||||||
|
|||||||
@@ -697,6 +697,12 @@ class SId extends S {
|
|||||||
@override
|
@override
|
||||||
String get test => 'pengujian';
|
String get test => 'pengujian';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScaler => 'Penskalaan font';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScalerTip => '1.0 => 100% (ukuran asli), hanya berfungsi pada bagian halaman server font, tidak disarankan untuk diubah.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get theme => ' Tema';
|
String get theme => ' Tema';
|
||||||
|
|
||||||
|
|||||||
@@ -697,6 +697,12 @@ class SZh extends S {
|
|||||||
@override
|
@override
|
||||||
String get test => '测试';
|
String get test => '测试';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScaler => '字体缩放';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScalerTip => '1.0 => 100%(原大小),仅作用于服务器页面部分字体,不建议修改。';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get theme => '主题';
|
String get theme => '主题';
|
||||||
|
|
||||||
@@ -1501,6 +1507,12 @@ class SZhTw extends SZh {
|
|||||||
@override
|
@override
|
||||||
String get test => '測試';
|
String get test => '測試';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScaler => '字體縮放';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get textScalerTip => '1.0 => 100%(原大小),僅作用於伺服器頁面部分字體,不建議修改。';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get theme => '主題';
|
String get theme => '主題';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
// import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
extension MideaQueryX on MediaQueryData {
|
// extension MideaQueryX on MediaQueryData {
|
||||||
bool get useDoubleColumn => size.width > 639;
|
// bool get useDoubleColumn => size.width > 639;
|
||||||
}
|
// }
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ Future<ServerStatus> _getLinuxStatus(ServerStatusUpdateReq req) async {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final battery = StatusCmdType.battery.find(segments);
|
final battery = StatusCmdType.battery.find(segments);
|
||||||
if (battery.isNotEmpty && !battery.contains('No such')) {
|
if (battery.isNotEmpty && !battery.contains('/sys/class/power_supply')) {
|
||||||
req.ss.more[StatusCmdType.battery] = battery;
|
req.ss.more[StatusCmdType.battery] = battery;
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ abstract final class UIs {
|
|||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
);
|
);
|
||||||
static const textSize11Grey = TextStyle(color: Colors.grey, fontSize: 11);
|
static const textSize11Grey = TextStyle(color: Colors.grey, fontSize: 11);
|
||||||
|
static const text12 = TextStyle(fontSize: 12);
|
||||||
|
static const text12Bold = TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
);
|
||||||
|
static const text12Grey = TextStyle(color: Colors.grey, fontSize: 12);
|
||||||
static const textSize13 = TextStyle(fontSize: 13);
|
static const textSize13 = TextStyle(fontSize: 13);
|
||||||
static const textSize13Bold = TextStyle(
|
static const textSize13Bold = TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
|
|||||||
@@ -32,13 +32,6 @@ class SettingStore extends PersistentStore {
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Bigger for bigger font size
|
|
||||||
/// 1.0 means 100%
|
|
||||||
/// Warning: This may cause some UI issues
|
|
||||||
late final textFactor = property(
|
|
||||||
'textFactor',
|
|
||||||
1.0,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Lanch page idx
|
/// Lanch page idx
|
||||||
late final launchPage = property(
|
late final launchPage = property(
|
||||||
@@ -64,6 +57,14 @@ class SettingStore extends PersistentStore {
|
|||||||
|
|
||||||
// ------END------
|
// ------END------
|
||||||
|
|
||||||
|
/// Bigger for bigger font size
|
||||||
|
/// 1.0 means 100%
|
||||||
|
/// Warning: This may cause some UI issues
|
||||||
|
late final textFactor = property(
|
||||||
|
'textFactor',
|
||||||
|
1.0,
|
||||||
|
);
|
||||||
|
|
||||||
late final primaryColor = property(
|
late final primaryColor = property(
|
||||||
'primaryColor',
|
'primaryColor',
|
||||||
4287106639,
|
4287106639,
|
||||||
|
|||||||
@@ -221,6 +221,8 @@
|
|||||||
"temperature": "Temperatur",
|
"temperature": "Temperatur",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "Prüfung",
|
"test": "Prüfung",
|
||||||
|
"textScaler": "Skalierung der Schriftart",
|
||||||
|
"textScalerTip": "1.0 => 100% (Originalgröße), funktioniert nur auf der Serverseite Teil der Schrift, nicht empfohlen zu ändern.",
|
||||||
"theme": "Themen",
|
"theme": "Themen",
|
||||||
"themeMode": "Themen-Modus",
|
"themeMode": "Themen-Modus",
|
||||||
"times": "x",
|
"times": "x",
|
||||||
|
|||||||
@@ -221,6 +221,8 @@
|
|||||||
"temperature": "Temperature",
|
"temperature": "Temperature",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "Test",
|
"test": "Test",
|
||||||
|
"textScaler": "Text scaler",
|
||||||
|
"textScalerTip": "1.0 => 100% (original size), only works on server page part of the font, not recommended to change.",
|
||||||
"theme": "Theme",
|
"theme": "Theme",
|
||||||
"themeMode": "Theme mode",
|
"themeMode": "Theme mode",
|
||||||
"times": "Times",
|
"times": "Times",
|
||||||
|
|||||||
@@ -221,6 +221,8 @@
|
|||||||
"temperature": "Suhu",
|
"temperature": "Suhu",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "pengujian",
|
"test": "pengujian",
|
||||||
|
"textScaler": "Penskalaan font",
|
||||||
|
"textScalerTip": "1.0 => 100% (ukuran asli), hanya berfungsi pada bagian halaman server font, tidak disarankan untuk diubah.",
|
||||||
"theme": " Tema",
|
"theme": " Tema",
|
||||||
"themeMode": "Mode tema",
|
"themeMode": "Mode tema",
|
||||||
"times": "Waktu",
|
"times": "Waktu",
|
||||||
|
|||||||
@@ -221,6 +221,8 @@
|
|||||||
"temperature": "温度",
|
"temperature": "温度",
|
||||||
"terminal": "终端",
|
"terminal": "终端",
|
||||||
"test": "测试",
|
"test": "测试",
|
||||||
|
"textScaler": "字体缩放",
|
||||||
|
"textScalerTip": "1.0 => 100%(原大小),仅作用于服务器页面部分字体,不建议修改。",
|
||||||
"theme": "主题",
|
"theme": "主题",
|
||||||
"themeMode": "主题模式",
|
"themeMode": "主题模式",
|
||||||
"times": "次",
|
"times": "次",
|
||||||
|
|||||||
@@ -221,6 +221,8 @@
|
|||||||
"temperature": "溫度",
|
"temperature": "溫度",
|
||||||
"terminal": "终端機",
|
"terminal": "终端機",
|
||||||
"test": "測試",
|
"test": "測試",
|
||||||
|
"textScaler": "字體縮放",
|
||||||
|
"textScalerTip": "1.0 => 100%(原大小),僅作用於伺服器頁面部分字體,不建議修改。",
|
||||||
"theme": "主題",
|
"theme": "主題",
|
||||||
"themeMode": "主題模式",
|
"themeMode": "主題模式",
|
||||||
"times": "次",
|
"times": "次",
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ class _HomePageState extends State<HomePage>
|
|||||||
child: Text(
|
child: Text(
|
||||||
'${BuildData.name}\n$_versionStr',
|
'${BuildData.name}\n$_versionStr',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: UIs.textSize13,
|
style: UIs.textSize15,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 37),
|
const SizedBox(height: 37),
|
||||||
|
|||||||
@@ -120,6 +120,31 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildUpTimeAndSys(ServerStatus ss) {
|
||||||
|
return CardX(
|
||||||
|
child: ExpandTile(
|
||||||
|
leading: const Icon(Icons.computer),
|
||||||
|
initiallyExpanded: ss.more.entries.length < 7,
|
||||||
|
title: Text(l10n.about),
|
||||||
|
childrenPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 17,
|
||||||
|
vertical: 11,
|
||||||
|
),
|
||||||
|
children: ss.more.entries
|
||||||
|
.map(
|
||||||
|
(e) => Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(e.key.i18n, style: UIs.textSize15),
|
||||||
|
Text(e.value, style: UIs.textSize13Grey)
|
||||||
|
],
|
||||||
|
).padding(const EdgeInsets.symmetric(vertical: 2)),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildCPUView(ServerStatus ss) {
|
Widget _buildCPUView(ServerStatus ss) {
|
||||||
final percent = ss.cpu.usedPercent(coreIdx: 0).toInt();
|
final percent = ss.cpu.usedPercent(coreIdx: 0).toInt();
|
||||||
final details = [
|
final details = [
|
||||||
@@ -165,12 +190,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${percent.toStringAsFixed(1)}%',
|
'${percent.toStringAsFixed(1)}%',
|
||||||
style: const TextStyle(fontSize: 13),
|
style: UIs.text12,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
timeType,
|
timeType,
|
||||||
style: const TextStyle(fontSize: 10, color: Colors.grey),
|
style: UIs.text12Grey,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -202,31 +227,6 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildUpTimeAndSys(ServerStatus ss) {
|
|
||||||
return CardX(
|
|
||||||
child: ExpandTile(
|
|
||||||
leading: const Icon(Icons.computer),
|
|
||||||
initiallyExpanded: ss.more.entries.length < 7,
|
|
||||||
title: Text(l10n.about),
|
|
||||||
childrenPadding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 17,
|
|
||||||
vertical: 7,
|
|
||||||
),
|
|
||||||
children: ss.more.entries
|
|
||||||
.map(
|
|
||||||
(e) => Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(e.key.i18n, style: UIs.textSize13),
|
|
||||||
Text(e.value, style: UIs.textSize11Grey)
|
|
||||||
],
|
|
||||||
).padding(const EdgeInsets.symmetric(vertical: 1)),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildMemView(ServerStatus ss) {
|
Widget _buildMemView(ServerStatus ss) {
|
||||||
final free = ss.mem.free / ss.mem.total * 100;
|
final free = ss.mem.free / ss.mem.total * 100;
|
||||||
final avail = ss.mem.availPercent * 100;
|
final avail = ss.mem.availPercent * 100;
|
||||||
@@ -333,18 +333,17 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
title: Text(item.name, style: UIs.textSize13),
|
title: Text(item.name, style: UIs.textSize13),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'${item.power} - ${item.temp} °C\n${mem.used} / ${mem.total} ${mem.unit} - ${item.fanSpeed} RPM',
|
'${item.power} - ${item.temp} °C\n${mem.used} / ${mem.total} ${mem.unit} - ${item.fanSpeed} RPM',
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.text12Grey,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.only(left: 17, right: 17),
|
contentPadding: const EdgeInsets.only(left: 17, right: 17),
|
||||||
trailing: SizedBox(
|
trailing: Row(
|
||||||
width: 67,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${item.percent}%',
|
'${item.percent}%',
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.text12Grey,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -378,7 +377,6 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,14 +384,14 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
process.name,
|
process.name,
|
||||||
style: UIs.textSize11,
|
style: UIs.text12,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'PID: ${process.pid} - ${process.memory} MiB',
|
'PID: ${process.pid} - ${process.memory} MiB',
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.text12Grey,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
),
|
),
|
||||||
trailing: const Icon(Icons.info_outline, size: 17).tap(
|
trailing: const Icon(Icons.info_outline, size: 17).tap(
|
||||||
@@ -453,21 +451,29 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
if (read == null || write == null) return use;
|
if (read == null || write == null) return use;
|
||||||
return '$use\n${l10n.read} $read | ${l10n.write} $write';
|
return '$use\n${l10n.read} $read | ${l10n.write} $write';
|
||||||
}();
|
}();
|
||||||
return ListTile(
|
return Row(
|
||||||
title: Text(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
disk.dev,
|
disk.dev,
|
||||||
style: UIs.textSize11Bold,
|
style: UIs.text12Bold,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 17),
|
Text(
|
||||||
subtitle: Text(
|
|
||||||
text,
|
text,
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.text12Grey,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
trailing: SizedBox(
|
SizedBox(
|
||||||
height: 37,
|
height: 41,
|
||||||
width: 37,
|
width: 41,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -477,11 +483,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
backgroundColor: DynamicColors.progress.resolve(context),
|
backgroundColor: DynamicColors.progress.resolve(context),
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
Text('${disk.usedPercent}%', style: UIs.textSize9Grey)
|
Text('${disk.usedPercent}%', style: UIs.textSize13Grey)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
);
|
],
|
||||||
|
).padding(const EdgeInsets.symmetric(horizontal: 17, vertical: 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNetView(ServerStatus ss) {
|
Widget _buildNetView(ServerStatus ss) {
|
||||||
@@ -491,7 +498,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
children.add(Center(
|
children.add(Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
l10n.noInterface,
|
l10n.noInterface,
|
||||||
style: const TextStyle(color: Colors.grey, fontSize: 13),
|
style: UIs.textSize13Grey,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
@@ -524,7 +531,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
UIs.width7,
|
UIs.width7,
|
||||||
Text(
|
Text(
|
||||||
_netSortType.name,
|
_netSortType.name,
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.textSize13Grey,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -542,7 +549,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
|
|
||||||
Widget _buildNetSpeedItem(NetSpeed ns, String device) {
|
Widget _buildNetSpeedItem(NetSpeed ns, String device) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 11, horizontal: 17),
|
padding: const EdgeInsets.symmetric(vertical: 7, horizontal: 17),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@@ -551,7 +558,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
device,
|
device,
|
||||||
style: UIs.textSize11Bold,
|
style: UIs.text12Bold,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.fade,
|
overflow: TextOverflow.fade,
|
||||||
@@ -559,7 +566,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${ns.sizeIn(device: device)} | ${ns.sizeOut(device: device)}',
|
'${ns.sizeIn(device: device)} | ${ns.sizeOut(device: device)}',
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.text12Grey,
|
||||||
textScaler: _textFactor,
|
textScaler: _textFactor,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -569,7 +576,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
child: Text(
|
child: Text(
|
||||||
'↑ ${ns.speedOut(device: device)}\n↓ ${ns.speedIn(device: device)}',
|
'↑ ${ns.speedOut(device: device)}\n↓ ${ns.speedIn(device: device)}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.textSize13Grey,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -586,7 +593,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
title: Text(l10n.temperature),
|
title: Text(l10n.temperature),
|
||||||
leading: const Icon(Icons.ac_unit, size: 17),
|
leading: const Icon(Icons.ac_unit, size: 17),
|
||||||
initiallyExpanded: ss.temps.devices.length <= 7,
|
initiallyExpanded: ss.temps.devices.length <= 7,
|
||||||
childrenPadding: EdgeInsets.zero,
|
childrenPadding: const EdgeInsets.only(bottom: 7),
|
||||||
children: ss.temps.devices
|
children: ss.temps.devices
|
||||||
.map((key) => _buildTemperatureItem(key, ss.temps.get(key)))
|
.map((key) => _buildTemperatureItem(key, ss.temps.get(key)))
|
||||||
.toList(),
|
.toList(),
|
||||||
@@ -596,12 +603,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
|
|
||||||
Widget _buildTemperatureItem(String key, double? val) {
|
Widget _buildTemperatureItem(String key, double? val) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 13),
|
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 5),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(key, style: UIs.textSize13),
|
Text(key, style: UIs.textSize15),
|
||||||
Text('${val?.toStringAsFixed(1)}°C', style: UIs.textSize11Grey),
|
Text('${val?.toStringAsFixed(1)}°C', style: UIs.textSize13Grey),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:toolbox/core/extension/context/common.dart';
|
import 'package:toolbox/core/extension/context/common.dart';
|
||||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||||
import 'package:toolbox/core/extension/context/locale.dart';
|
import 'package:toolbox/core/extension/context/locale.dart';
|
||||||
import 'package:toolbox/core/extension/media_queryx.dart';
|
|
||||||
import 'package:toolbox/core/extension/ssh_client.dart';
|
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||||
import 'package:toolbox/core/extension/widget.dart';
|
import 'package:toolbox/core/extension/widget.dart';
|
||||||
import 'package:toolbox/core/utils/platform/base.dart';
|
import 'package:toolbox/core/utils/platform/base.dart';
|
||||||
@@ -40,16 +39,21 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
|
with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
|
|
||||||
|
late double _textFactorDouble;
|
||||||
|
late TextScaler _textFactor;
|
||||||
|
|
||||||
final _cardsStatus = <String, _CardNotifier>{};
|
final _cardsStatus = <String, _CardNotifier>{};
|
||||||
|
|
||||||
String? _tag;
|
String? _tag;
|
||||||
bool _useDoubleColumn = false;
|
// bool _useDoubleColumn = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_useDoubleColumn = _media.useDoubleColumn;
|
// _useDoubleColumn = _media.useDoubleColumn;
|
||||||
|
_textFactorDouble = Stores.setting.textFactor.fetch();
|
||||||
|
_textFactor = TextScaler.linear(_textFactorDouble);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -57,7 +61,14 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
super.build(context);
|
super.build(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: _buildTagsSwitcher(Pros.server),
|
appBar: _buildTagsSwitcher(Pros.server),
|
||||||
body: _buildBody(),
|
body: ValueBuilder(
|
||||||
|
listenable: Stores.setting.textFactor.listenable(),
|
||||||
|
build: () {
|
||||||
|
_textFactorDouble = Stores.setting.textFactor.fetch();
|
||||||
|
_textFactor = TextScaler.linear(_textFactorDouble);
|
||||||
|
return _buildBody();
|
||||||
|
},
|
||||||
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () => AppRoute.serverEdit().go(context),
|
onPressed: () => AppRoute.serverEdit().go(context),
|
||||||
tooltip: l10n.addAServer,
|
tooltip: l10n.addAServer,
|
||||||
@@ -163,7 +174,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
onLongTap: () {
|
onLongTap: () {
|
||||||
if (srv.state == ServerState.finished) {
|
if (srv.state == ServerState.finished) {
|
||||||
final id = srv.spi.id;
|
final id = srv.spi.id;
|
||||||
final cardStatus = getCardNoti(id);
|
final cardStatus = _getCardNoti(id);
|
||||||
cardStatus.value = cardStatus.value.copyWith(
|
cardStatus.value = cardStatus.value.copyWith(
|
||||||
flip: !cardStatus.value.flip,
|
flip: !cardStatus.value.flip,
|
||||||
);
|
);
|
||||||
@@ -175,18 +186,18 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _wrapWithSizedbox(Widget child) {
|
/// The child's width mat not equal to 1/4 of the screen width,
|
||||||
|
/// so we need to wrap it with a SizedBox.
|
||||||
|
Widget _wrapWithSizedbox(Widget child, [bool circle = false]) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: _useDoubleColumn
|
width: (_media.size.width - 74) / (circle ? 4 : 4.3),
|
||||||
? (_media.size.width - 137) / 8
|
|
||||||
: (_media.size.width - 74) / 4,
|
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRealServerCard(Server srv) {
|
Widget _buildRealServerCard(Server srv) {
|
||||||
final id = srv.spi.id;
|
final id = srv.spi.id;
|
||||||
final cardStatus = getCardNoti(id);
|
final cardStatus = _getCardNoti(id);
|
||||||
final title = _buildServerCardTitle(srv.status, srv.state, srv.spi);
|
final title = _buildServerCardTitle(srv.status, srv.state, srv.spi);
|
||||||
|
|
||||||
return ValueBuilder(
|
return ValueBuilder(
|
||||||
@@ -284,8 +295,8 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
_wrapWithSizedbox(_buildPercentCircle(ss.cpu.usedPercent())),
|
_wrapWithSizedbox(_buildPercentCircle(ss.cpu.usedPercent()), true),
|
||||||
_wrapWithSizedbox(_buildPercentCircle(ss.mem.usedPercent * 100)),
|
_wrapWithSizedbox(_buildPercentCircle(ss.mem.usedPercent * 100), true),
|
||||||
_wrapWithSizedbox(_buildNet(ss, spi.id)),
|
_wrapWithSizedbox(_buildNet(ss, spi.id)),
|
||||||
_wrapWithSizedbox(_buildDisk(ss, spi.id)),
|
_wrapWithSizedbox(_buildDisk(ss, spi.id)),
|
||||||
],
|
],
|
||||||
@@ -346,7 +357,10 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
spi.name,
|
spi.name,
|
||||||
style: UIs.textSize13Bold,
|
style: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const Icon(
|
const Icon(
|
||||||
Icons.keyboard_arrow_right,
|
Icons.keyboard_arrow_right,
|
||||||
@@ -378,13 +392,13 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
onTap: () => _showFailReason(ss),
|
onTap: () => _showFailReason(ss),
|
||||||
child: Text(
|
child: Text(
|
||||||
l10n.viewErr,
|
l10n.viewErr,
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.textSize13Grey,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Text(
|
return Text(
|
||||||
topRightStr,
|
topRightStr,
|
||||||
style: UIs.textSize11Grey,
|
style: UIs.textSize13Grey,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +418,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDisk(ServerStatus ss, String id) {
|
Widget _buildDisk(ServerStatus ss, String id) {
|
||||||
final cardNoti = getCardNoti(id);
|
final cardNoti = _getCardNoti(id);
|
||||||
return ValueBuilder(
|
return ValueBuilder(
|
||||||
listenable: cardNoti,
|
listenable: cardNoti,
|
||||||
build: () {
|
build: () {
|
||||||
@@ -433,7 +447,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNet(ServerStatus ss, String id) {
|
Widget _buildNet(ServerStatus ss, String id) {
|
||||||
final cardNoti = getCardNoti(id);
|
final cardNoti = _getCardNoti(id);
|
||||||
final type = cardNoti.value.net ?? Stores.setting.netViewType.fetch();
|
final type = cardNoti.value.net ?? Stores.setting.netViewType.fetch();
|
||||||
final (a, b) = type.build(ss);
|
final (a, b) = type.build(ss);
|
||||||
return AnimatedSwitcher(
|
return AnimatedSwitcher(
|
||||||
@@ -460,17 +474,18 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}) {
|
}) {
|
||||||
final child = Column(
|
final child = Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 5),
|
|
||||||
Text(
|
Text(
|
||||||
up,
|
up,
|
||||||
style: UIs.textSize9Grey,
|
style: const TextStyle(fontSize: 10, color: Colors.grey),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
textScaler: _textFactor,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 3),
|
const SizedBox(height: 3),
|
||||||
Text(
|
Text(
|
||||||
down,
|
down,
|
||||||
style: UIs.textSize9Grey,
|
style: const TextStyle(fontSize: 10, color: Colors.grey),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
textScaler: _textFactor,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -493,8 +508,8 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
progressColor: primaryColor,
|
progressColor: primaryColor,
|
||||||
progressNumber: percent,
|
progressNumber: percent,
|
||||||
maxNumber: 100,
|
maxNumber: 100,
|
||||||
width: 53,
|
width: 57,
|
||||||
height: 53,
|
height: 57,
|
||||||
animationDuration: const Duration(milliseconds: 777),
|
animationDuration: const Duration(milliseconds: 777),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -503,7 +518,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
child: Text(
|
child: Text(
|
||||||
'${percent.toStringAsFixed(1)}%',
|
'${percent.toStringAsFixed(1)}%',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: UIs.textSize11,
|
style: UIs.textSize13,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -556,7 +571,8 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double _calcCardHeight(ServerState cs, bool flip) {
|
double? _calcCardHeight(ServerState cs, bool flip) {
|
||||||
|
if (_textFactorDouble != 1.0) return null;
|
||||||
if (cs != ServerState.finished) {
|
if (cs != ServerState.finished) {
|
||||||
return 23.0;
|
return 23.0;
|
||||||
}
|
}
|
||||||
@@ -566,9 +582,9 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
if (Stores.setting.moveOutServerTabFuncBtns.fetch() &&
|
if (Stores.setting.moveOutServerTabFuncBtns.fetch() &&
|
||||||
// Discussion #146
|
// Discussion #146
|
||||||
!Stores.setting.serverTabUseOldUI.fetch()) {
|
!Stores.setting.serverTabUseOldUI.fetch()) {
|
||||||
return 132;
|
return 135;
|
||||||
}
|
}
|
||||||
return 107;
|
return 105;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _askFor({
|
void _askFor({
|
||||||
@@ -591,7 +607,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_CardNotifier getCardNoti(String id) => _cardsStatus.putIfAbsent(
|
_CardNotifier _getCardNoti(String id) => _cardsStatus.putIfAbsent(
|
||||||
id,
|
id,
|
||||||
() => _CardNotifier(const _CardStatus()),
|
() => _CardNotifier(const _CardStatus()),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
final _keyboardType = ValueNotifier(0);
|
final _keyboardType = ValueNotifier(0);
|
||||||
final _rotateQuarter = ValueNotifier(0);
|
final _rotateQuarter = ValueNotifier(0);
|
||||||
final _netViewType = ValueNotifier(NetViewType.speed);
|
final _netViewType = ValueNotifier(NetViewType.speed);
|
||||||
|
late final _textScaler = ValueNotifier(_setting.textFactor.fetch());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
@@ -165,7 +166,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_buildTitle(l10n.editor),
|
_buildTitle(l10n.editor),
|
||||||
_buildEditor(),
|
_buildEditor(),
|
||||||
if (isDesktop) _buildTitle(l10n.fullScreen),
|
if (isDesktop) _buildTitle(l10n.fullScreen),
|
||||||
if (isDesktop) _buildFullScreen(),
|
if (!isDesktop) _buildFullScreen(),
|
||||||
const SizedBox(height: 37),
|
const SizedBox(height: 37),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -222,6 +223,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_buildMaxRetry(),
|
_buildMaxRetry(),
|
||||||
//_buildDiskIgnorePath(),
|
//_buildDiskIgnorePath(),
|
||||||
_buildDeleteServers(),
|
_buildDeleteServers(),
|
||||||
|
_buildTextScaler(),
|
||||||
//if (isDesktop) _buildDoubleColumnServersPage(),
|
//if (isDesktop) _buildDoubleColumnServersPage(),
|
||||||
].map((e) => CardX(child: e)).toList(),
|
].map((e) => CardX(child: e)).toList(),
|
||||||
);
|
);
|
||||||
@@ -945,6 +947,50 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildTextScaler() {
|
||||||
|
final ctrl = TextEditingController(text: _textScaler.value.toString());
|
||||||
|
return ListTile(
|
||||||
|
title: Text(l10n.textScaler),
|
||||||
|
subtitle: Text(l10n.textScalerTip, style: UIs.textGrey),
|
||||||
|
trailing: ValueBuilder(
|
||||||
|
listenable: _textScaler,
|
||||||
|
build: () => Text(
|
||||||
|
_textScaler.value.toString(),
|
||||||
|
style: UIs.textSize15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () => context.showRoundDialog(
|
||||||
|
title: Text(l10n.textScaler),
|
||||||
|
child: Input(
|
||||||
|
autoFocus: true,
|
||||||
|
type: TextInputType.number,
|
||||||
|
hint: '1.0',
|
||||||
|
icon: Icons.format_size,
|
||||||
|
controller: ctrl,
|
||||||
|
onSubmitted: _onSaveTextScaler,
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => _onSaveTextScaler(ctrl.text),
|
||||||
|
child: Text(l10n.ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onSaveTextScaler(String s) {
|
||||||
|
final val = double.tryParse(s);
|
||||||
|
if (val == null) {
|
||||||
|
context.showSnackBar(l10n.failed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_textScaler.value = val;
|
||||||
|
_setting.textFactor.put(val);
|
||||||
|
RebuildNodes.app.rebuild();
|
||||||
|
context.pop();
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildServerFuncBtns() {
|
Widget _buildServerFuncBtns() {
|
||||||
return ExpandTile(
|
return ExpandTile(
|
||||||
title: Text(l10n.serverFuncBtns),
|
title: Text(l10n.serverFuncBtns),
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 8),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Transform.translate(
|
icon: Transform.translate(
|
||||||
offset: const Offset(0, -3.5),
|
offset: const Offset(0, -3.5),
|
||||||
@@ -58,7 +57,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
onPressed: () => windowManager.minimize(),
|
onPressed: () => windowManager.minimize(),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.crop_square, size: 13),
|
icon: const Icon(Icons.crop_square, size: 13),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
@@ -69,7 +67,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.close, size: 14),
|
icon: const Icon(Icons.close, size: 14),
|
||||||
onPressed: () => windowManager.close(),
|
onPressed: () => windowManager.close(),
|
||||||
|
|||||||
Reference in New Issue
Block a user