experiment with streambuilder
This commit is contained in:
@@ -83,14 +83,14 @@ class ChannelImage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final streamChat = StreamChat.of(context);
|
||||
final channel = this.channel ?? StreamChannel.of(context).channel;
|
||||
return StreamBuilder<Map<String, dynamic>>(
|
||||
return BetterStreamBuilder<Map<String, dynamic>>(
|
||||
stream: channel.extraDataStream,
|
||||
initialData: channel.extraData,
|
||||
builder: (context, snapshot) {
|
||||
String? image;
|
||||
final chatThemeData = StreamChatTheme.of(context);
|
||||
if (snapshot.data!.containsKey('image') == true) {
|
||||
image = snapshot.data!['image'];
|
||||
if (snapshot.containsKey('image') == true) {
|
||||
image = snapshot['image'];
|
||||
} else if (channel.state?.members.length == 2) {
|
||||
final otherMember = channel.state?.members
|
||||
.firstWhere((member) => member.user?.id != streamChat.user?.id);
|
||||
@@ -153,9 +153,7 @@ class ChannelImage extends StatelessWidget {
|
||||
imageUrl: image,
|
||||
errorWidget: (_, __, ___) => Center(
|
||||
child: Text(
|
||||
snapshot.data?.containsKey('name') ?? false
|
||||
? snapshot.data!['name'][0]
|
||||
: '',
|
||||
snapshot.containsKey('name') ? snapshot['name'][0] : '',
|
||||
style: TextStyle(
|
||||
color: chatThemeData.colorTheme.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
Reference in New Issue
Block a user