Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adjust percentage indicator color #304

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/core/extension/proposal_model_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ extension ProposalModelTimeFormatting on ProposalModel {
double unityToPercent() => unity==null?0:unity!*.01;
double commitmentToPercent() => commitment == null ? 0 : commitment! * .01;
bool isExpired() => expiration!.toLocal().isBefore(DateTime.now());
bool isPassing()=>quorumToPercent()>=.2 && unityToPercent()>=.8;
nbetsaif marked this conversation as resolved.
Show resolved Hide resolved
}

Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class _ProposalDetailsViewState extends State<ProposalDetailsView> {
child: ProposalPercentageIndicator(
index == 0 ? 'Unity' : 'Quorum',
index == 0 ? widget.proposalModel.unityToPercent() : widget.proposalModel.quorumToPercent(),
HyphaColors.success
widget.proposalModel.isPassing()?HyphaColors.success:HyphaColors.error
),
),
),
Expand Down
38 changes: 20 additions & 18 deletions lib/ui/proposals/list/components/hypha_proposals_action_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,17 @@ class HyphaProposalsActionCard extends StatelessWidget {
child: ProposalPercentageIndicator(
'Unity',
proposalModel.unityToPercent(),
HyphaColors.success
proposalModel.isPassing()
? HyphaColors.success
: HyphaColors.error,
),
),
ProposalPercentageIndicator(
'Quorum',
proposalModel.quorumToPercent(),
HyphaColors.success
),
'Quorum',
proposalModel.quorumToPercent(),
proposalModel.isPassing()
? HyphaColors.success
: HyphaColors.error),
const SizedBox(height: 20),
ProposalExpirationTimer(
proposalModel.formatExpiration(),
Expand Down Expand Up @@ -116,7 +119,8 @@ class HyphaProposalsActionCard extends StatelessWidget {
);
}

Widget _buildProposalRoleAssignment(BuildContext context, int commitment, String title) {
Widget _buildProposalRoleAssignment(
BuildContext context, int commitment, String title) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down Expand Up @@ -146,25 +150,23 @@ class HyphaProposalsActionCard extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 5),
child: Text(
text,
style: context.hyphaTextTheme.ralMediumSmallNote.copyWith(color: HyphaColors.midGrey),
style: context.hyphaTextTheme.ralMediumSmallNote
.copyWith(color: HyphaColors.midGrey),
),
);
}

Widget _buildProposalCardFooter(BuildContext context, String creatorName, String creatorImageUrl) {
Widget _buildProposalCardFooter(
BuildContext context, String creatorName, String creatorImageUrl) {
return Row(
children: [
Expanded(child: ProposalCreator(creatorName, creatorImageUrl)),
ProposalButton(
'Details',
Icons.arrow_forward_ios,
() {
Get.Get.to(
ProposalDetailsPage(proposalModel),
transition: Get.Transition.rightToLeft,
);
}
),
ProposalButton('Details', Icons.arrow_forward_ios, () {
Get.Get.to(
ProposalDetailsPage(proposalModel),
transition: Get.Transition.rightToLeft,
);
}),
],
);
}
Expand Down