-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from hypha-dao/feat/implement-outcome-selecti…
…on-screen feat: Implement proposal outcome type selection screen
- Loading branch information
Showing
5 changed files
with
169 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
class OutcomeModel { | ||
final IconData icon; | ||
final String type; | ||
final String details; | ||
|
||
OutcomeModel({required this.icon, required this.type, required this.details}); | ||
} |
78 changes: 78 additions & 0 deletions
78
lib/ui/proposals/creation/components/hypha_outcome_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:hypha_wallet/core/network/models/outcome_model.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'; | ||
|
||
class HyphaOutcomeCard extends StatelessWidget { | ||
final OutcomeModel outcomeModel; | ||
final dynamic valueNotifier; | ||
final int index; | ||
|
||
const HyphaOutcomeCard(this.outcomeModel, this.valueNotifier, this.index, | ||
{super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: () { | ||
if (valueNotifier.value != index) { | ||
valueNotifier.value = index; | ||
} | ||
}, | ||
child: HyphaCard( | ||
child: Container( | ||
padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 20), | ||
child: Column( | ||
children: [ | ||
Row( | ||
children: [ | ||
Transform.rotate( | ||
angle: index == 1 ? -3.14 / 3 : 0, | ||
child: Icon( | ||
outcomeModel.icon, | ||
color: HyphaColors.primaryBlu, | ||
size: 24, | ||
), | ||
), | ||
const SizedBox( | ||
width: 6, | ||
), | ||
Text( | ||
outcomeModel.type, | ||
style: context.hyphaTextTheme.smallTitles, | ||
), | ||
const Spacer(), | ||
ValueListenableBuilder<dynamic>( | ||
valueListenable: valueNotifier, | ||
builder: (context, selectedIndex, child) { | ||
return CircleAvatar( | ||
radius: 12, | ||
backgroundColor: selectedIndex == index | ||
? HyphaColors.primaryBlu | ||
: HyphaColors.midGrey.withOpacity(.3), | ||
child: CircleAvatar( | ||
radius: selectedIndex == index ? 4 : 10.5, | ||
backgroundColor: selectedIndex == index | ||
? HyphaColors.white | ||
: HyphaColors.lightBlack, | ||
), | ||
); | ||
}, | ||
), | ||
], | ||
), | ||
const SizedBox( | ||
height: 15, | ||
), | ||
Text( | ||
outcomeModel.details, | ||
style: context.hyphaTextTheme.ralMediumBody | ||
.copyWith(color: HyphaColors.midGrey), | ||
), | ||
], | ||
), | ||
)), | ||
); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
lib/ui/proposals/creation/components/outcome_selection_view.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:hypha_wallet/core/network/models/outcome_model.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/creation/components/hypha_outcome_card.dart'; | ||
|
||
class DaoSelectionView extends StatelessWidget { | ||
DaoSelectionView({super.key}); | ||
|
||
final List<OutcomeModel> outcomeTypes = [ | ||
OutcomeModel( | ||
icon: CupertinoIcons.hand_thumbsup, | ||
type: 'Agreement', | ||
details: | ||
'A Proposal where other DAO members are simply asked to vote Yes or No.'), | ||
OutcomeModel( | ||
icon: Icons.fiber_smart_record_outlined, | ||
type: 'One Time Payment', | ||
details: | ||
'Attach a payment request to your proposal. You will be asked to chose a token and specify an amount in a following step.'), | ||
OutcomeModel( | ||
icon: Icons.calendar_month_outlined, | ||
type: 'Recurring Payment', | ||
details: | ||
'Think at this outcome as something like a job position. You will be asked to define token, duration and amount per week or month in a following step.'), | ||
]; | ||
|
||
final ValueNotifier<int> selectedTypeIndexNotifier = ValueNotifier<int>(0); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
height: MediaQuery.sizeOf(context).height, | ||
color: context.isDarkMode ? HyphaColors.darkBlack : HyphaColors.offWhite, | ||
padding: const EdgeInsets.symmetric(horizontal: 20), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
const SizedBox(height: 20), | ||
Text( | ||
'Outcome', | ||
style: context.hyphaTextTheme.smallTitles | ||
.copyWith(color: HyphaColors.primaryBlu), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(top: 20, bottom: 30), | ||
child: Text( | ||
'This last step allows you to choose among three types of outcome for your proposal.', | ||
style: context.hyphaTextTheme.ralMediumBody | ||
.copyWith(color: HyphaColors.midGrey), | ||
), | ||
), | ||
...List.generate( | ||
outcomeTypes.length, | ||
(index) { | ||
return Container( | ||
margin: const EdgeInsets.symmetric(vertical: 10), | ||
child: HyphaOutcomeCard( | ||
outcomeTypes[index], selectedTypeIndexNotifier, index), | ||
); | ||
}, | ||
) | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters