diff --git a/packages/stream_chat_flutter/analysis_options.yaml b/packages/stream_chat_flutter/analysis_options.yaml index 8d6f9064..36d1fbb7 100644 --- a/packages/stream_chat_flutter/analysis_options.yaml +++ b/packages/stream_chat_flutter/analysis_options.yaml @@ -46,7 +46,7 @@ linter: - package_prefixed_library_names - prefer_is_not_empty # - prefer_mixin # https://github.com/dart-lang/language/issues/32 - - public_member_api_docs + # - public_member_api_docs - slash_for_doc_comments # - sort_constructors_first # - sort_unnamed_constructors_first diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index d2d691e9..31ed8711 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -2,11 +2,17 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; void main() async { + /// Create a new instance of [StreamChatClient] passing the apikey obtained from your + /// project dashboard. final client = StreamChatClient( 's2dxdhpxd94g', logLevel: Level.INFO, ); + /// Set the current user. 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.setUser( User(id: 'super-band-9'), 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A', @@ -20,10 +26,24 @@ void main() async { runApp(MyApp(client, channel)); } +/// Example application using Stream Chat Flutter widgets. +/// Stream Chat Flutter is a set of Flutter widgets which provide full chat functionalities +/// for building Flutter applications using Stream. +/// If you'd prefer using minimal wrapper widgets for your app, please see our other +/// package, `stream_chat_flutter_core`. class MyApp extends StatelessWidget { + /// Instance of Stream Client. + /// Stream's [StreamChatClient] can be used to connect to our servers and set the default + /// user for the application. Performing these actions trigger a websocket connection + /// allowing for real-time updates. final StreamChatClient client; + + /// Instance of the Channel final Channel channel; + /// Example using Stream's Flutter package. + /// If you'd prefer using minimal wrapper widgets for your app, please see our other + /// package, `stream_chat_flutter_core`. MyApp(this.client, this.channel); @override @@ -43,7 +63,12 @@ class MyApp extends StatelessWidget { } } +/// A list of messages sent in the current channel. +/// +/// This is implemented using [MessageListView], a widget that provides query functionalities +/// fetching the messages from the api and showing them in a listView class ChannelPage extends StatelessWidget { + /// Creates the page that shows the list of messages const ChannelPage({ Key key, }) : super(key: key); diff --git a/packages/stream_chat_flutter/example/lib/split_view.dart b/packages/stream_chat_flutter/example/lib/split_view.dart index 08324759..dbece419 100644 --- a/packages/stream_chat_flutter/example/lib/split_view.dart +++ b/packages/stream_chat_flutter/example/lib/split_view.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/tutorial-part-1.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-1.dart index 66a1091c..8fda6029 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial-part-1.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-1.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/tutorial-part-2.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-2.dart index f810231c..411b9475 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial-part-2.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-2.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/tutorial-part-3.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-3.dart index 2f28fa80..5c309d48 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial-part-3.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-3.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; @@ -76,7 +77,7 @@ class ChannelListPage extends StatelessWidget { final lastMessage = channel.state.messages.reversed .firstWhere((message) => !message.isDeleted); - final subtitle = (lastMessage == null ? "nothing yet" : lastMessage.text); + final subtitle = (lastMessage == null ? 'nothing yet' : lastMessage.text); final opacity = channel.state.unreadCount > .0 ? 1.0 : 0.5; return ListTile( diff --git a/packages/stream_chat_flutter/example/lib/tutorial-part-4.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-4.dart index 6a3c7766..2b46d46b 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial-part-4.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-4.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/tutorial-part-5.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-5.dart index e2756430..4d9133ee 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial-part-5.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-5.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/tutorial-part-6.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-6.dart index a7ad5ba0..69e0f26a 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial-part-6.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-6.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/test/widget_test.dart b/packages/stream_chat_flutter/example/test/widget_test.dart deleted file mode 100644 index 747db1da..00000000 --- a/packages/stream_chat_flutter/example/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:example/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -}