From 05b7a89bd1cb4c20a74cea06673a43940d5e4c99 Mon Sep 17 00:00:00 2001 From: ahmedhanafy725 Date: Thu, 19 Sep 2024 15:26:04 +0300 Subject: [PATCH] Adjust the voting percentage --- app/lib/widgets/dao/show_result_dialog.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/lib/widgets/dao/show_result_dialog.dart b/app/lib/widgets/dao/show_result_dialog.dart index 1ff9e83e..7fef98ce 100644 --- a/app/lib/widgets/dao/show_result_dialog.dart +++ b/app/lib/widgets/dao/show_result_dialog.dart @@ -127,7 +127,10 @@ class _ShowResultDialogState extends State style: Theme.of(context).textTheme.bodyLarge!.copyWith( color: Theme.of(context).colorScheme.onBackground, )), - Text(totalVotes == 0 ? '0%' : '${(yesVotes / totalVotes) * 100}%', + Text( + totalVotes == 0 + ? '0%' + : '${((yesVotes / totalVotes) * 100).toStringAsFixed(0)}%', style: Theme.of(context).textTheme.bodyLarge!.copyWith( color: Theme.of(context).colorScheme.onBackground, )), @@ -151,7 +154,10 @@ class _ShowResultDialogState extends State style: Theme.of(context).textTheme.bodyLarge!.copyWith( color: Theme.of(context).colorScheme.onBackground, )), - Text(totalVotes == 0 ? '0%' : '${noVotes / totalVotes * 100}%', + Text( + totalVotes == 0 + ? '0%' + : '${(noVotes / totalVotes * 100).toStringAsFixed(0)}%', style: Theme.of(context).textTheme.bodyLarge!.copyWith( color: Theme.of(context).colorScheme.onBackground, )),