From 459b647b68688fd1786bf52626b1b5b5b59b15f4 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Wed, 6 Sep 2023 21:05:30 +0800 Subject: [PATCH] #156 new: setting of `textFactor` --- lib/view/page/server/detail.dart | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/view/page/server/detail.dart b/lib/view/page/server/detail.dart index d55fc682..4ed07df7 100644 --- a/lib/view/page/server/detail.dart +++ b/lib/view/page/server/detail.dart @@ -38,6 +38,8 @@ class _ServerDetailPageState extends State final Order _cardsOrder = []; final _setting = locator(); + late final _textFactor = _setting.textFactor.fetch(); + late final _cardBuildMap = Map.fromIterables( defaultDetailCardOrder, [ @@ -163,12 +165,12 @@ class _ServerDetailPageState extends State Text( '${percent.toStringAsFixed(1)}%', style: const TextStyle(fontSize: 13), - textScaleFactor: 1.0, + textScaleFactor: _textFactor, ), Text( timeType, style: const TextStyle(fontSize: 10, color: Colors.grey), - textScaleFactor: 1.0, + textScaleFactor: _textFactor, ), ], ); @@ -206,11 +208,11 @@ class _ServerDetailPageState extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(ss.sysVer, style: textSize11, textScaleFactor: 1.0), + Text(ss.sysVer, style: textSize11, textScaleFactor: _textFactor), Text( ss.uptime, style: textSize11, - textScaleFactor: 1.0, + textScaleFactor: _textFactor, ), ], ), @@ -316,9 +318,9 @@ class _ServerDetailPageState extends State Text( '${disk.usedPercent}% of ${disk.size}', style: textSize11, - textScaleFactor: 1.0, + textScaleFactor: _textFactor, ), - Text(disk.path, style: textSize11, textScaleFactor: 1.0) + Text(disk.path, style: textSize11, textScaleFactor: _textFactor,) ], ), _buildProgress(disk.usedPercent.toDouble()) @@ -392,7 +394,7 @@ class _ServerDetailPageState extends State child: Text( device, style: textSize11, - textScaleFactor: 1.0, + textScaleFactor: _textFactor, maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -403,7 +405,7 @@ class _ServerDetailPageState extends State '${ns.speedIn(device: device)} | ${ns.sizeIn(device: device)}', style: textSize11, textAlign: TextAlign.center, - textScaleFactor: 0.87, + textScaleFactor: 0.87 * _textFactor, ), ), SizedBox( @@ -412,7 +414,7 @@ class _ServerDetailPageState extends State '${ns.speedOut(device: device)} | ${ns.sizeOut(device: device)}', style: textSize11, textAlign: TextAlign.right, - textScaleFactor: 0.87, + textScaleFactor: 0.87 * _textFactor, ), ) ], @@ -444,12 +446,12 @@ class _ServerDetailPageState extends State Text( key, style: textSize11, - textScaleFactor: 1.0, + textScaleFactor: _textFactor, ), Text( '${temps.get(key)}°C', style: textSize11, - textScaleFactor: 1.0, + textScaleFactor: _textFactor, ), ], ))); @@ -468,7 +470,7 @@ class _ServerDetailPageState extends State key: key, text, style: style, - textScaleFactor: 1.0, + textScaleFactor: _textFactor, ), transitionBuilder: (child, animation) => FadeTransition( opacity: animation,