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 1 commit
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
3 changes: 3 additions & 0 deletions lib/core/extension/proposal_model_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hypha_wallet/core/network/models/proposal_model.dart';
import 'package:hypha_wallet/design/hypha_colors.dart';

extension ProposalModelTimeFormatting on ProposalModel {
String formatExpiration() {
Expand Down Expand Up @@ -30,5 +32,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());
Color percentageColor()=> quorumToPercent()>=.2 && unityToPercent()>=.8 ?HyphaColors.success:HyphaColors.error;
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.percentageColor()
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ class HyphaProposalsActionCard extends StatelessWidget {
child: ProposalPercentageIndicator(
'Unity',
proposalModel.unityToPercent(),
HyphaColors.success
proposalModel.percentageColor()
),
),
ProposalPercentageIndicator(
'Quorum',
proposalModel.quorumToPercent(),
HyphaColors.success
proposalModel.percentageColor()
),
const SizedBox(height: 20),
ProposalExpirationTimer(
Expand Down
Loading