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

refactor: Swap positions of the filter button and the new proposal button #334

Merged
merged 1 commit into from
Oct 1, 2024
Merged
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
184 changes: 100 additions & 84 deletions lib/ui/proposals/list/components/proposals_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
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/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 All @@ -13,14 +13,12 @@ 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 @@ -92,84 +90,89 @@ class ProposalsView extends StatelessWidget {
child: HyphaBodyWidget(
pageState: state.pageState,
success: (context) {
final List<int>? daoIds = GetIt.I.get<FilterProposalsBloc>().daoIds;
final List<ProposalModel> proposals = daoIds != null ? state.proposals.filterByDao(daoIds) : state.proposals;
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),
),
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,
)
],
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: 100,
)
],
),
),
),
),
],
),
);
],
),
);
},
),
)),
floatingActionButton: IconButton(
onPressed: () {
GetX.Get.to(() => const FilterProposalsPage(),
transition: GetX.Transition.leftToRight);
},
onPressed: () {},
icon: const CircleAvatar(
radius: 25,
radius: 30,
backgroundImage: AssetImage(
'assets/images/graphics/wallet_background.png'),
child: Icon(Icons.filter_alt_outlined,
color: HyphaColors.white))),
child: Icon(Icons.add, color: HyphaColors.white))),
));
});
}
Expand All @@ -182,28 +185,41 @@ class _NewProposalButton extends StatelessWidget {
Widget build(BuildContext context) {
return Row(
children: [
Text(
'New Proposal',
style: context.hyphaTextTheme.regular
.copyWith(color: Colors.white, fontSize: 12),
),
const SizedBox(width: 10),
GestureDetector(
onTap: () {},
onTap: () {
GetX.Get.to(() => const FilterProposalsPage(),
transition: GetX.Transition.leftToRight);
},
child: Container(
width: 38,
padding: const EdgeInsets.symmetric(horizontal: 8),
height: 38,
decoration: BoxDecoration(
color: context.isDarkMode
? HyphaColors.darkBlack
: HyphaColors.offWhite,
borderRadius: BorderRadius.circular(12),
),
child: Icon(Icons.add_outlined,
size: 25,
color: context.isDarkMode
? HyphaColors.white
: HyphaColors.darkBlack),
child: Row(
children: [
const SizedBox(
width: 8,
),
Text(
'Filter',
style: context.hyphaTextTheme.regular
.copyWith(color: Colors.white, fontSize: 13),
),
const SizedBox(
width: 4,
),
Icon(Icons.filter_list_rounded,
size: 25,
color: context.isDarkMode
? HyphaColors.white
: HyphaColors.darkBlack),
],
),
),
),
],
Expand Down
Loading