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
Widget body(BuildContext context) { | |
return FutureBuilder( | |
future: getGroupChannels(), | |
builder: (context, snapshot) { | |
if (snapshot.hasData == false || snapshot.data == null) { | |
// Nothing to display yet - good place for a loading indicator | |
return Container(); | |
} | |
List<GroupChannel> channels = snapshot.data; | |
return ListView.builder( |
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
Widget navigationBar() { | |
return AppBar( | |
automaticallyImplyLeading: true, | |
backgroundColor: Colors.white, | |
centerTitle: true, | |
leading: BackButton(color: Theme.of(context).primaryColor), | |
title: Text( | |
'Channels', | |
style: TextStyle(color: Colors.black), | |
), |
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
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: navigationBar(), | |
body: body(context), | |
); | |
} |
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
import 'package:flutter/material.dart'; | |
class LoginView extends StatefulWidget { | |
@override | |
LoginViewState createState() => LoginViewState(); | |
} | |
class LoginViewState extends State<LoginView> { | |
@override | |
Widget build(BuildContext context) { |
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
import 'package:flutter/material.dart'; | |
import 'login_view.dart'; | |
import 'channel_list_view.dart'; | |
import 'create_channel_view.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
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
Future<List<User>> getUsers() async { | |
try { | |
final query = ApplicationUserListQuery(); | |
List<User> users = await query.loadNext(); | |
return users; | |
} catch (e) { | |
print('getUsers: ERROR: $e'); | |
return []; | |
} | |
} |
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
Widget body(BuildContext context) { | |
return ListView.builder( | |
itemCount: _availableUsers.length, | |
itemBuilder: (context, index) { | |
User user = _availableUsers[index]; | |
return CheckboxListTile( | |
title: Text(user.nickname.isEmpty ? user.userId : user.nickname, | |
style: TextStyle(color: Colors.black)), | |
controlAffinity: ListTileControlAffinity.platform, | |
value: _selectedUsers.contains(user), |
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
Widget navigationBar() { | |
return AppBar( | |
automaticallyImplyLeading: true, | |
backgroundColor: Colors.white, | |
centerTitle: true, | |
leading: BackButton(color: Theme.of(context).buttonColor), | |
title: Text( | |
'Select members', | |
style: TextStyle(color: Colors.black), | |
), |
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
import 'package:flutter/material.dart'; | |
import 'package:dash_chat/dash_chat.dart'; | |
import 'package:sendbird_sdk/sendbird_sdk.dart'; | |
class GroupChannelView extends StatefulWidget { | |
final GroupChannel groupChannel; | |
GroupChannelView({Key key, @required this.groupChannel}) : super(key: key); | |
@override | |
_GroupChannelViewState createState() => _GroupChannelViewState(); |
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
Widget body(BuildContext context) { | |
ChatUser user = asDashChatUser(SendbirdSdk().currentUser); | |
return Padding( | |
// A little breathing room for devices with no home button. | |
padding: const EdgeInsets.fromLTRB(8, 8, 8, 40), | |
child: DashChat( | |
dateFormat: DateFormat("E, MMM d"), | |
timeFormat: DateFormat.jm(), | |
showUserAvatar: true, | |
key: Key(widget.groupChannel.channelUrl), |