new & opt.: server page font size

This commit is contained in:
lollipopkit
2023-12-19 14:27:59 +08:00
parent 0d1a720f03
commit 2b1b6c7afb
19 changed files with 274 additions and 149 deletions

View File

@@ -1424,6 +1424,18 @@ abstract class S {
/// **'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.
///
/// In en, this message translates to:

View File

@@ -697,6 +697,12 @@ class SDe extends S {
@override
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
String get theme => 'Themen';

View File

@@ -697,6 +697,12 @@ class SEn extends S {
@override
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
String get theme => 'Theme';

View File

@@ -697,6 +697,12 @@ class SId extends S {
@override
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
String get theme => ' Tema';

View File

@@ -697,6 +697,12 @@ class SZh extends S {
@override
String get test => '测试';
@override
String get textScaler => '字体缩放';
@override
String get textScalerTip => '1.0 => 100%(原大小),仅作用于服务器页面部分字体,不建议修改。';
@override
String get theme => '主题';
@@ -1501,6 +1507,12 @@ class SZhTw extends SZh {
@override
String get test => '測試';
@override
String get textScaler => '字體縮放';
@override
String get textScalerTip => '1.0 => 100%(原大小),僅作用於伺服器頁面部分字體,不建議修改。';
@override
String get theme => '主題';

View File

@@ -1,5 +1,5 @@
import 'package:flutter/widgets.dart';
// import 'package:flutter/widgets.dart';
extension MideaQueryX on MediaQueryData {
bool get useDoubleColumn => size.width > 639;
}
// extension MideaQueryX on MediaQueryData {
// bool get useDoubleColumn => size.width > 639;
// }

View File

@@ -129,7 +129,7 @@ Future<ServerStatus> _getLinuxStatus(ServerStatusUpdateReq req) async {
try {
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;
}
} catch (e, s) {

View File

@@ -10,6 +10,12 @@ abstract final class UIs {
fontWeight: FontWeight.w500,
);
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 textSize13Bold = TextStyle(
fontSize: 13,

View File

@@ -32,13 +32,6 @@ class SettingStore extends PersistentStore {
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
late final launchPage = property(
@@ -64,6 +57,14 @@ class SettingStore extends PersistentStore {
// ------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(
'primaryColor',
4287106639,

View File

@@ -221,6 +221,8 @@
"temperature": "Temperatur",
"terminal": "Terminal",
"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",
"themeMode": "Themen-Modus",
"times": "x",

View File

@@ -221,6 +221,8 @@
"temperature": "Temperature",
"terminal": "Terminal",
"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",
"themeMode": "Theme mode",
"times": "Times",

View File

@@ -221,6 +221,8 @@
"temperature": "Suhu",
"terminal": "Terminal",
"test": "pengujian",
"textScaler": "Penskalaan font",
"textScalerTip": "1.0 => 100% (ukuran asli), hanya berfungsi pada bagian halaman server font, tidak disarankan untuk diubah.",
"theme": " Tema",
"themeMode": "Mode tema",
"times": "Waktu",

View File

@@ -221,6 +221,8 @@
"temperature": "温度",
"terminal": "终端",
"test": "测试",
"textScaler": "字体缩放",
"textScalerTip": "1.0 => 100%(原大小),仅作用于服务器页面部分字体,不建议修改。",
"theme": "主题",
"themeMode": "主题模式",
"times": "次",

View File

@@ -221,6 +221,8 @@
"temperature": "溫度",
"terminal": "终端機",
"test": "測試",
"textScaler": "字體縮放",
"textScalerTip": "1.0 => 100%(原大小),僅作用於伺服器頁面部分字體,不建議修改。",
"theme": "主題",
"themeMode": "主題模式",
"times": "次",

View File

@@ -200,7 +200,7 @@ class _HomePageState extends State<HomePage>
child: Text(
'${BuildData.name}\n$_versionStr',
textAlign: TextAlign.center,
style: UIs.textSize13,
style: UIs.textSize15,
),
),
const SizedBox(height: 37),

View File

@@ -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) {
final percent = ss.cpu.usedPercent(coreIdx: 0).toInt();
final details = [
@@ -165,12 +190,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
children: [
Text(
'${percent.toStringAsFixed(1)}%',
style: const TextStyle(fontSize: 13),
style: UIs.text12,
textScaler: _textFactor,
),
Text(
timeType,
style: const TextStyle(fontSize: 10, color: Colors.grey),
style: UIs.text12Grey,
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) {
final free = ss.mem.free / ss.mem.total * 100;
final avail = ss.mem.availPercent * 100;
@@ -333,51 +333,49 @@ class _ServerDetailPageState extends State<ServerDetailPage>
title: Text(item.name, style: UIs.textSize13),
subtitle: Text(
'${item.power} - ${item.temp} °C\n${mem.used} / ${mem.total} ${mem.unit} - ${item.fanSpeed} RPM',
style: UIs.textSize11Grey,
style: UIs.text12Grey,
textScaler: _textFactor,
),
contentPadding: const EdgeInsets.only(left: 17, right: 17),
trailing: SizedBox(
width: 67,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
'${item.percent}%',
style: UIs.textSize11Grey,
textScaler: _textFactor,
),
IconButton(
onPressed: () {
final height = () {
if (processes.length > 5) {
return 5 * 47.0;
}
return processes.length * 47.0;
}();
context.showRoundDialog(
title: Text(item.name),
child: SizedBox(
width: double.maxFinite,
height: height,
child: ListView.builder(
itemCount: processes.length,
itemBuilder: (_, idx) =>
_buildGpuProcessItem(processes[idx]),
),
trailing: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'${item.percent}%',
style: UIs.text12Grey,
textScaler: _textFactor,
),
IconButton(
onPressed: () {
final height = () {
if (processes.length > 5) {
return 5 * 47.0;
}
return processes.length * 47.0;
}();
context.showRoundDialog(
title: Text(item.name),
child: SizedBox(
width: double.maxFinite,
height: height,
child: ListView.builder(
itemCount: processes.length,
itemBuilder: (_, idx) =>
_buildGpuProcessItem(processes[idx]),
),
actions: [
TextButton(
onPressed: () => context.pop(),
child: Text(l10n.close),
)
],
);
},
icon: const Icon(Icons.info_outline, size: 17),
),
],
),
),
actions: [
TextButton(
onPressed: () => context.pop(),
child: Text(l10n.close),
)
],
);
},
icon: const Icon(Icons.info_outline, size: 17),
),
],
),
);
}
@@ -386,14 +384,14 @@ class _ServerDetailPageState extends State<ServerDetailPage>
return ListTile(
title: Text(
process.name,
style: UIs.textSize11,
style: UIs.text12,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textScaler: _textFactor,
),
subtitle: Text(
'PID: ${process.pid} - ${process.memory} MiB',
style: UIs.textSize11Grey,
style: UIs.text12Grey,
textScaler: _textFactor,
),
trailing: const Icon(Icons.info_outline, size: 17).tap(
@@ -453,35 +451,44 @@ class _ServerDetailPageState extends State<ServerDetailPage>
if (read == null || write == null) return use;
return '$use\n${l10n.read} $read | ${l10n.write} $write';
}();
return ListTile(
title: Text(
disk.dev,
style: UIs.textSize11Bold,
textScaler: _textFactor,
),
contentPadding: const EdgeInsets.symmetric(horizontal: 17),
subtitle: Text(
text,
style: UIs.textSize11Grey,
textScaler: _textFactor,
),
trailing: SizedBox(
height: 37,
width: 37,
child: Stack(
alignment: Alignment.center,
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CircularProgressIndicator(
value: disk.usedPercent / 100,
strokeWidth: 5,
backgroundColor: DynamicColors.progress.resolve(context),
color: primaryColor,
Text(
disk.dev,
style: UIs.text12Bold,
textScaler: _textFactor,
),
Text('${disk.usedPercent}%', style: UIs.textSize9Grey)
Text(
text,
style: UIs.text12Grey,
textScaler: _textFactor,
)
],
),
),
);
SizedBox(
height: 41,
width: 41,
child: Stack(
alignment: Alignment.center,
children: [
CircularProgressIndicator(
value: disk.usedPercent / 100,
strokeWidth: 5,
backgroundColor: DynamicColors.progress.resolve(context),
color: primaryColor,
),
Text('${disk.usedPercent}%', style: UIs.textSize13Grey)
],
),
)
],
).padding(const EdgeInsets.symmetric(horizontal: 17, vertical: 5));
}
Widget _buildNetView(ServerStatus ss) {
@@ -491,7 +498,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
children.add(Center(
child: Text(
l10n.noInterface,
style: const TextStyle(color: Colors.grey, fontSize: 13),
style: UIs.textSize13Grey,
),
));
} else {
@@ -524,7 +531,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
UIs.width7,
Text(
_netSortType.name,
style: UIs.textSize11Grey,
style: UIs.textSize13Grey,
),
],
),
@@ -542,7 +549,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
Widget _buildNetSpeedItem(NetSpeed ns, String device) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 11, horizontal: 17),
padding: const EdgeInsets.symmetric(vertical: 7, horizontal: 17),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -551,7 +558,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
children: [
Text(
device,
style: UIs.textSize11Bold,
style: UIs.text12Bold,
textScaler: _textFactor,
maxLines: 1,
overflow: TextOverflow.fade,
@@ -559,7 +566,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
),
Text(
'${ns.sizeIn(device: device)} | ${ns.sizeOut(device: device)}',
style: UIs.textSize11Grey,
style: UIs.text12Grey,
textScaler: _textFactor,
)
],
@@ -569,7 +576,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
child: Text(
'${ns.speedOut(device: device)}\n${ns.speedIn(device: device)}',
textAlign: TextAlign.end,
style: UIs.textSize11Grey,
style: UIs.textSize13Grey,
),
)
],
@@ -586,7 +593,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
title: Text(l10n.temperature),
leading: const Icon(Icons.ac_unit, size: 17),
initiallyExpanded: ss.temps.devices.length <= 7,
childrenPadding: EdgeInsets.zero,
childrenPadding: const EdgeInsets.only(bottom: 7),
children: ss.temps.devices
.map((key) => _buildTemperatureItem(key, ss.temps.get(key)))
.toList(),
@@ -596,12 +603,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
Widget _buildTemperatureItem(String key, double? val) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 13),
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(key, style: UIs.textSize13),
Text('${val?.toStringAsFixed(1)}°C', style: UIs.textSize11Grey),
Text(key, style: UIs.textSize15),
Text('${val?.toStringAsFixed(1)}°C', style: UIs.textSize13Grey),
],
),
);

