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

View File

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

View File

@@ -117,6 +117,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.0" 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: fake_async:
dependency: transitive dependency: transitive
description: description:
@@ -258,6 +265,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.2"
marquee:
dependency: "direct main"
description:
name: marquee
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:

View File

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