Fix display issue caused by text size

This commit is contained in:
LollipopKit
2021-10-26 13:42:29 +08:00
parent dad9bfc728
commit 18ff844b5e
2 changed files with 39 additions and 23 deletions

View File

@@ -53,23 +53,23 @@ class MyApp extends StatelessWidget {
), ),
darkTheme: ThemeData.dark().copyWith( darkTheme: ThemeData.dark().copyWith(
primaryColor: primaryColor, primaryColor: primaryColor,
appBarTheme: AppBarTheme(backgroundColor: primaryColor), appBarTheme: AppBarTheme(backgroundColor: primaryColor),
floatingActionButtonTheme: floatingActionButtonTheme: FloatingActionButtonThemeData(
FloatingActionButtonThemeData(backgroundColor: primaryColor), backgroundColor: primaryColor),
iconTheme: IconThemeData(color: primaryColor), iconTheme: IconThemeData(color: primaryColor),
primaryIconTheme: IconThemeData(color: primaryColor), primaryIconTheme: IconThemeData(color: primaryColor),
switchTheme: SwitchThemeData( switchTheme: SwitchThemeData(
thumbColor: getMaterialStateColor(primaryColor), thumbColor: getMaterialStateColor(primaryColor),
trackColor: trackColor:
getMaterialStateColor(primaryColor.withOpacity(0.7)), getMaterialStateColor(primaryColor.withOpacity(0.7)),
), ),
buttonTheme: ButtonThemeData(splashColor: primaryColor), buttonTheme: ButtonThemeData(splashColor: primaryColor),
inputDecorationTheme: InputDecorationTheme( inputDecorationTheme: InputDecorationTheme(
labelStyle: textStyle, labelStyle: textStyle,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor))), borderSide: BorderSide(color: primaryColor))),
radioTheme: RadioThemeData( radioTheme: RadioThemeData(
fillColor: getMaterialStateColor(primaryColor))), fillColor: getMaterialStateColor(primaryColor))),
home: MyHomePage(primaryColor: primaryColor), home: MyHomePage(primaryColor: primaryColor),
); );
}); });

View File

@@ -115,15 +115,17 @@ class _ServerPageState extends State<ServerPage>
children: [ children: [
Text( Text(
serverName, serverName,
style: const TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
textScaleFactor: 1.0,
), ),
Text(ss.uptime!, Text(ss.uptime!,
textScaleFactor: 1.0,
style: TextStyle( style: TextStyle(
color: _theme.textTheme.bodyText1!.color!.withAlpha(100))) color: _theme.textTheme.bodyText1!.color!.withAlpha(100), fontSize: 11))
], ],
), ),
const SizedBox( const SizedBox(
height: 13, height: 17,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -143,7 +145,7 @@ class _ServerPageState extends State<ServerPage>
Widget _buildIOData(String title, String up, String down) { Widget _buildIOData(String title, String up, String down) {
final statusTextStyle = TextStyle( final statusTextStyle = TextStyle(
fontSize: 11, color: _theme.textTheme.bodyText1!.color!.withAlpha(177)); fontSize: 9, color: _theme.textTheme.bodyText1!.color!.withAlpha(177));
return SizedBox( return SizedBox(
width: _media.size.width * 0.2, width: _media.size.width * 0.2,
height: _media.size.height * 0.1, height: _media.size.height * 0.1,
@@ -154,14 +156,21 @@ class _ServerPageState extends State<ServerPage>
up, up,
style: statusTextStyle, style: statusTextStyle,
textAlign: TextAlign.center, textAlign: TextAlign.center,
textScaleFactor: 1.0,
), ),
const SizedBox(height: 3), const SizedBox(height: 3),
Text( Text(
down + '\n', down + '\n',
style: statusTextStyle, style: statusTextStyle,
textAlign: TextAlign.center, textAlign: TextAlign.center,
textScaleFactor: 1.0,
), ),
Text(title, textAlign: TextAlign.center) Text(
title,
style: const TextStyle(fontSize: 12),
textAlign: TextAlign.center,
textScaleFactor: 1.0,
)
], ],
), ),
); );
@@ -188,12 +197,19 @@ class _ServerPageState extends State<ServerPage>
child: Text( child: Text(
'${percent.toStringAsFixed(1)}%', '${percent.toStringAsFixed(1)}%',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 11),
textScaleFactor: 1.0,
), ),
), ),
), ),
], ],
), ),
Text(title, textAlign: TextAlign.center), Text(
title,
style: const TextStyle(fontSize: 12),
textAlign: TextAlign.center,
textScaleFactor: 1.0,
),
], ],
), ),
); );