Skip to content

Commit 570ef4a

Browse files
authored
Merge pull request #54 from ConnActivity/deleted_join_button
2 parents 7334fde + 459bd02 commit 570ef4a

File tree

1 file changed

+7
-50
lines changed

1 file changed

+7
-50
lines changed

lib/event_detail_view.dart

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,11 @@ class DetailScreen extends StatefulWidget {
2222
}
2323

2424
class _DetailScreenState extends State<DetailScreen> {
25-
bool joint = false;
2625
bool user = false;
2726

2827
@override
2928
void initState() {
3029
super.initState();
31-
if (widget.feedElementData.isMember != null &&
32-
widget.feedElementData.isMember!) {
33-
setState(() {
34-
joint = true;
35-
});
36-
}
3730
is_owner();
3831
}
3932

@@ -136,6 +129,13 @@ class _DetailScreenState extends State<DetailScreen> {
136129
style: const TextStyle(
137130
color: Colors.black, fontSize: 20)),
138131
]),
132+
Row(children: [
133+
const Icon(Icons.people),
134+
Text(
135+
"Joined: ${(data["member_list"]) == null ? "?" : (data["member_list"]).length}",
136+
style: const TextStyle(
137+
color: Colors.black, fontSize: 20)),
138+
]),
139139
],
140140
),
141141
),
@@ -162,49 +162,6 @@ class _DetailScreenState extends State<DetailScreen> {
162162
Row(
163163
mainAxisAlignment: MainAxisAlignment.center,
164164
children: [
165-
Expanded(
166-
flex: 1,
167-
child: Container(
168-
margin: const EdgeInsets.fromLTRB(0, 15, 5, 0),
169-
width: double.infinity,
170-
child: ElevatedButton(
171-
onPressed: () async {
172-
bool response = joint;
173-
if (!joint) {
174-
response = await joinEvent(
175-
widget.feedElementData.id);
176-
} else {
177-
response = await leaveEvent(
178-
widget.feedElementData.id);
179-
response = !response;
180-
}
181-
setState(() {
182-
joint = response;
183-
});
184-
},
185-
style: ButtonStyle(
186-
backgroundColor: joint
187-
? MaterialStateProperty.all(Colors.black)
188-
: MaterialStateProperty.all(
189-
const Color(0xffFE7F2D)),
190-
shape: MaterialStateProperty.all<
191-
RoundedRectangleBorder>(
192-
RoundedRectangleBorder(
193-
borderRadius: BorderRadius.circular(20.0),
194-
))),
195-
child: joint
196-
? const Icon(
197-
Icons.check,
198-
color: Colors.white,
199-
)
200-
: const Text(
201-
"Join",
202-
style: TextStyle(
203-
color: Colors.black, fontSize: 20),
204-
),
205-
),
206-
),
207-
),
208165
Expanded(
209166
flex: 1,
210167
child: user == true

0 commit comments

Comments
 (0)