Update game_steps_widget.dart

Fix data Unit, simplify GiB calculation.
This commit is contained in:
My1 2024-10-31 16:47:35 +01:00 committed by GitHub
parent fb4e47eac7
commit 0db2c88f83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,8 +107,9 @@ class _DownloadingGame extends StatelessWidget {
final provider = Provider.of<Game>(context);
final pourcent =
(provider.currentProgress.toInt() / provider.maxProgress.toInt()) * 100;
final currentGb = provider.currentProgress.toInt() / 1024 / 1024 / 1024;
final maxGb = provider.maxProgress.toInt() / 1024 / 1024 / 1024;
//1024^3 = 1073741824
final currentGb = provider.currentProgress.toInt() / 1073741824;
final maxGb = provider.maxProgress.toInt() / 1073741824;
return Padding(
padding: const EdgeInsets.only(bottom: 40.0),
@ -118,7 +119,7 @@ class _DownloadingGame extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(
"${currentGb.toStringAsFixed(2)} / ${maxGb.toStringAsFixed(2)} Gb (${pourcent.toStringAsFixed(2)}%)",
"${currentGb.toStringAsFixed(2)} / ${maxGb.toStringAsFixed(2)} GiB (${pourcent.toStringAsFixed(2)}%)",
),
),
YaruLinearProgressIndicator(