From 426f8d47936082f485ba88125a6dc4333314d044 Mon Sep 17 00:00:00 2001 From: fuwa Date: Thu, 28 Nov 2019 23:32:46 +0800 Subject: [PATCH] add on fire notice to summary page --- cyberwow/lib/config/cyberwow.dart | 5 +++ cyberwow/lib/widget/synced.dart | 55 ++++++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/cyberwow/lib/config/cyberwow.dart b/cyberwow/lib/config/cyberwow.dart index 4c7d674..15dd463 100644 --- a/cyberwow/lib/config/cyberwow.dart +++ b/cyberwow/lib/config/cyberwow.dart @@ -43,6 +43,11 @@ final _theme = ThemeData fontSize: 35, fontWeight: FontWeight.bold, ), + display2: TextStyle + ( + fontFamily: 'RobotoMono', + fontSize: 22, + ), title: TextStyle ( fontFamily: 'VT323', diff --git a/cyberwow/lib/widget/synced.dart b/cyberwow/lib/widget/synced.dart index f5d25ba..5c57b78 100644 --- a/cyberwow/lib/widget/synced.dart +++ b/cyberwow/lib/widget/synced.dart @@ -30,6 +30,14 @@ import '../helper.dart'; import '../logging.dart'; Widget summary(BuildContext context, SyncedState state) { + final height = state.height.toString(); + final onFire = state.getTransactionPool.length >= 10; + final onFireNotice = onFire ? ' 🔥' : ''; + final poolLength = state.getTransactionPool.length; + final poolLengthNotice = poolLength > 0 ? '[${poolLength}] ' : ''; + final txNotice = state.getTransactionPool.isEmpty ? + '' : poolLengthNotice + state.getTransactionPool.first['id ']; + return Container ( padding: EdgeInsets.only(bottom: 10.0), @@ -56,17 +64,48 @@ Widget summary(BuildContext context, SyncedState state) { Expanded ( flex: 15, - child: AnimatedSwitcher + child: Row ( - duration: Duration(milliseconds: 500), - child: Text - ( - '${state.height}', - style: Theme.of(context).textTheme.display1, - key: ValueKey(state.height), - ) + children: + [ + Spacer(), + AnimatedSwitcher + ( + duration: Duration(milliseconds: 500), + child: Text + ( + height, + style: Theme.of(context).textTheme.display1, + key: ValueKey(state.height), + ), + ), + AnimatedSwitcher + ( + duration: Duration(milliseconds: 500), + child: Text + ( + onFireNotice, + style: TextStyle + ( + fontSize: 25, + ), + key: ValueKey(onFire ? 0 : 1), + ), + ), + Spacer(), + ] ) ), + AnimatedSwitcher + ( + duration: Duration(milliseconds: 500), + child: Text + ( + txNotice, + style: Theme.of(context).textTheme.body2, + key: ValueKey(poolLength), + ), + ), Spacer ( flex: 1,