Skip to content

Commit

Permalink
Merge pull request #292 from hypha-dao/feat/implement-proposal-detail…
Browse files Browse the repository at this point in the history
…s-page-redirection

feat: implement proposal details page redirection
  • Loading branch information
Zied-Dahmani authored Aug 31, 2024
2 parents fb7d8e9 + a9c5118 commit 11e2e7a
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 475 deletions.
12 changes: 12 additions & 0 deletions lib/ui/proposals/details/proposal_details_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
import 'package:hypha_wallet/core/network/models/proposal_model.dart';

class ProposalDetailsPage extends StatelessWidget {
final ProposalModel proposal;
const ProposalDetailsPage(this.proposal, {super.key});

@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
101 changes: 52 additions & 49 deletions lib/ui/proposals/list/components/hypha_proposals_action_card.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get/get.dart' as Get;
import 'package:hypha_wallet/core/extension/proposal_model_extensions.dart';
import 'package:hypha_wallet/core/network/models/proposal_model.dart';
import 'package:hypha_wallet/core/network/models/vote_model.dart';
Expand All @@ -10,6 +11,7 @@ import 'package:hypha_wallet/design/hypha_card.dart';
import 'package:hypha_wallet/design/hypha_colors.dart';
import 'package:hypha_wallet/design/themes/extensions/theme_extension_provider.dart';
import 'package:hypha_wallet/ui/blocs/authentication/authentication_bloc.dart';
import 'package:hypha_wallet/ui/proposals/details/proposal_details_page.dart';
import 'package:percent_indicator/linear_percent_indicator.dart';

class HyphaProposalsActionCard extends StatelessWidget {
Expand All @@ -23,54 +25,50 @@ class HyphaProposalsActionCard extends StatelessWidget {
children: [
_buildVoteStatusOverlay(context),
HyphaCard(
child: InkWell(
borderRadius: BorderRadius.circular(16),
onTap: () {},
child: Padding(
padding: const EdgeInsets.all(22),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHeader(
context,
proposalModel.daoName,
'https://etudestech.com/wp-content/uploads/2023/05/midjourney-scaled.jpeg',
),
const SizedBox(height: 18),
const HyphaDivider(),
const SizedBox(height: 18),
_buildProposalRoleAssignment(
context,
proposalModel.commitment ?? 0,
proposalModel.title ?? 'No title set for this proposal.',
),
const SizedBox(height: 20),
_buildProposalPercentageIndicator(
context,
'Unity',
proposalModel.unityToPercent(),
),
const SizedBox(height: 20),
_buildProposalPercentageIndicator(
context,
'Quorum',
proposalModel.quorumToPercent(),
),
const SizedBox(height: 20),
_buildProposalExpirationInfo(
context,
proposalModel.formatExpiration(),
),
const SizedBox(height: 16),
const HyphaDivider(),
const SizedBox(height: 16),
_buildProposalCardFooter(
context,
proposalModel.creator,
'https://etudestech.com/wp-content/uploads/2023/05/midjourney-scaled.jpeg',
),
],
),
child: Padding(
padding: const EdgeInsets.all(22),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHeader(
context,
proposalModel.daoName,
'https://etudestech.com/wp-content/uploads/2023/05/midjourney-scaled.jpeg',
),
const SizedBox(height: 18),
const HyphaDivider(),
const SizedBox(height: 18),
_buildProposalRoleAssignment(
context,
proposalModel.commitment ?? 0,
proposalModel.title ?? 'No title set for this proposal.',
),
const SizedBox(height: 20),
_buildProposalPercentageIndicator(
context,
'Unity',
proposalModel.unityToPercent(),
),
const SizedBox(height: 20),
_buildProposalPercentageIndicator(
context,
'Quorum',
proposalModel.quorumToPercent(),
),
const SizedBox(height: 20),
_buildProposalExpirationInfo(
context,
proposalModel.formatExpiration(),
),
const SizedBox(height: 16),
const HyphaDivider(),
const SizedBox(height: 16),
_buildProposalCardFooter(
context,
proposalModel.creator,
'https://etudestech.com/wp-content/uploads/2023/05/midjourney-scaled.jpeg',
),
],
),
),
),
Expand Down Expand Up @@ -255,7 +253,12 @@ class HyphaProposalsActionCard extends StatelessWidget {
),
const Spacer(),
GestureDetector(
onTap: () {},
onTap: () {
Get.Get.to(
ProposalDetailsPage(proposalModel),
transition: Get.Transition.rightToLeft,
);
},
child: Container(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
decoration: BoxDecoration(
Expand Down
1 change: 0 additions & 1 deletion lib/ui/proposals/list/components/proposals_view.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get/get.dart' as GetX;
import 'package:hypha_wallet/core/network/models/proposal_model.dart';
import 'package:hypha_wallet/design/avatar_image/hypha_avatar_image.dart';
import 'package:hypha_wallet/design/background/hypha_page_background.dart';
import 'package:hypha_wallet/design/hypha_colors.dart';
Expand Down
6 changes: 0 additions & 6 deletions lib/ui/proposals/list/interactor/page_command.dart

This file was deleted.

3 changes: 1 addition & 2 deletions lib/ui/proposals/list/interactor/proposals_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:hypha_wallet/ui/architecture/interactor/page_states.dart';
import 'package:hypha_wallet/ui/architecture/result/result.dart';
import 'package:hypha_wallet/ui/proposals/list/usecases/get_proposals_use_case.dart';

part 'page_command.dart';
part 'proposals_bloc.freezed.dart';
part 'proposals_event.dart';
part 'proposals_state.dart';
Expand All @@ -34,4 +33,4 @@ class ProposalsBloc extends Bloc<ProposalsEvent, ProposalsState> {
emit(state.copyWith(pageState: PageState.failure));
}
}
}
}
Loading

0 comments on commit 11e2e7a

Please sign in to comment.