View File

@@ -6,7 +6,6 @@ import 'package:provider/provider.dart';
import 'package:toolbox/core/extension/context/common.dart';
import 'package:toolbox/core/extension/context/dialog.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/widget.dart';
import 'package:toolbox/core/utils/platform/base.dart';
@@ -40,16 +39,21 @@ class _ServerPageState extends State<ServerPage>
with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
late MediaQueryData _media;
late double _textFactorDouble;
late TextScaler _textFactor;
final _cardsStatus = <String, _CardNotifier>{};
String? _tag;
bool _useDoubleColumn = false;
// bool _useDoubleColumn = false;
@override
void didChangeDependencies() {
super.didChangeDependencies();
_media = MediaQuery.of(context);
_useDoubleColumn = _media.useDoubleColumn;
// _useDoubleColumn = _media.useDoubleColumn;
_textFactorDouble = Stores.setting.textFactor.fetch();
_textFactor = TextScaler.linear(_textFactorDouble);
}
@override
@@ -57,7 +61,14 @@ class _ServerPageState extends State<ServerPage>
super.build(context);
return Scaffold(
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(
onPressed: () => AppRoute.serverEdit().go(context),
tooltip: l10n.addAServer,
@@ -163,7 +174,7 @@ class _ServerPageState extends State<ServerPage>
onLongTap: () {
if (srv.state == ServerState.finished) {
final id = srv.spi.id;
final cardStatus = getCardNoti(id);
final cardStatus = _getCardNoti(id);
cardStatus.value = cardStatus.value.copyWith(
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(
width: _useDoubleColumn
? (_media.size.width - 137) / 8
: (_media.size.width - 74) / 4,
width: (_media.size.width - 74) / (circle ? 4 : 4.3),
child: child,
);
}
Widget _buildRealServerCard(Server srv) {
final id = srv.spi.id;
final cardStatus = getCardNoti(id);
final cardStatus = _getCardNoti(id);
final title = _buildServerCardTitle(srv.status, srv.state, srv.spi);
return ValueBuilder(
@@ -284,8 +295,8 @@ class _ServerPageState extends State<ServerPage>
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_wrapWithSizedbox(_buildPercentCircle(ss.cpu.usedPercent())),
_wrapWithSizedbox(_buildPercentCircle(ss.mem.usedPercent * 100)),
_wrapWithSizedbox(_buildPercentCircle(ss.cpu.usedPercent()), true),
_wrapWithSizedbox(_buildPercentCircle(ss.mem.usedPercent * 100), true),
_wrapWithSizedbox(_buildNet(ss, spi.id)),
_wrapWithSizedbox(_buildDisk(ss, spi.id)),
],
@@ -346,7 +357,10 @@ class _ServerPageState extends State<ServerPage>
children: [
Text(
spi.name,
style: UIs.textSize13Bold,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
const Icon(
Icons.keyboard_arrow_right,
@@ -378,13 +392,13 @@ class _ServerPageState extends State<ServerPage>
onTap: () => _showFailReason(ss),
child: Text(
l10n.viewErr,
style: UIs.textSize11Grey,
style: UIs.textSize13Grey,
),
);
}
return Text(
topRightStr,
style: UIs.textSize11Grey,
style: UIs.textSize13Grey,
);
}
@@ -404,7 +418,7 @@ class _ServerPageState extends State<ServerPage>
}
Widget _buildDisk(ServerStatus ss, String id) {
final cardNoti = getCardNoti(id);
final cardNoti = _getCardNoti(id);
return ValueBuilder(
listenable: cardNoti,
build: () {
@@ -433,7 +447,7 @@ class _ServerPageState extends State<ServerPage>
}
Widget _buildNet(ServerStatus ss, String id) {
final cardNoti = getCardNoti(id);
final cardNoti = _getCardNoti(id);
final type = cardNoti.value.net ?? Stores.setting.netViewType.fetch();
final (a, b) = type.build(ss);
return AnimatedSwitcher(
@@ -460,17 +474,18 @@ class _ServerPageState extends State<ServerPage>
}) {
final child = Column(
children: [
const SizedBox(height: 5),
Text(
up,
style: UIs.textSize9Grey,
style: const TextStyle(fontSize: 10, color: Colors.grey),
textAlign: TextAlign.center,
textScaler: _textFactor,
),
const SizedBox(height: 3),
Text(
down,
style: UIs.textSize9Grey,
style: const TextStyle(fontSize: 10, color: Colors.grey),
textAlign: TextAlign.center,
textScaler: _textFactor,
)
],
);
@@ -493,8 +508,8 @@ class _ServerPageState extends State<ServerPage>
progressColor: primaryColor,
progressNumber: percent,
maxNumber: 100,
width: 53,
height: 53,
width: 57,
height: 57,
animationDuration: const Duration(milliseconds: 777),
),
),
@@ -503,7 +518,7 @@ class _ServerPageState extends State<ServerPage>
child: Text(
'${percent.toStringAsFixed(1)}%',
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) {
return 23.0;
}
@@ -566,9 +582,9 @@ class _ServerPageState extends State<ServerPage>
if (Stores.setting.moveOutServerTabFuncBtns.fetch() &&
// Discussion #146
!Stores.setting.serverTabUseOldUI.fetch()) {
return 132;
return 135;
}
return 107;
return 105;
}
void _askFor({
@@ -591,7 +607,7 @@ class _ServerPageState extends State<ServerPage>
);
}
_CardNotifier getCardNoti(String id) => _cardsStatus.putIfAbsent(
_CardNotifier _getCardNoti(String id) => _cardsStatus.putIfAbsent(
id,
() => _CardNotifier(const _CardStatus()),
);

View File

@@ -68,6 +68,7 @@ class _SettingPageState extends State<SettingPage> {
final _keyboardType = ValueNotifier(0);
final _rotateQuarter = ValueNotifier(0);
final _netViewType = ValueNotifier(NetViewType.speed);
late final _textScaler = ValueNotifier(_setting.textFactor.fetch());
@override
void didChangeDependencies() {
@@ -165,7 +166,7 @@ class _SettingPageState extends State<SettingPage> {
_buildTitle(l10n.editor),
_buildEditor(),
if (isDesktop) _buildTitle(l10n.fullScreen),
if (isDesktop) _buildFullScreen(),
if (!isDesktop) _buildFullScreen(),
const SizedBox(height: 37),
],
),
@@ -222,6 +223,7 @@ class _SettingPageState extends State<SettingPage> {
_buildMaxRetry(),
//_buildDiskIgnorePath(),
_buildDeleteServers(),
_buildTextScaler(),
//if (isDesktop) _buildDoubleColumnServersPage(),
].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() {
return ExpandTile(
title: Text(l10n.serverFuncBtns),

View File

@@ -50,7 +50,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
const SizedBox(width: 8),
IconButton(
icon: Transform.translate(
offset: const Offset(0, -3.5),
@@ -58,7 +57,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
),
onPressed: () => windowManager.minimize(),
),
const SizedBox(width: 8),
IconButton(
icon: const Icon(Icons.crop_square, size: 13),
onPressed: () async {
@@ -69,7 +67,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
}
},
),
const SizedBox(width: 8),
IconButton(
icon: const Icon(Icons.close, size: 14),
onPressed: () => windowManager.close(),