feat: add a view button to available invites to see participants
This commit is contained in:
parent
c060e26b5a
commit
2de55848f9
@ -6,11 +6,13 @@ import '../../utils/invitation_utils.dart';
|
|||||||
class InvitationDetailsPage extends StatefulWidget {
|
class InvitationDetailsPage extends StatefulWidget {
|
||||||
final int invitationId;
|
final int invitationId;
|
||||||
final bool isOwner;
|
final bool isOwner;
|
||||||
|
final bool isParticipant;
|
||||||
|
|
||||||
const InvitationDetailsPage({
|
const InvitationDetailsPage({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.invitationId,
|
required this.invitationId,
|
||||||
required this.isOwner,
|
required this.isOwner,
|
||||||
|
this.isParticipant = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -505,6 +507,7 @@ class _InvitationDetailsPageState extends State<InvitationDetailsPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
if (widget.isParticipant) ...[
|
||||||
SizedBox(height: 32),
|
SizedBox(height: 32),
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@ -537,6 +540,7 @@ class _InvitationDetailsPageState extends State<InvitationDetailsPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
SizedBox(height: 32),
|
SizedBox(height: 32),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -144,13 +144,14 @@ class _InvitationsPageState extends State<InvitationsPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _navigateToInvitationDetails(Invitation invitation, bool isOwner) async {
|
Future<void> _navigateToInvitationDetails(Invitation invitation, bool isOwner, {bool isParticipant = true}) async {
|
||||||
final result = await Navigator.push(
|
final result = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => InvitationDetailsPage(
|
builder: (context) => InvitationDetailsPage(
|
||||||
invitationId: invitation.id,
|
invitationId: invitation.id,
|
||||||
isOwner: isOwner,
|
isOwner: isOwner,
|
||||||
|
isParticipant: isParticipant,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -318,6 +319,74 @@ class _InvitationsPageState extends State<InvitationsPage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
|
if (!isOwned && !isAccepted && !hasBeenAccepted)
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 44,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
_navigateToInvitationDetails(invitation, false, isParticipant: false);
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.grey[600],
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
elevation: 2,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'View',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 44,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: isAccepting
|
||||||
|
? null
|
||||||
|
: () {
|
||||||
|
_acceptInvitation(invitation);
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Color(0xFF6A4C93),
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
elevation: 2,
|
||||||
|
),
|
||||||
|
child: isAccepting
|
||||||
|
? SizedBox(
|
||||||
|
height: 20,
|
||||||
|
width: 20,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Text(
|
||||||
|
'Accept Invite',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
else
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 44,
|
height: 44,
|
||||||
@ -334,7 +403,7 @@ class _InvitationsPageState extends State<InvitationsPage>
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: (isAccepted || hasBeenAccepted)
|
backgroundColor: (isAccepted || hasBeenAccepted)
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: (isOwned ? Color(0xFF6A4C93) : Color(0xFF6A4C93)),
|
: Color(0xFF6A4C93),
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -354,7 +423,6 @@ class _InvitationsPageState extends State<InvitationsPage>
|
|||||||
? AnimatedBuilder(
|
? AnimatedBuilder(
|
||||||
animation: animController,
|
animation: animController,
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
if (animController.value < 0.5) {
|
|
||||||
return Text(
|
return Text(
|
||||||
'View',
|
'View',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -362,15 +430,6 @@ class _InvitationsPageState extends State<InvitationsPage>
|
|||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
return Text(
|
|
||||||
'View',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user