Skip to content

Commit

Permalink
feat: Implement proposal outcome type selection screen
Browse files Browse the repository at this point in the history
  • Loading branch information
nbetsaif committed Oct 10, 2024
1 parent 335e4fd commit 922804e
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 11 deletions.
20 changes: 10 additions & 10 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ PODS:
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (10.29.0)
- Flutter (1.0.0)
- flutter_keyboard_visibility_temp_fork (0.0.1):
- flutter_keyboard_visibility (0.0.1):
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
Expand Down Expand Up @@ -1293,7 +1293,7 @@ PODS:
- PromisesObjC (2.4.0)
- PromisesSwift (2.4.0):
- PromisesObjC (= 2.4.0)
- quill_native_bridge (0.0.1):
- quill_native_bridge_ios (0.0.1):
- Flutter
- share_plus (0.0.1):
- Flutter
Expand All @@ -1317,15 +1317,15 @@ DEPENDENCIES:
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- firebase_remote_config (from `.symlinks/plugins/firebase_remote_config/ios`)
- Flutter (from `Flutter`)
- flutter_keyboard_visibility_temp_fork (from `.symlinks/plugins/flutter_keyboard_visibility_temp_fork/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- quill_native_bridge (from `.symlinks/plugins/quill_native_bridge/ios`)
- quill_native_bridge_ios (from `.symlinks/plugins/quill_native_bridge_ios/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
Expand Down Expand Up @@ -1390,8 +1390,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_remote_config/ios"
Flutter:
:path: Flutter
flutter_keyboard_visibility_temp_fork:
:path: ".symlinks/plugins/flutter_keyboard_visibility_temp_fork/ios"
flutter_keyboard_visibility:
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
image_cropper:
Expand All @@ -1406,8 +1406,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
quill_native_bridge:
:path: ".symlinks/plugins/quill_native_bridge/ios"
quill_native_bridge_ios:
:path: ".symlinks/plugins/quill_native_bridge_ios/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
Expand Down Expand Up @@ -1446,7 +1446,7 @@ SPEC CHECKSUMS:
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_keyboard_visibility_temp_fork: 442dadca3b81868a225cd6a2f605bffff1215844
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
Expand All @@ -1471,7 +1471,7 @@ SPEC CHECKSUMS:
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
quill_native_bridge: e5afa7d49c08cf68c52a5e23bc272eba6925c622
quill_native_bridge_ios: 277bdf5bf0fa5d7a12999556b415a5c63dd76ec4
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Expand Down
9 changes: 9 additions & 0 deletions lib/core/network/models/outcome_model.dart
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 lib/ui/proposals/creation/components/hypha_outcome_card.dart
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 lib/ui/proposals/creation/components/outcome_selection_view.dart
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),
);
},
)
],
),
);
}
}
4 changes: 3 additions & 1 deletion lib/ui/proposals/creation/proposal_creation_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:hypha_wallet/design/themes/extensions/theme_extension_provider.d
import 'package:hypha_wallet/ui/proposals/creation/components/proposal_creation_view.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';

import 'components/outcome_selection_view.dart';

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

Expand Down Expand Up @@ -63,7 +65,7 @@ class ProposalCreationPage extends StatelessWidget {
],
),
),
body: const ProposalCreationView(),
body: DaoSelectionView(),
);
}
}

0 comments on commit 922804e

Please sign in to comment.