scroll server connection failed info

This commit is contained in:
Junyuan Feng
2021-12-31 17:55:07 +08:00
parent f7558d6beb
commit f480c49f1f
4 changed files with 39 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ import 'package:circle_chart/circle_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:get_it/get_it.dart';
import 'package:marquee/marquee.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:toolbox/core/route.dart';
@@ -128,6 +129,12 @@ class _ServerPageState extends State<ServerPage>
final rootDisk =
ss.disk.firstWhere((element) => element.mountLocation == '/');
final topRightStr =
getTopRightStr(cs, ss.cpu2Status.temp, ss.uptime, ss.failedInfo);
final hasError = cs == ServerConnectionState.failed;
final style = TextStyle(
color: _theme.textTheme.bodyText1!.color!.withAlpha(100), fontSize: 11);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -139,13 +146,18 @@ class _ServerPageState extends State<ServerPage>
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
textScaleFactor: 1.0,
),
Text(
getTopRightStr(
cs, ss.cpu2Status.temp, ss.uptime, ss.failedInfo),
textScaleFactor: 1.0,
style: TextStyle(
color: _theme.textTheme.bodyText1!.color!.withAlpha(100),
fontSize: 11))
hasError
? ConstrainedBox(
constraints: BoxConstraints(
maxWidth: _media.size.width * 0.57, maxHeight: 17),
child: Marquee(
accelerationDuration: const Duration(seconds: 3),
accelerationCurve: Curves.linear,
decelerationDuration: const Duration(seconds: 3),
decelerationCurve: Curves.linear,
text: topRightStr, textScaleFactor: 1.0, style: style),
)
: Text(topRightStr, style: style, textScaleFactor: 1.0),
],
),
const SizedBox(

View File

@@ -113,8 +113,11 @@ class _SettingPageState extends State<SettingPage> {
height: 3,
),
_intervalValue == 0.0
? const Text('You set to 0, will not update automatically.\nYou can pull to refresh manually.',
style: TextStyle(color: Colors.grey), textAlign: TextAlign.center,)
? const Text(
'You set to 0, will not update automatically.\nYou can pull to refresh manually.',
style: TextStyle(color: Colors.grey),
textAlign: TextAlign.center,
)
: const SizedBox(),
const SizedBox(
height: 13,

View File

@@ -117,6 +117,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
fading_edge_scrollview:
dependency: transitive
description:
name: fading_edge_scrollview
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
fake_async:
dependency: transitive
description:
@@ -258,6 +265,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
marquee:
dependency: "direct main"
description:
name: marquee
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
matcher:
dependency: transitive
description:

View File

@@ -53,6 +53,7 @@ dependencies:
clipboard: ^0.1.3
r_upgrade: ^0.3.6
pull_to_refresh: ^2.0.0
marquee: ^2.2.0
dev_dependencies: