|
| 1 | +part of 'proposal_builder_segments.dart'; |
| 2 | + |
| 3 | +class _CategoryDetails extends StatelessWidget { |
| 4 | + final DocumentProperty property; |
| 5 | + |
| 6 | + const _CategoryDetails({required this.property}); |
| 7 | + |
| 8 | + @override |
| 9 | + Widget build(BuildContext context) { |
| 10 | + return BlocSelector<ProposalBuilderBloc, ProposalBuilderState, |
| 11 | + CampaignCategoryDetailsViewModel?>( |
| 12 | + selector: (state) => state.category, |
| 13 | + builder: (context, category) { |
| 14 | + if (category == null) { |
| 15 | + return const Offstage(); |
| 16 | + } |
| 17 | + |
| 18 | + return Column( |
| 19 | + mainAxisSize: MainAxisSize.min, |
| 20 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 21 | + children: [ |
| 22 | + Text( |
| 23 | + category.name, |
| 24 | + style: Theme.of(context).textTheme.titleSmall, |
| 25 | + ), |
| 26 | + const SizedBox(height: 8), |
| 27 | + Text( |
| 28 | + category.subname, |
| 29 | + style: Theme.of(context).textTheme.headlineMedium, |
| 30 | + ), |
| 31 | + const SizedBox(height: 20), |
| 32 | + _Stats(category: category), |
| 33 | + const SizedBox(height: 20), |
| 34 | + Text( |
| 35 | + context.l10n.shortSummary, |
| 36 | + style: Theme.of(context).textTheme.titleSmall, |
| 37 | + ), |
| 38 | + const SizedBox(height: 8), |
| 39 | + Text( |
| 40 | + category.description, |
| 41 | + style: Theme.of(context).textTheme.bodyLarge, |
| 42 | + ), |
| 43 | + ], |
| 44 | + ); |
| 45 | + }, |
| 46 | + ); |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +class _Stats extends StatelessWidget { |
| 51 | + final CampaignCategoryDetailsViewModel category; |
| 52 | + |
| 53 | + const _Stats({required this.category}); |
| 54 | + |
| 55 | + @override |
| 56 | + Widget build(BuildContext context) { |
| 57 | + return Row( |
| 58 | + children: [ |
| 59 | + Expanded( |
| 60 | + child: _StatsItem( |
| 61 | + label: context.l10n.fundsAvailable, |
| 62 | + value: category.availableFunds, |
| 63 | + ), |
| 64 | + ), |
| 65 | + Expanded( |
| 66 | + child: _StatsItem( |
| 67 | + label: context.l10n.minBudgetRequest, |
| 68 | + value: category.range.min, |
| 69 | + ), |
| 70 | + ), |
| 71 | + Expanded( |
| 72 | + child: _StatsItem( |
| 73 | + label: context.l10n.maxBudgetRequest, |
| 74 | + value: category.range.max, |
| 75 | + ), |
| 76 | + ), |
| 77 | + ], |
| 78 | + ); |
| 79 | + } |
| 80 | +} |
| 81 | + |
| 82 | +class _StatsItem extends StatelessWidget { |
| 83 | + final String label; |
| 84 | + final Coin value; |
| 85 | + |
| 86 | + const _StatsItem({ |
| 87 | + required this.label, |
| 88 | + required this.value, |
| 89 | + }); |
| 90 | + |
| 91 | + @override |
| 92 | + Widget build(BuildContext context) { |
| 93 | + return Column( |
| 94 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 95 | + mainAxisSize: MainAxisSize.min, |
| 96 | + children: [ |
| 97 | + Text( |
| 98 | + CryptocurrencyFormatter.formatAmount(value), |
| 99 | + style: Theme.of(context).textTheme.titleLarge, |
| 100 | + ), |
| 101 | + Text( |
| 102 | + label, |
| 103 | + style: Theme.of(context).textTheme.bodySmall, |
| 104 | + ), |
| 105 | + ], |
| 106 | + ); |
| 107 | + } |
| 108 | +} |
0 commit comments