-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add invite and promote functions to Spaces & integrate in examp…
…le app (#64) * Add inviteToPromote method in Space class * Add acceptPromotionInvite, rejectPromotionInvite and _completePromotionInvite in Space class * Revert naming of META_SPACE_SPEAKER_PRIVILEGE * Add socket handling logic for promotion invites & code cleanup * feat: add spaces request screen * feat: add popular spaces * feat: add spaces tabs * feat: add new chat tab * feat: add new accounts view * feat: add end() method in Space class * chore: rename get_spaces.dart to spaces.dart * update: refactor by_you to hosted_by_you * chore: rename byYou to hostedByYou * chore: combine your_spaces files * chore: rename trendingSpaces to trending & fix typo in popular_space_provider * chore: delete unuseed file * feat: add pendingInvites get property in Space class * Fix error in space invites dialog * feat: add end space * feat: add auto end space logic for speakers and listerners * feat: add promotion invite * fix listener not promoted on accept promotion invite * fix: only show group requests for members and not creator --------- Co-authored-by: Madhur Gupta <[email protected]> Co-authored-by: Gbogboade Ayomide <[email protected]>
- Loading branch information
1 parent
3701f57
commit 94214aa
Showing
22 changed files
with
931 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
example/lib/views/spaces/live_space/send_space_invite_dialog.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:push_restapi_dart/push_restapi_dart.dart'; | ||
|
||
import '../../../__lib.dart'; | ||
|
||
class SendSpaceInviteDialog extends StatefulWidget { | ||
const SendSpaceInviteDialog( | ||
{super.key, required this.spaceId, required this.isSpeaker}); | ||
final String spaceId; | ||
final bool isSpeaker; | ||
|
||
@override | ||
State<SendSpaceInviteDialog> createState() => _SendSpaceInviteDialogState(); | ||
} | ||
|
||
class _SendSpaceInviteDialogState extends State<SendSpaceInviteDialog> { | ||
TextEditingController controller = TextEditingController(); | ||
bool isSpeaker = false; | ||
|
||
onSend() async { | ||
try { | ||
final address = controller.text.trim(); | ||
|
||
if (!isValidETHAddress(address)) { | ||
showMyDialog( | ||
context: context, title: 'Send invite', message: 'Invalid Address'); | ||
return; | ||
} | ||
|
||
showLoadingDialog(); | ||
|
||
if (isSpeaker) { | ||
await addSpeakers(spaceId: widget.spaceId, speakers: [address]); | ||
} else { | ||
await addListeners(spaceId: widget.spaceId, listeners: [address]); | ||
} | ||
|
||
pop(); | ||
pop(); | ||
showSuccessSnackbar('Invite sent successfully'); | ||
} catch (e) {} | ||
} | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
init(); | ||
} | ||
|
||
init() { | ||
setState(() { | ||
isSpeaker = widget.isSpeaker; | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
height: 640, | ||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), | ||
decoration: BoxDecoration( | ||
gradient: LinearGradient( | ||
begin: Alignment.topCenter, | ||
end: Alignment.bottomCenter, | ||
colors: [ | ||
Colors.white, | ||
Colors.purple.withOpacity(.5), | ||
]), | ||
borderRadius: BorderRadius.only( | ||
topLeft: Radius.circular(36), | ||
topRight: Radius.circular(36), | ||
), | ||
color: Colors.white), | ||
child: Column( | ||
children: [ | ||
KText( | ||
'Send Space Invite', | ||
weight: FontWeight.w600, | ||
), | ||
Expanded( | ||
child: ListView( | ||
children: [ | ||
SizedBox(height: 24), | ||
InputField( | ||
label: 'Address', | ||
hintText: '0xB6E3Dc6b35..............', | ||
controller: controller, | ||
), | ||
SizedBox(height: 24), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
KText( | ||
'Listerner', | ||
color: Colors.white, | ||
), | ||
SizedBox(width: 10), | ||
CupertinoSwitch( | ||
value: isSpeaker, | ||
onChanged: (value) { | ||
setState(() { | ||
isSpeaker = value; | ||
}); | ||
}, | ||
), | ||
SizedBox(width: 10), | ||
KText( | ||
'Speaker', | ||
color: Colors.white, | ||
), | ||
], | ||
), | ||
SizedBox(height: 24), | ||
MaterialButton( | ||
color: pushColor, | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(16)), | ||
onPressed: onSend, | ||
textColor: Colors.white, | ||
child: Center(child: Text('Send')), | ||
padding: EdgeInsets.all(16), | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.