From 8b88b50c1fd4ed3b9b77ff035d16c62cdc1f8275 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Thu, 17 Oct 2024 14:03:55 +0200 Subject: [PATCH] Update download popup --- lib/Screens/Home/configurations_list.dart | 9 ++- lib/Services/downloadConfiguration.dart | 90 +++++++++++------------ 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/lib/Screens/Home/configurations_list.dart b/lib/Screens/Home/configurations_list.dart index 15ea3bb..b359772 100644 --- a/lib/Screens/Home/configurations_list.dart +++ b/lib/Screens/Home/configurations_list.dart @@ -350,11 +350,12 @@ class _ConfigurationsListState extends State { borderRadius: BorderRadius.all(Radius.circular(20.0)) ), content: SizedBox( - width: 400, - height: 200, - child: DownloadConfigurationWidget(configuration: configuration), + width: 350, + height: 125, + child: Center( + child: DownloadConfigurationWidget(configuration: configuration) + ), ), - actions: const [], ), context: context ); isDialogOpen = false; diff --git a/lib/Services/downloadConfiguration.dart b/lib/Services/downloadConfiguration.dart index 26c921e..bd0c189 100644 --- a/lib/Services/downloadConfiguration.dart +++ b/lib/Services/downloadConfiguration.dart @@ -262,24 +262,23 @@ class _DownloadConfigurationWidgetState extends State( + valueListenable: currentResourceNbr, + builder: (context, valueNbr, _) { return ValueListenableBuilder( - valueListenable: currentResourceNbr, - builder: (context, valueNbr, _) { - return ValueListenableBuilder( - valueListenable: currentResourceIndex, - builder: (context, valueIndex, _) { - return Center( + valueListenable: currentResourceIndex, + builder: (context, valueIndex, _) { + var valueInPercentage = valueNbr > 0 ? (valueIndex / valueNbr) * 100 : 100; + String formattedPercentage = valueInPercentage.toStringAsFixed(0); + return Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Padding( + padding: const EdgeInsets.all(8.0), child: Text( textAlign: TextAlign.center, valueIndex == valueNbr && valueNbr != -1 ? valueNbr == 0 ? @@ -292,38 +291,39 @@ class _DownloadConfigurationWidgetState extends State( - valueListenable: currentResourceNbr, - builder: (context, valueNbr, _) { - return ValueListenableBuilder( - valueListenable: currentResourceIndex, - builder: (context, valueIndex, _) { - var valueInPercentage = valueNbr > 0 ? (valueIndex / valueNbr) * 100 : 100; - String formattedPercentage = valueInPercentage.toStringAsFixed(0); // Limite à 2 décimales - - return valueNbr != -1 && valueNbr != 0 ? Center( - child: Padding( - padding: const EdgeInsets.only(bottom: 8.0), - child: Text( - '$formattedPercentage%', - style: const TextStyle(fontSize: 45, fontWeight: FontWeight.w500), - ), - ), - ) : const SizedBox(height: 0,width: 0); - } - ); - } - ), - Spacer() - ], + ); + }), ); } }