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

feat: Implement Proposal history section ui #327

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions lib/ui/proposals/components/proposals_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ import 'package:hypha_wallet/ui/proposals/list/components/hypha_proposals_action

class ProposalsList extends StatelessWidget {
final List<ProposalModel> proposals;
final bool isScrollable;

const ProposalsList(this.proposals, {super.key});
const ProposalsList(this.proposals, {this.isScrollable = true, super.key});

@override
Widget build(BuildContext context) {
return ListView.separated(
physics: isScrollable?const BouncingScrollPhysics():const NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: const EdgeInsets.only(bottom: 22),
itemBuilder: (BuildContext context, int index) => HyphaProposalsActionCard(proposals[index]),
itemBuilder: (BuildContext context, int index) =>
HyphaProposalsActionCard(proposals[index]),
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(height: 16);
},
Expand Down
54 changes: 54 additions & 0 deletions lib/ui/proposals/list/components/hypha_proposal_history_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart' as GetX;
import 'package:hypha_wallet/core/network/models/dao_data_model.dart';
import 'package:hypha_wallet/design/dao_image.dart';
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/proposals/history/proposals_history_page.dart';

class HyphaProposalHistoryCard extends StatelessWidget {
final DaoData dao;
final String subTitle;

const HyphaProposalHistoryCard(
{required this.dao, required this.subTitle, super.key});

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
GetX.Get.to(() => ProposalsHistoryPage(dao),
transition: GetX.Transition.leftToRight);
},
child: HyphaCard(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 20),
child: Row(
children: [
DaoImage(dao),
const SizedBox(
width: 10,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
dao.settingsDaoTitle,
style: context.hyphaTextTheme.smallTitles,
),
Text(
subTitle,
style: context.hyphaTextTheme.ralMediumBody
.copyWith(color: HyphaColors.midGrey),
),
],
),
const Spacer(),
const Icon(Icons.arrow_forward_ios)
],
),
)),
);
}
}
92 changes: 68 additions & 24 deletions lib/ui/proposals/list/components/proposals_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:get/get.dart' as GetX;
import 'package:get_it/get_it.dart';
import 'package:hypha_wallet/core/extension/proposals_filter_extension.dart';
import 'package:hypha_wallet/core/network/models/proposal_model.dart';
import 'package:hypha_wallet/core/network/models/dao_data_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 All @@ -12,11 +13,14 @@ import 'package:hypha_wallet/ui/blocs/authentication/authentication_bloc.dart';
import 'package:hypha_wallet/ui/profile/profile_page.dart';
import 'package:hypha_wallet/ui/proposals/components/proposals_list.dart';
import 'package:hypha_wallet/ui/proposals/filter/filter_proposals_page.dart';
import 'package:hypha_wallet/ui/proposals/filter/interactor/filter_proposals_bloc.dart';
import 'package:hypha_wallet/ui/proposals/filter/interactor/filter_status.dart';
import 'package:hypha_wallet/ui/proposals/list/components/hypha_proposal_history_card.dart';
import 'package:hypha_wallet/ui/proposals/list/components/hypha_proposals_action_card.dart';
import 'package:hypha_wallet/ui/proposals/list/interactor/proposals_bloc.dart';
import 'package:hypha_wallet/ui/shared/hypha_body_widget.dart';

import '../../filter/interactor/filter_proposals_bloc.dart';

class ProposalsView extends StatelessWidget {
const ProposalsView({super.key});

Expand Down Expand Up @@ -91,37 +95,77 @@ class ProposalsView extends StatelessWidget {
final List<int>? daoIds = GetIt.I.get<FilterProposalsBloc>().daoIds;
final List<ProposalModel> proposals = daoIds != null ? state.proposals.filterByDao(daoIds) : state.proposals;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 22),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 22,
),
Text(
'${proposals.length} ${context.read<ProposalsBloc>().filterStatus.string} Proposal${proposals.length == 1 ? '' : 's'}',
style: context.hyphaTextTheme.ralMediumBody
.copyWith(color: HyphaColors.midGrey),
padding: const EdgeInsets.symmetric(horizontal: 22),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 22,
),
Text(
'${proposals.length} ${context.read<ProposalsBloc>().filterStatus.string} Proposal${proposals.length == 1 ? '' : 's'}',
style: context.hyphaTextTheme.ralMediumBody
.copyWith(color: HyphaColors.midGrey),
),
const SizedBox(
height: 20,
),
Expanded(
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ProposalsList(proposals,isScrollable: false,),
const SizedBox(
height: 30,
),
Text(
'See Proposals History',
style: context.hyphaTextTheme.ralMediumBody
.copyWith(color: HyphaColors.midGrey),
),
...List.generate(
2,
(index) {
return Container(
margin: const EdgeInsets.symmetric(
vertical: 10),
child: const HyphaProposalHistoryCard(
dao: DaoData(
docId: 67176,
detailsDaoName: 't4rcvben2fe4',
settingsDaoTitle:
'Think-it Collective',
logoIPFSHash:
'QmVB8q28U1bjfi51reQMaU7XwP4FThWj39DrU5G8MriMS9',
logoType: 'png',
settingsDaoUrl:
'think-it-collective'),
subTitle: '1,234 Past Proposals',
));
},
),
const SizedBox(
height: 90,
)
],
),
),
const SizedBox(
height: 20,
),
Expanded(child: ProposalsList(proposals)),
],
),
);
),
],
),
);
},
),
)),
floatingActionButton: IconButton(
onPressed: () {
GetX.Get.to(
() => const FilterProposalsPage(),
transition: GetX.Transition.leftToRight
);
GetX.Get.to(() => const FilterProposalsPage(),
transition: GetX.Transition.leftToRight);
},
icon: const CircleAvatar(
radius: 30,
radius: 25,
backgroundImage: AssetImage(
'assets/images/graphics/wallet_background.png'),
child: Icon(Icons.filter_alt_outlined,
Expand Down
Loading