1- import 'dart:async' ;
2-
31import 'package:catalyst_voices/common/constants/constants.dart' ;
42import 'package:catalyst_voices/common/ext/build_context_ext.dart' ;
5- import 'package:catalyst_voices/widgets/buttons/copy_catalyst_id_button.dart' ;
6- import 'package:catalyst_voices/widgets/snackbar/voices_snackbar.dart' ;
7- import 'package:catalyst_voices/widgets/snackbar/voices_snackbar_type.dart' ;
3+ import 'package:catalyst_voices/pages/spaces/drawer/session_account_drawer_catalyst_id.dart' ;
84import 'package:catalyst_voices/widgets/widgets.dart' ;
95import 'package:catalyst_voices_assets/catalyst_voices_assets.dart' ;
10- import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart' ;
116import 'package:catalyst_voices_localization/catalyst_voices_localization.dart' ;
12- import 'package:catalyst_voices_models/catalyst_voices_models.dart' ;
137import 'package:catalyst_voices_shared/catalyst_voices_shared.dart' ;
148import 'package:flutter/material.dart' ;
15- import 'package:flutter/services.dart' ;
169
1710class OpportunitiesDrawer extends StatelessWidget {
1811 const OpportunitiesDrawer ({super .key});
@@ -57,58 +50,46 @@ class _BecomeReviewerCard extends StatelessWidget with LaunchUrlMixin {
5750 Widget build (BuildContext context) {
5851 return _OpportunityCard (
5952 background: VoicesAssets .images.opportunities.reviewer.path,
60- child: Padding (
61- padding: const EdgeInsets .only (
62- top: 28 ,
63- left: 24 ,
64- ),
65- child: Column (
66- mainAxisSize: MainAxisSize .min,
67- crossAxisAlignment: CrossAxisAlignment .start,
68- children: [
69- SizedBox (
70- width: 198 ,
71- child: Text (
72- context.l10n.turnOpinionsIntoActions,
73- style: context.textTheme.headlineMedium? .copyWith (
74- color: context.colorScheme.primary,
75- ),
76- ),
77- ),
78- const SizedBox (height: 15 ),
79- CopyCatalystIdButton (onTap: () => _handleCopyCatalystId (context)),
80- const SizedBox (height: 4 ),
81- _OpportunityActionButton (
82- onTap: () async {
83- await launchUri (VoicesConstants .becomeReviewerUrl.getUri ());
84- },
85- title: context.l10n.becomeReviewer,
86- trailing: VoicesAssets .icons.externalLink.buildIcon (),
53+ widthFactor: 0.6 ,
54+ alignment: Alignment .centerLeft,
55+ child: Column (
56+ mainAxisSize: MainAxisSize .min,
57+ crossAxisAlignment: CrossAxisAlignment .stretch,
58+ children: [
59+ Text (
60+ context.l10n.turnOpinionsIntoActions,
61+ style: context.textTheme.headlineMedium? .copyWith (
62+ color: context.colorScheme.primary,
63+ height: 1 ,
8764 ),
88- ],
89- ),
65+ ),
66+ const SizedBox (height: 16 ),
67+ const _CopyCatalystIdTipText (),
68+ const SizedBox (height: 16 ),
69+ const SessionAccountDrawerCatalystId (),
70+ const SizedBox (height: 20 ),
71+ _OpportunityActionButton (
72+ onTap: () async {
73+ await launchUri (VoicesConstants .becomeReviewerUrl.getUri ());
74+ },
75+ title: context.l10n.becomeReviewer,
76+ trailing: VoicesAssets .icons.externalLink.buildIcon (),
77+ ),
78+ ],
9079 ),
9180 );
9281 }
82+ }
9383
94- void _copyToClipboard (CatalystId ? text) {
95- unawaited (Clipboard .setData (ClipboardData (text: text.toString ())));
96- }
97-
98- void _handleCopyCatalystId (BuildContext context) {
99- final catalystId = context.read <SessionCubit >().state.account? .catalystId;
100- _copyToClipboard (catalystId);
101- _showSuccessSnackbar (context);
102- }
103-
104- void _showSuccessSnackbar (BuildContext context) {
105- VoicesSnackBar .hideCurrent (context);
84+ class _CopyCatalystIdTipText extends StatelessWidget {
85+ const _CopyCatalystIdTipText ();
10686
107- VoicesSnackBar (
108- type: VoicesSnackBarType .success,
109- behavior: SnackBarBehavior .floating,
110- message: context.l10n.copied,
111- ).show (context);
87+ @override
88+ Widget build (BuildContext context) {
89+ return TipText (
90+ context.l10n.tipCopyCatalystIdForReviewTool,
91+ style: context.textTheme.bodyMedium? .copyWith (color: context.colors.textOnPrimaryLevel1),
92+ );
11293 }
11394}
11495
@@ -167,25 +148,33 @@ class _OpportunityActionButton extends StatelessWidget {
167148
168149class _OpportunityCard extends StatelessWidget {
169150 final String background;
151+ final double widthFactor;
152+ final Alignment alignment;
170153 final Widget child;
171154
172155 const _OpportunityCard ({
173156 required this .background,
157+ required this .widthFactor,
158+ required this .alignment,
174159 required this .child,
175160 });
176161
177162 @override
178163 Widget build (BuildContext context) {
179164 return Container (
180- constraints: BoxConstraints .tight (const Size (426 , 260 )),
181165 decoration: BoxDecoration (
182166 borderRadius: BorderRadius .circular (16 ),
183167 image: DecorationImage (
184168 image: CatalystImage .asset (background).image,
185169 fit: BoxFit .cover,
186170 ),
187171 ),
188- child: child,
172+ padding: const EdgeInsets .symmetric (vertical: 28 , horizontal: 24 ),
173+ alignment: alignment,
174+ child: FractionallySizedBox (
175+ widthFactor: widthFactor,
176+ child: child,
177+ ),
189178 );
190179 }
191180}
@@ -197,39 +186,32 @@ class _RegisterAsVoter extends StatelessWidget with LaunchUrlMixin {
197186 Widget build (BuildContext context) {
198187 return _OpportunityCard (
199188 background: VoicesAssets .images.opportunities.voter.path,
200- child: Align (
201- alignment: Alignment .topRight,
202- child: Padding (
203- padding: const EdgeInsets .only (
204- top: 44 ,
205- right: 24 ,
189+ widthFactor: 0.55 ,
190+ alignment: Alignment .centerRight,
191+ child: Column (
192+ mainAxisSize: MainAxisSize .min,
193+ crossAxisAlignment: CrossAxisAlignment .stretch,
194+ children: [
195+ const SizedBox (height: 16 ),
196+ Text (
197+ context.l10n.f14Voting,
198+ style: context.textTheme.headlineMedium? .copyWith (
199+ color: context.colorScheme.primary,
200+ height: 1 ,
201+ ),
206202 ),
207- child: Column (
208- mainAxisSize: MainAxisSize .min,
209- crossAxisAlignment: CrossAxisAlignment .start,
210- children: [
211- SizedBox (
212- width: 198 ,
213- child: Text (
214- context.l10n.f14Voting,
215- style: context.textTheme.headlineMedium? .copyWith (
216- color: context.colorScheme.primary,
217- ),
218- ),
219- ),
220- const SizedBox (height: 20 ),
221- _OpportunityActionButton (
222- onTap: () async {
223- await launchUri (
224- VoicesConstants .votingRegistrationUrl.getUri (),
225- );
226- },
227- title: context.l10n.votingRegistration,
228- trailing: VoicesAssets .icons.externalLink.buildIcon (),
229- ),
230- ],
203+ const SizedBox (height: 28 ),
204+ _OpportunityActionButton (
205+ onTap: () async {
206+ await launchUri (
207+ VoicesConstants .votingRegistrationUrl.getUri (),
208+ );
209+ },
210+ title: context.l10n.votingRegistration,
211+ trailing: VoicesAssets .icons.externalLink.buildIcon (),
231212 ),
232- ),
213+ const SizedBox (height: 16 ),
214+ ],
233215 ),
234216 );
235217 }
0 commit comments