From 42813bdf4da0b743cb79582dee221942a75769b3 Mon Sep 17 00:00:00 2001 From: UnicornsOnLSD Date: Fri, 9 Apr 2021 15:37:39 +0100 Subject: [PATCH] Don't set size on DownloadsOverview (fixes overflow on iOS --- .../DownloadsScreen/DownloadsOverview.dart | 132 +++++++++--------- 1 file changed, 64 insertions(+), 68 deletions(-) diff --git a/lib/components/DownloadsScreen/DownloadsOverview.dart b/lib/components/DownloadsScreen/DownloadsOverview.dart index 55d463382..464991eac 100644 --- a/lib/components/DownloadsScreen/DownloadsOverview.dart +++ b/lib/components/DownloadsScreen/DownloadsOverview.dart @@ -46,79 +46,75 @@ class _DownloadsOverviewState extends State { @override Widget build(BuildContext context) { - return SizedBox( - height: cardHeight, - child: FutureBuilder>( - future: FlutterDownloader.loadTasks(), - builder: (context, snapshot) { - if (snapshot.hasData) { - List downloadTasks = snapshot.data; - return Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - RichText( - text: TextSpan( - children: [ - TextSpan( - text: downloadTasks.length.toString(), - style: TextStyle(fontSize: 48), - ), - TextSpan( - text: " downloads", - style: - TextStyle(fontSize: 24, color: Colors.grey), - ), - ], - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${downloadTasks.where((element) => element.status == DownloadTaskStatus.complete).length} complete", - style: TextStyle(color: Colors.green), - ), - Text( - "${downloadTasks.where((element) => element.status == DownloadTaskStatus.failed).length} failed", - style: TextStyle(color: Colors.red), + return FutureBuilder>( + future: FlutterDownloader.loadTasks(), + builder: (context, snapshot) { + if (snapshot.hasData) { + List downloadTasks = snapshot.data; + return Card( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + RichText( + text: TextSpan( + children: [ + TextSpan( + text: downloadTasks.length.toString(), + style: TextStyle(fontSize: 48), ), - Text( - "${downloadTasks.where((element) => element.status == DownloadTaskStatus.enqueued).length} enqueued", - style: TextStyle(color: Colors.grey), + TextSpan( + text: " downloads", + style: TextStyle(fontSize: 24, color: Colors.grey), ), - Text( - "${downloadTasks.where((element) => element.status == DownloadTaskStatus.running).length} running", - style: TextStyle(color: Colors.grey), - ), - Text( - "${downloadTasks.where((element) => element.status == DownloadTaskStatus.paused).length} paused", - style: TextStyle(color: Colors.grey), - ), - DownloadsFileSize(), ], - ) - ], - ), + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + "${downloadTasks.where((element) => element.status == DownloadTaskStatus.complete).length} complete", + style: TextStyle(color: Colors.green), + ), + Text( + "${downloadTasks.where((element) => element.status == DownloadTaskStatus.failed).length} failed", + style: TextStyle(color: Colors.red), + ), + Text( + "${downloadTasks.where((element) => element.status == DownloadTaskStatus.enqueued).length} enqueued", + style: TextStyle(color: Colors.grey), + ), + Text( + "${downloadTasks.where((element) => element.status == DownloadTaskStatus.running).length} running", + style: TextStyle(color: Colors.grey), + ), + Text( + "${downloadTasks.where((element) => element.status == DownloadTaskStatus.paused).length} paused", + style: TextStyle(color: Colors.grey), + ), + DownloadsFileSize(), + ], + ) + ], ), ), - ); - } else if (snapshot.hasError) { - errorSnackbar(snapshot.error, context); - return Card( - child: Icon(Icons.error), - ); - } else { - return Card( - child: Center(child: CircularProgressIndicator()), - ); - } - }, - ), + ), + ); + } else if (snapshot.hasError) { + errorSnackbar(snapshot.error, context); + return Card( + child: Icon(Icons.error), + ); + } else { + return Card( + child: Center(child: CircularProgressIndicator()), + ); + } + }, ); } }