From e06c65477928f45701a57f396655bb0f2ba6586f Mon Sep 17 00:00:00 2001 From: Felix Date: Sun, 19 Jul 2020 22:26:33 +0200 Subject: [PATCH] :bug: Fix Feriencountdown overflowing on some devices Close #99 --- lib/Views/Home.dart | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/Views/Home.dart b/lib/Views/Home.dart index 12f3541..679a614 100644 --- a/lib/Views/Home.dart +++ b/lib/Views/Home.dart @@ -167,9 +167,7 @@ class HomeState extends State { } Widget _createFerienCountdownNumber(double screenSizeWidth, String char, ) { - return Container( - margin: EdgeInsets.fromLTRB(10, 0, screenSizeWidth / 50, 0), - child: Column( + return Column( children: [ kIsWeb ? Text(_getFerienValue(char).toString(), style: TextStyle(fontSize: countDownSize),) @@ -177,21 +175,24 @@ class HomeState extends State { itemStream: Stream.periodic( Duration(milliseconds: 1000), (count) => _getFerienValue(char)), itemBuilder: (context, value) => Container( - color: Colors.black, - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Text( - betterNumber(value), - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: countDownSize, - color: Colors.white), + // The width has to be calculated like this to fit on mobile and tablet. But there should be a better way I do not know. + width: MediaQuery.of(context).size.longestSide > 1000 ? MediaQuery.of(context).size.width / 3 / 7 : MediaQuery.of(context).size.width / 7, + color: Colors.black, + padding: const EdgeInsets.symmetric(horizontal: 8), + child: FittedBox( + fit: BoxFit.contain, + child: Text( + betterNumber(value), + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white), + ), + ), ), - ), initValue: _getFerienValue(char), ), Text(char) ], - ), ); }