Comments (3)
Please need support on this ASAP.
from stream-chat-flutter.
Hey @adityasethipsi 👋
This usually occurs in a situation when the StreamChat
widget is inaccessible by the Stream widget using the theme. Try checking through how you're using any navigation.
As for the sample you provided, the same works for me on 7.2.1 - here is a complete sample using your code if you want to run this yourself:
(Paste this in your main.dart and hit run)
// ignore_for_file: public_member_api_docs
import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
/// Create a new instance of [StreamChatClient] passing the apikey obtained
/// from your project dashboard.
final client = StreamChatClient(
's2dxdhpxd94g',
logLevel: Level.OFF,
);
/// Set the current user and connect the websocket. In a production
/// scenario, this should be done using a backend to generate a user token
/// using our server SDK.
///
/// Please see the following for more information:
/// https://getstream.io/chat/docs/ios_user_setup_and_tokens/
await client.connectUser(
User(id: 'super-band-9'),
'''eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A''',
);
runApp(
StreamChatPage(
client: client,
),
);
}
class StreamChatPage extends StatefulWidget {
final StreamChatClient client;
const StreamChatPage({
super.key,
required this.client,
});
@override
StreamChatPageState createState() => StreamChatPageState();
}
class StreamChatPageState extends State<StreamChatPage> {
late Channel channel;
StreamChatPageState();
@override
void dispose() {
channel.stopWatching();
channel.dispose();
super.dispose();
}
@override
void initState() {
super.initState();
channel = widget.client.channel(
'messaging',
id: 'flutterDevs',
);
}
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
channel.watch();
});
final theme = ThemeData(
primarySwatch: Colors.green,
);
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
// themeMode: ThemeMode.dark,
supportedLocales: const [
Locale('en'),
Locale('hi'),
Locale('fr'),
Locale('it'),
Locale('es'),
],
builder: (context, a) => StreamChat(
client: widget.client,
child: a ?? Container(),
),
home: StreamChannel(
channel: channel,
child: ChannelPage(channel),
),
);
}
}
class ChannelPage extends StatefulWidget {
final Channel channel;
const ChannelPage(this.channel);
@override
_ChannelPageState createState() => _ChannelPageState();
}
class _ChannelPageState extends State<ChannelPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: StreamMessageListView(
messageBuilder: (p0, p1, p2, defaultMessageWidget) {
return defaultMessageWidget.copyWith(
showDeleteMessage: true,
showEditMessage: true,
showReactionPicker: true,
showReactions: true,
showReplyMessage: true,
);
StreamMessageWidget;
},
),
),
const StreamMessageInput(
allowedAttachmentPickerTypes: [AttachmentPickerType.files],
),
],
),
);
}
}
const riveStreamReactionAnimations = [
RiveStreamReaction(
type: 'love',
artboard: 'love',
artboardHighlighted: 'love_highlight',
),
RiveStreamReaction(
type: 'like',
artboard: 'like',
artboardHighlighted: 'like_highlight',
),
RiveStreamReaction(
type: 'sad',
artboard: 'sad',
artboardHighlighted: 'sad_highlight',
),
RiveStreamReaction(
type: 'haha',
artboard: 'haha',
artboardHighlighted: 'haha_highlight',
),
RiveStreamReaction(
type: 'wow',
artboard: 'wow',
artboardHighlighted: 'wow_highlight',
),
];
@immutable
class RiveStreamReaction {
final String type;
final String artboard;
final String artboardHighlighted;
const RiveStreamReaction({
required this.type,
required this.artboard,
required this.artboardHighlighted,
});
}
class ReactionPicker extends StatelessWidget {
final Message message;
final void Function(String) onReactionTap;
const ReactionPicker({
Key? key,
required this.message,
required this.onReactionTap,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Wrap(
children: [
IconButton(
icon: const Text('😀'),
onPressed: () => onReactionTap('smile'),
),
IconButton(
icon: const Text('😢'),
onPressed: () => onReactionTap('sad'),
),
IconButton(
icon: const Text('👍'),
onPressed: () => onReactionTap('thumbs_up'),
),
IconButton(
icon: const Text('❤️'),
onPressed: () => onReactionTap('heart'),
),
],
);
}
}
Let me know if there's something I'm missing here. If you're still getting this error after trying the sample above, please add the code you're using to connect and get until the messaging page. Thanks.
from stream-chat-flutter.
Closing this for now as I cannot replicate the bug with your code but feel free to reopen this if needed. Thanks!
from stream-chat-flutter.
Related Issues (20)
- Poor performance with sending images and files > 10Mb HOT 3
- Cooldown does not update HOT 3
- Pagination Limit not working for Message List Core HOT 4
- Can't build flutter app on flutter SDK v3.22.2 and Dart v3.4.3 due to dependent package using deprecated textTheme property "bodyText1" HOT 7
- Default attachment preview is not working, after adding custom attachment builder HOT 2
- Channel.membership field is not updated HOT 6
- Hide some opinionated widgets HOT 2
- In Flutter Web in debug mode after hot restart the web-socket connection isn't disposed HOT 3
- Copy Message is not working HOT 1
- Race condition with persist when creating a channel and deleting it right away HOT 3
- Not able to select multiple attachments from file explorer HOT 2
- StreamChannelHeader with title and subtitle causes overflow when higher text scale is used HOT 3
- App not loading with stream_chat_flutter > 7.1.0 HOT 3
- User Avatar Not Showing HOT 1
- Slide to reply HOT 1
- Messages that are sent from different users at almost the same time appears in incorrect order HOT 1
- Allow using native HTTP HOT 1
- Execution failed for task ':desktop_drop:compileDebugKotlin'. HOT 1
- Application crashes when the user pastes text HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stream-chat-flutter.