11import 'package:catalyst_voices/common/ext/build_context_ext.dart' ;
22import 'package:catalyst_voices/common/formatters/date_formatter.dart' ;
33import 'package:catalyst_voices/routes/routing/proposal_builder_route.dart' ;
4- import 'package:catalyst_voices/widgets/cards/proposal_card_widgets .dart' ;
4+ import 'package:catalyst_voices/widgets/cards/proposal/proposal_border .dart' ;
55import 'package:catalyst_voices/widgets/modals/proposals/share_proposal_dialog.dart' ;
66import 'package:catalyst_voices/widgets/text/day_month_time_text.dart' ;
77import 'package:catalyst_voices/widgets/widgets.dart' ;
@@ -50,13 +50,6 @@ class _Author extends StatelessWidget {
5050 child: Row (
5151 mainAxisSize: MainAxisSize .min,
5252 children: [
53- ProfileAvatar (
54- key: const Key ('AuthorAvatar' ),
55- username: author,
56- backgroundColor: context.colors.primaryContainer,
57- foregroundColor: context.colors.textOnPrimaryWhite,
58- ),
59- const SizedBox (width: 8 ),
6053 Text (
6154 key: const Key ('Author' ),
6255 author,
@@ -149,68 +142,64 @@ class _FundsAndDuration extends StatelessWidget {
149142
150143class _PendingProposalCardState extends State <PendingProposalCard > {
151144 late final WidgetStatesController _statesController;
152- late _ProposalBorderColor _border;
153-
154- bool isHovered = false ;
155145
156146 @override
157147 Widget build (BuildContext context) {
158- return SizedBox (
159- height: 454 ,
148+ return ConstrainedBox (
149+ constraints: const BoxConstraints (
150+ minHeight: 454 ,
151+ maxHeight: 454 ,
152+ maxWidth: 326 ,
153+ ),
160154 child: Material (
161155 key: const Key ('ProposalCard' ),
162- color: Colors .transparent,
156+ color: context.colors.elevationsOnSurfaceNeutralLv1White,
157+ borderRadius: BorderRadius .circular (12 ),
163158 child: InkWell (
164159 statesController: _statesController,
165160 onTap: widget.onTap,
166- child: ValueListenableBuilder (
167- valueListenable: _statesController,
168- builder: (context, value, child) => Container (
169- constraints: const BoxConstraints (maxWidth: 326 ),
170- decoration: BoxDecoration (
171- color: context.colors.elevationsOnSurfaceNeutralLv1White,
172- borderRadius: BorderRadius .circular (12 ),
173- border: Border .all (
174- color: _border.resolve (_statesController.value),
175- ),
176- ),
177- child: Padding (
178- padding: const EdgeInsets .all (16 ),
179- child: Column (
180- crossAxisAlignment: CrossAxisAlignment .start,
181- children: [
182- _Topbar (
183- proposalRef: widget.proposal.ref,
184- showStatus: widget.showStatus,
185- isFavorite: widget.isFavorite,
186- onFavoriteChanged: widget.onFavoriteChanged,
187- ),
188- _Category (
189- category: widget.proposal.category,
190- ),
191- const SizedBox (height: 4 ),
192- Expanded (
193- child: _Title (text: widget.proposal.title),
194- ),
195- _Author (author: widget.proposal.author),
196- _FundsAndDuration (
197- funds: widget.proposal.fundsRequested,
198- duration: widget.proposal.duration,
199- ),
200- const SizedBox (height: 12 ),
201- Expanded (
202- child: _Description (text: widget.proposal.description),
203- ),
204- const SizedBox (height: 12 ),
205- _ProposalInfo (
206- proposalStage: widget.proposal.publishStage,
207- version: widget.proposal.version,
208- lastUpdate: widget.proposal.lastUpdateDate,
209- commentsCount: widget.proposal.commentsCount,
210- showLastUpdate: widget.showLastUpdate,
211- ),
212- ],
213- ),
161+ canRequestFocus: true ,
162+ highlightColor: Colors .transparent,
163+ borderRadius: BorderRadius .circular (12 ),
164+ child: ProposalBorder (
165+ publishStage: widget.proposal.publishStage,
166+ statesController: _statesController,
167+ child: Padding (
168+ padding: const EdgeInsets .all (16 ),
169+ child: Column (
170+ crossAxisAlignment: CrossAxisAlignment .start,
171+ children: [
172+ _Topbar (
173+ proposalRef: widget.proposal.ref,
174+ showStatus: widget.showStatus,
175+ isFavorite: widget.isFavorite,
176+ onFavoriteChanged: widget.onFavoriteChanged,
177+ ),
178+ _Category (
179+ category: widget.proposal.category,
180+ ),
181+ const SizedBox (height: 4 ),
182+ Expanded (
183+ child: _Title (text: widget.proposal.title),
184+ ),
185+ _Author (author: widget.proposal.author),
186+ _FundsAndDuration (
187+ funds: widget.proposal.fundsRequested,
188+ duration: widget.proposal.duration,
189+ ),
190+ const SizedBox (height: 12 ),
191+ Expanded (
192+ child: _Description (text: widget.proposal.description),
193+ ),
194+ const SizedBox (height: 12 ),
195+ _ProposalInfo (
196+ proposalStage: widget.proposal.publishStage,
197+ version: widget.proposal.version,
198+ lastUpdate: widget.proposal.lastUpdateDate,
199+ commentsCount: widget.proposal.commentsCount,
200+ showLastUpdate: widget.showLastUpdate,
201+ ),
202+ ],
214203 ),
215204 ),
216205 ),
@@ -219,28 +208,6 @@ class _PendingProposalCardState extends State<PendingProposalCard> {
219208 );
220209 }
221210
222- @override
223- void didChangeDependencies () {
224- super .didChangeDependencies ();
225- _border = _ProposalBorderColor (
226- publishStage: widget.proposal.publishStage,
227- colorScheme: context.colorScheme,
228- colors: context.colors,
229- );
230- }
231-
232- @override
233- void didUpdateWidget (PendingProposalCard oldWidget) {
234- super .didUpdateWidget (oldWidget);
235- if (widget.proposal.publishStage != oldWidget.proposal.publishStage) {
236- _border = _ProposalBorderColor (
237- publishStage: widget.proposal.publishStage,
238- colors: context.colors,
239- colorScheme: context.colorScheme,
240- );
241- }
242- }
243-
244211 @override
245212 void dispose () {
246213 _statesController.dispose ();
@@ -290,32 +257,6 @@ class _PropertyValue extends StatelessWidget {
290257 }
291258}
292259
293- final class _ProposalBorderColor extends WidgetStateColor {
294- final ProposalPublish publishStage;
295- final VoicesColorScheme colors;
296- final ColorScheme colorScheme;
297-
298- _ProposalBorderColor ({
299- required this .publishStage,
300- required this .colors,
301- required this .colorScheme,
302- }) : super (colors.outlineBorder.toARGB32 ());
303-
304- @override
305- Color resolve (Set <WidgetState > states) {
306- if (states.contains (WidgetState .hovered)) {
307- return switch (publishStage) {
308- ProposalPublish .localDraft ||
309- ProposalPublish .publishedDraft =>
310- colorScheme.secondary,
311- ProposalPublish .submittedProposal => colorScheme.primary,
312- };
313- }
314-
315- return colors.elevationsOnSurfaceNeutralLv1White;
316- }
317- }
318-
319260class _ProposalInfo extends StatelessWidget {
320261 final ProposalPublish proposalStage;
321262 final int version;
0 commit comments