Update download popup

This commit is contained in:
Thomas Fransolet 2024-10-17 14:03:55 +02:00
parent 44581c12c5
commit 8b88b50c1f
2 changed files with 50 additions and 49 deletions

View File

@ -350,11 +350,12 @@ class _ConfigurationsListState extends State<ConfigurationsList> {
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 <Widget>[],
), context: context
);
isDialogOpen = false;

View File

@ -262,24 +262,23 @@ class _DownloadConfigurationWidgetState extends State<DownloadConfigurationWidge
VisitAppContext visitAppContext = appContext.getContext();
Size size = MediaQuery.of(context).size;
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Spacer(),
Padding(
padding: const EdgeInsets.only(bottom: 10.0),
child: FutureBuilder(future: download(context, visitAppContext), builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
Color primaryColor = kMainColor1;
return Center(child: CircularProgressIndicator(color: primaryColor));
} else {
return Center(
child: FutureBuilder(future: download(context, visitAppContext), builder: (context, snapshot) {
return ValueListenableBuilder<int>(
valueListenable: currentResourceNbr,
builder: (context, valueNbr, _) {
return ValueListenableBuilder<int>(
valueListenable: currentResourceNbr,
builder: (context, valueNbr, _) {
return ValueListenableBuilder<int>(
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<DownloadConfigurationWidge
appContext.getContext()),
style: const TextStyle(fontSize: 20),
),
);
}
),
),
if(valueNbr != -1 && valueNbr != 0)
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: LinearProgressIndicator(
value: valueInPercentage / 100,
semanticsLabel: 'Linear progress indicator',
color: kMainColor0,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'$formattedPercentage%',
style: const TextStyle(fontSize: 28, fontWeight: FontWeight.w500),
),
),
],
),
)
],
);
}
);
}
}),
),
ValueListenableBuilder<int>(
valueListenable: currentResourceNbr,
builder: (context, valueNbr, _) {
return ValueListenableBuilder<int>(
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()
],
);
}),
);
}
}