fix example
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
> The official Flutter core components for Stream Chat, a service for
|
> The official Flutter core components for Stream Chat, a service for
|
||||||
> building chat applications.
|
> 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)
|
[](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 {
|
Future<void> main() async {
|
||||||
/// Create a new instance of [StreamChatClient] passing the apikey obtained from your
|
/// Create a new instance of [StreamChatClient] passing the apikey obtained from your
|
||||||
/// project dashboard.
|
/// project dashboard.
|
||||||
final client = StreamChatClient(
|
final client = StreamChatClient('b67pax5b2wdq');
|
||||||
'b67pax5b2wdq',
|
|
||||||
logLevel: Level.INFO,
|
|
||||||
);
|
|
||||||
|
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
@@ -178,15 +175,6 @@ class _MessageViewState extends State<MessageView> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
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(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
@@ -195,17 +183,11 @@ class _MessageViewState extends State<MessageView> {
|
|||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final item = _messages[index];
|
final item = _messages[index];
|
||||||
if (item.user.id == widget.channel.client.uid) {
|
if (item.user.id == widget.channel.client.uid) {
|
||||||
return GestureDetector(
|
return Align(
|
||||||
onLongPress: () {
|
alignment: Alignment.centerRight,
|
||||||
print('pinning');
|
child: Padding(
|
||||||
widget.channel.pinMessage(item, 120);
|
padding: const EdgeInsets.all(8.0),
|
||||||
},
|
child: Text(item.text),
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(item.text),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user