1
1
import 'package:flutter/material.dart' ;
2
2
3
- import 'package:fluffychat/config/themes.dart' ;
3
+ import 'package:flutter_gen/gen_l10n/l10n.dart' ;
4
+
4
5
import 'package:fluffychat/pangea/activity_planner/activity_plan_model.dart' ;
5
- import 'package:fluffychat/pangea/activity_suggestions/activity_suggestion_card_content.dart' ;
6
- import 'package:fluffychat/pangea/activity_suggestions/activity_suggestion_edit_card.dart' ;
7
- import 'package:fluffychat/pangea/activity_suggestions/activity_suggestions_area.dart' ;
6
+ import 'package:fluffychat/pangea/activity_suggestions/activity_suggestion_card_row.dart' ;
8
7
import 'package:fluffychat/pangea/common/widgets/pressable_button.dart' ;
9
8
10
9
class ActivitySuggestionCard extends StatelessWidget {
11
10
final ActivityPlanModel activity;
12
- final ActivitySuggestionsAreaState controller;
13
11
final VoidCallback onPressed;
14
12
15
13
final double width;
16
14
final double height;
15
+ final double padding;
17
16
18
17
const ActivitySuggestionCard ({
19
18
super .key,
20
19
required this .activity,
21
- required this .controller,
22
20
required this .onPressed,
23
21
required this .width,
24
22
required this .height,
23
+ required this .padding,
25
24
});
26
25
27
- bool get _isSelected => controller.selectedActivity == activity;
28
-
29
26
@override
30
27
Widget build (BuildContext context) {
31
28
final theme = Theme .of (context);
32
29
return Padding (
33
- padding: const EdgeInsets .all (8.0 ),
30
+ padding: EdgeInsets .all (padding ),
34
31
child: PressableButton (
35
32
onPressed: onPressed,
36
33
borderRadius: BorderRadius .circular (24.0 ),
37
34
color: theme.colorScheme.primary,
38
- child: AnimatedContainer (
39
- duration: FluffyThemes .animationDuration,
40
- height: controller.isEditing && _isSelected
41
- ? 675
42
- : _isSelected
43
- ? 400
44
- : height,
35
+ child: SizedBox (
36
+ height: height,
45
37
width: width,
46
38
child: Stack (
47
39
alignment: Alignment .topCenter,
@@ -62,10 +54,7 @@ class ActivitySuggestionCard extends StatelessWidget {
62
54
decoration: BoxDecoration (
63
55
image: activity.imageURL != null
64
56
? DecorationImage (
65
- image: controller.avatar == null || ! _isSelected
66
- ? NetworkImage (activity.imageURL! )
67
- : MemoryImage (controller.avatar! )
68
- as ImageProvider <Object >,
57
+ image: NetworkImage (activity.imageURL! ),
69
58
)
70
59
: null ,
71
60
borderRadius: BorderRadius .circular (24.0 ),
@@ -74,40 +63,74 @@ class ActivitySuggestionCard extends StatelessWidget {
74
63
Expanded (
75
64
child: Padding (
76
65
padding: const EdgeInsets .only (
77
- top: 16 .0 ,
66
+ top: 12 .0 ,
78
67
left: 12.0 ,
79
68
right: 12.0 ,
80
69
bottom: 12.0 ,
81
70
),
82
- child: controller.isEditing && _isSelected
83
- ? ActivitySuggestionEditCard (
84
- activity: activity,
85
- controller: controller,
86
- )
87
- : ActivitySuggestionCardContent (
88
- activity: activity,
89
- isSelected: _isSelected,
90
- controller: controller,
71
+ child: Column (
72
+ mainAxisSize: MainAxisSize .min,
73
+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
74
+ children: [
75
+ ActivitySuggestionCardRow (
76
+ icon: Icons .event_note_outlined,
77
+ child: Text (
78
+ activity.title,
79
+ style: const TextStyle (
80
+ fontWeight: FontWeight .bold,
81
+ ),
82
+ maxLines: 1 ,
83
+ overflow: TextOverflow .ellipsis,
84
+ ),
85
+ ),
86
+ ConstrainedBox (
87
+ constraints: const BoxConstraints (maxHeight: 54.0 ),
88
+ child: SingleChildScrollView (
89
+ scrollDirection: Axis .vertical,
90
+ child: Align (
91
+ alignment: Alignment .topLeft,
92
+ child: Wrap (
93
+ spacing: 4.0 ,
94
+ runSpacing: 4.0 ,
95
+ children: activity.vocab
96
+ .map (
97
+ (vocab) => Container (
98
+ padding: const EdgeInsets .symmetric (
99
+ vertical: 4.0 ,
100
+ horizontal: 8.0 ,
101
+ ),
102
+ decoration: BoxDecoration (
103
+ color: theme.colorScheme.primary
104
+ .withAlpha (50 ),
105
+ borderRadius:
106
+ BorderRadius .circular (24.0 ),
107
+ ),
108
+ child: Text (
109
+ vocab.lemma,
110
+ style: theme.textTheme.bodySmall,
111
+ ),
112
+ ),
113
+ )
114
+ .toList (),
115
+ ),
116
+ ),
117
+ ),
118
+ ),
119
+ ActivitySuggestionCardRow (
120
+ icon: Icons .group_outlined,
121
+ child: Text (
122
+ L10n .of (context).countParticipants (
123
+ activity.req.numberOfParticipants,
124
+ ),
125
+ style: theme.textTheme.bodySmall,
91
126
),
127
+ ),
128
+ ],
129
+ ),
92
130
),
93
131
),
94
132
],
95
133
),
96
- if (controller.isEditing && _isSelected)
97
- Positioned (
98
- top: 75.0 ,
99
- child: InkWell (
100
- borderRadius: BorderRadius .circular (90 ),
101
- onTap: controller.selectPhoto,
102
- child: const CircleAvatar (
103
- radius: 16.0 ,
104
- child: Icon (
105
- Icons .add_a_photo_outlined,
106
- size: 16.0 ,
107
- ),
108
- ),
109
- ),
110
- ),
111
134
],
112
135
),
113
136
),
0 commit comments