fix example
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
> The official Flutter core components for Stream Chat, a service for
|
||||
> building chat applications.
|
||||
|
||||
[](https://pub.dartlang.org/packages/stream_chat_flutter)
|
||||
[](https://pub.dartlang.org/packages/stream_chat_flutter_core)
|
||||

|
||||
[](https://gitter.im/GetStream/stream-chat-flutter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||

|
||||
|
||||
@@ -5,10 +5,7 @@ import 'package:stream_chat_persistence/stream_chat_persistence.dart';
|
||||
Future<void> main() async {
|
||||
/// Create a new instance of [StreamChatClient] passing the apikey obtained from your
|
||||
/// project dashboard.
|
||||
final client = StreamChatClient(
|
||||
'b67pax5b2wdq',
|
||||
logLevel: Level.INFO,
|
||||
);
|
||||
final client = StreamChatClient('b67pax5b2wdq');
|
||||
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@@ -178,15 +175,6 @@ class _MessageViewState extends State<MessageView> {
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
StreamBuilder<List<Message>>(
|
||||
initialData: widget.channel.state.pinnedMessages,
|
||||
stream: widget.channel.state.pinnedMessagesStream,
|
||||
builder: (context, snap) {
|
||||
return Column(
|
||||
children: snap.data?.map((p) => Text(p.text))?.toList() ?? [],
|
||||
);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
@@ -195,17 +183,11 @@ class _MessageViewState extends State<MessageView> {
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final item = _messages[index];
|
||||
if (item.user.id == widget.channel.client.uid) {
|
||||
return GestureDetector(
|
||||
onLongPress: () {
|
||||
print('pinning');
|
||||
widget.channel.pinMessage(item, 120);
|
||||
},
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(item.text),
|
||||
),
|
||||
return Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(item.text),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user