From b7a356795568b36355af7ef5c5ef91a75c1187f6 Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Sat, 10 Jul 2021 23:35:55 +0200 Subject: [PATCH] #100 load bar iPhone8 Layout --- CHANGELOG.md | 2 +- flutter_hangboard/lib/widgets/mqttView.dart | 44 +++++++++++++++++---- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f80d3c71..a2b607ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -- v0.59 - WIP Features (#87, #108, #109), Bugfixes (#111) +- v0.59 - WIP Features (#87, #108, #109), Bugfixes (#111, #100) - v0.58 - Demonstrator with one working exercise. Progress bar (#103), bugfixes (#101). - v0.57 - Bugfixes (#99, #104) - v0.56 - Implemented 1 hand hold display (#96, #97), display next exercise intensity (#98). diff --git a/flutter_hangboard/lib/widgets/mqttView.dart b/flutter_hangboard/lib/widgets/mqttView.dart index 59b3b58f..fbc85e44 100644 --- a/flutter_hangboard/lib/widgets/mqttView.dart +++ b/flutter_hangboard/lib/widgets/mqttView.dart @@ -85,8 +85,8 @@ class _MQTTViewState extends State { _buildIntensityPlot(currentAppState.getCurrentItensity, currentAppState.getCurrentSetIntensity), _buildControls(currentAppState.getAppConnectionState), - _buildLoadPlot(currentAppState.getLoadCurrentData), - //_buildLoadPlotDisplay(currentAppState.getLoadCurrent), + //_buildLoadPlot(currentAppState.getLoadCurrentData), + _buildLoadPlotDisplay(currentAppState.getLoadCurrent), _buildLastExerciseStatistics(currentAppState.getLastHangTime, currentAppState.getLastMaximalLoad), ], @@ -100,10 +100,12 @@ class _MQTTViewState extends State { Widget _buildIntensityPlot( double CurrentItensity, double CurrentSetIntensity) { return (((CurrentSetIntensity < CurrentItensity) || (CurrentItensity > 1.0)) - ? Text("Current Intensity " + - CurrentItensity.toStringAsFixed(1) + - " and Exercise Int " + - CurrentSetIntensity.toStringAsFixed(1)) + ? Text( + "Current Intensity " + + CurrentItensity.toStringAsFixed(1) + + " and Exercise Int " + + CurrentSetIntensity.toStringAsFixed(1), + style: TextStyle(color: Colors.redAccent)) : LinearPercentIndicator( //radius: 120.0, //lineWidth: 13.0, @@ -149,7 +151,35 @@ class _MQTTViewState extends State { // ignore: unused_element Widget _buildLoadPlotDisplay(double LoadCurrent) { - return (Text("Current load: " + LoadCurrent.toString())); + double hangtime = 0.0; + double loadperc = LoadCurrent / 100; + if (loadperc < 0.0) { + loadperc = 0.0; + } + return (LinearPercentIndicator( + //radius: 120.0, + //lineWidth: 13.0, + //animation: true, + percent: loadperc, + center: new Text( + LoadCurrent.toStringAsFixed(2), + style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0), + ), + //footer: + leading: new Text( + LoadCurrent.toStringAsFixed(0) + "kg", + style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 17.0), + ), + trailing: new Text( + hangtime.toStringAsFixed(0) + "s", + style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 17.0), + ), + //circularStrokeCap: CircularStrokeCap.round, + progressColor: Colors.redAccent, + ) + + //Text("Current load: " + LoadCurrent.toString()) + ); } Widget _buildLoadPlot(List LoadCurrentData) {