Skip to content

Commit de915c0

Browse files
authored
Merge pull request #160 from GetStream/release-0.4.0
2 parents e16110d + 4da6036 commit de915c0

File tree

114 files changed

+4185
-876
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+4185
-876
lines changed

.github/workflows/build.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ jobs:
5757

5858
- name: Post Codecov report
5959
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
60-
61-
- uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
60+
61+
- uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
6262
with:
6363
path: packages/stream_feed/coverage/lcov.info
64-
min_coverage: 82
65-
- uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
64+
min_coverage: 81
65+
- uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
6666
with:
6767
path: packages/faye_dart/coverage/lcov.info
6868
min_coverage: 49
69+
- uses: VeryGoodOpenSource/[email protected]
70+
with:
71+
path: packages/stream_feed_flutter_core/coverage/lcov.info
72+
min_coverage: 65

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@
2929
build/
3030
example/pubspec.lock
3131
coverage.lcov
32-
coverage/
32+
coverage/
33+
packages/stream_feed_flutter/example/.flutter-plugins-dependencies
34+
packages/stream_feed_flutter/example/.flutter-plugins-dependencies

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ const apiKey = 'my-API-key';
5050
const secret = 'my-API-secret';
5151

5252
// Instantiate a new client (server side)
53-
var client = StreamFeedClient.connect(apiKey, secret: secret);
53+
var client = StreamFeedClient(apiKey, secret: secret);
5454

5555
// Optionally supply the app identifier and an options object specifying the data center to use and timeout for requests (15s)
56-
client = StreamFeedClient.connect(apiKey,
56+
client = StreamFeedClient(apiKey,
5757
secret: secret,
5858
appId: 'yourappid',
5959
options: StreamHttpClientOptions(
@@ -70,7 +70,7 @@ final userToken = client.frontendToken('the-user-id');
7070

7171
```dart
7272
// Instantiate new client with a user token
73-
var client = StreamFeedClient.connect(apiKey, token: Token('userToken'));
73+
var client = StreamFeedClient(apiKey, token: Token('userToken'));
7474
```
7575

7676
### 🔮 Examples
@@ -235,7 +235,7 @@ Stream uses [Faye](https://faye.jcoglan.com) for realtime notifications. Below i
235235
```dart
236236
237237
// ⚠️ userToken is generated server-side (see previous section)
238-
final client = StreamFeedClient.connect('YOUR_API_KEY', token: userToken,appId: 'APP_ID');
238+
final client = StreamFeedClient('YOUR_API_KEY', token: userToken,appId: 'APP_ID');
239239
final user1 = client.flatFeed('user', '1');
240240
241241
// subscribe to the changes

analysis_options.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ linter:
4141
- use_key_in_widget_constructors
4242
- valid_regexps
4343
- always_declare_return_types
44-
- always_put_required_named_parameters_first
4544
- always_require_non_null_named_parameters
4645
- annotate_overrides
4746
- avoid_bool_literals_in_conditional_expressions
@@ -96,7 +95,6 @@ linter:
9695
- prefer_constructors_over_static_methods
9796
- prefer_contains
9897
- prefer_equal_for_default_values
99-
- prefer_expression_function_bodies
10098
- prefer_final_fields
10199
- prefer_final_in_for_each
102100
- prefer_final_locals
@@ -116,7 +114,7 @@ linter:
116114
- prefer_spread_collections
117115
- prefer_typing_uninitialized_variables
118116
- provide_deprecation_message
119-
- public_member_api_docs
117+
# - public_member_api_docs
120118
- recursive_getters
121119
- sized_box_for_whitespace
122120
- slash_for_doc_comments

example/lib/activity_item.dart

+23-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1+
import 'package:example/app_user.dart';
2+
import 'package:flutter/foundation.dart';
13
import 'package:flutter/material.dart';
24
import 'package:stream_feed/stream_feed.dart';
35
import 'package:timeago/timeago.dart' as timeago;
46

5-
import 'app_user.dart';
6-
7+
//ignore: public_member_api_docs
78
class ActivityCard extends StatelessWidget {
8-
final Activity activity;
9+
//ignore: public_member_api_docs
10+
const ActivityCard({
11+
required this.activity,
12+
Key? key,
13+
}) : super(key: key);
914

10-
const ActivityCard({Key? key, required this.activity}) : super(key: key);
15+
//ignore: public_member_api_docs
16+
final Activity activity;
1117

1218
@override
1319
Widget build(BuildContext context) {
1420
final user = appUsers
1521
.firstWhere((it) => createUserReference(it.id) == activity.actor);
1622
return Padding(
17-
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
23+
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
1824
child: Column(
1925
crossAxisAlignment: CrossAxisAlignment.start,
2026
children: [
@@ -23,14 +29,14 @@ class ActivityCard extends StatelessWidget {
2329
CircleAvatar(
2430
child: Text(user.name[0]),
2531
),
26-
SizedBox(width: 16),
32+
const SizedBox(width: 16),
2733
Expanded(
2834
child: Column(
2935
crossAxisAlignment: CrossAxisAlignment.start,
3036
children: [
3137
Text(
3238
user.name,
33-
style: TextStyle(
39+
style: const TextStyle(
3440
fontSize: 18,
3541
),
3642
),
@@ -39,7 +45,7 @@ class ActivityCard extends StatelessWidget {
3945
activity.time!,
4046
allowFromNow: true,
4147
)}',
42-
style: TextStyle(
48+
style: const TextStyle(
4349
fontWeight: FontWeight.w300,
4450
),
4551
),
@@ -48,15 +54,21 @@ class ActivityCard extends StatelessWidget {
4854
)
4955
],
5056
),
51-
SizedBox(height: 16),
57+
const SizedBox(height: 16),
5258
Text(
53-
activity.extraData!['tweet'] as String,
54-
style: TextStyle(
59+
activity.extraData!['tweet'].toString(),
60+
style: const TextStyle(
5561
fontSize: 24,
5662
),
5763
),
5864
],
5965
),
6066
);
6167
}
68+
69+
@override
70+
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
71+
super.debugFillProperties(properties);
72+
properties.add(DiagnosticsProperty<Activity>('activity', activity));
73+
}
6274
}

example/lib/add_activity_dialog.dart

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import 'package:flutter/material.dart';
22

3+
//ignore: public_member_api_docs
34
class AddActivityDialog extends StatefulWidget {
5+
//ignore: public_member_api_docs
6+
const AddActivityDialog({Key? key}) : super(key: key);
7+
48
@override
59
_AddActivityDialogState createState() => _AddActivityDialogState();
610
}
@@ -9,28 +13,31 @@ class _AddActivityDialogState extends State<AddActivityDialog> {
913
final _activityController = TextEditingController();
1014

1115
@override
16+
//ignore: prefer_expression_function_bodies
1217
Widget build(BuildContext context) {
1318
return Dialog(
1419
child: Padding(
15-
padding: const EdgeInsets.all(24.0),
20+
padding: const EdgeInsets.all(24),
1621
child: Column(
1722
mainAxisSize: MainAxisSize.min,
1823
children: [
1924
TextField(
2025
controller: _activityController,
2126
decoration: const InputDecoration(
2227
hintText: "What's happening?",
23-
border: const OutlineInputBorder(),
28+
border: OutlineInputBorder(),
2429
),
2530
),
26-
SizedBox(height: 12),
27-
RaisedButton(
31+
const SizedBox(height: 12),
32+
ElevatedButton(
2833
onPressed: () {
2934
final message = _activityController.text;
3035
Navigator.pop<String>(context, message);
3136
},
32-
color: Colors.blue,
33-
child: Text(
37+
style: ElevatedButton.styleFrom(
38+
primary: Colors.blue,
39+
),
40+
child: const Text(
3441
'POST ACTIVITY',
3542
style: TextStyle(
3643
color: Colors.white,

example/lib/app_user.dart

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
1+
//ignore: public_member_api_docs
12
class AppUser {
2-
final String id;
3-
final String name;
4-
final String token;
5-
3+
//ignore: public_member_api_docs
64
const AppUser.sahil()
75
: id = 'sahil-kumar',
86
name = 'Sahil Kumar',
97
token =
10-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FoaWwta3VtYXIifQ.d6RW5eZedEl949w-IeZ40Ukji3yXfFnMw3baLsow028';
8+
'''eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FoaWwta3VtYXIifQ.d6RW5eZedEl949w-IeZ40Ukji3yXfFnMw3baLsow028''';
119

10+
//ignore: public_member_api_docs
1211
const AppUser.sacha()
1312
: id = 'sacha-arbonel',
1413
name = 'Sacha Arbonel',
1514
token =
16-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FjaGEtYXJib25lbCJ9.fzDKEyiQ40J4YYgtZxpeQhn6ajX-GEnKZOOmcb-xa7M';
15+
'''eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FjaGEtYXJib25lbCJ9.fzDKEyiQ40J4YYgtZxpeQhn6ajX-GEnKZOOmcb-xa7M''';
1716

17+
//ignore: public_member_api_docs
1818
const AppUser.nash()
1919
: id = 'neevash-ramdial',
2020
name = 'Neevash Ramdial',
2121
token =
22-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoibmVldmFzaC1yYW1kaWFsIn0.yKqSehu_O5WJGh3-aa5qipnBRs7Qtue-1T9TZhT2ejw';
22+
'''eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoibmVldmFzaC1yYW1kaWFsIn0.yKqSehu_O5WJGh3-aa5qipnBRs7Qtue-1T9TZhT2ejw'''; //ignore: public_member_api_docs
23+
24+
//ignore: public_member_api_docs
25+
const AppUser.reuben()
26+
: id = 'groovin',
27+
name = 'Reuben Turner',
28+
token =
29+
'''eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZ3Jvb3ZpbiJ9.6uMlHDLHpiHubWbcTztZO7NbFFZozuhwgNdrGgObgTE''';
30+
31+
//ignore: public_member_api_docs
32+
final String id;
33+
34+
//ignore: public_member_api_docs
35+
final String name;
36+
37+
//ignore: public_member_api_docs
38+
final String token;
2339

40+
//ignore: public_member_api_docs
2441
Map<String, Object> get data {
2542
final parts = name.split(' ');
2643
return {
@@ -31,8 +48,10 @@ class AppUser {
3148
}
3249
}
3350

51+
//ignore: public_member_api_docs
3452
const appUsers = [
3553
AppUser.sahil(),
3654
AppUser.sacha(),
3755
AppUser.nash(),
56+
AppUser.reuben(),
3857
];

example/lib/extension.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
import 'package:example/client_provider.dart';
12
import 'package:flutter/material.dart';
23
import 'package:stream_feed/stream_feed.dart';
34

4-
import 'client_provider.dart';
5-
5+
//ignore: public_member_api_docs
66
extension ProviderX on BuildContext {
7+
//ignore: public_member_api_docs
78
StreamFeedClient get client => ClientProvider.of(this).client;
89
}
910

11+
//ignore: public_member_api_docs
1012
extension Snackbar on BuildContext {
13+
//ignore: public_member_api_docs
1114
void showSnackBar(final String message) {
1215
ScaffoldMessenger.of(this).showSnackBar(SnackBar(content: Text(message)));
1316
}

example/lib/home.dart

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,41 @@
11
import 'package:example/people_screen.dart';
22
import 'package:example/profile_screen.dart';
33
import 'package:example/timeline_screen.dart';
4+
import 'package:flutter/foundation.dart';
45
import 'package:flutter/material.dart';
56
import 'package:stream_feed/stream_feed.dart';
67

8+
//ignore: public_member_api_docs
79
class HomeScreen extends StatefulWidget {
8-
final StreamUser currentUser;
10+
//ignore: public_member_api_docs
11+
const HomeScreen({
12+
required this.currentUser,
13+
Key? key,
14+
}) : super(key: key);
915

10-
const HomeScreen({Key? key, required this.currentUser}) : super(key: key);
16+
//ignore: public_member_api_docs
17+
final StreamUser currentUser;
1118

1219
@override
1320
_HomeScreenState createState() => _HomeScreenState();
21+
22+
@override
23+
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
24+
super.debugFillProperties(properties);
25+
properties.add(DiagnosticsProperty<StreamUser>('currentUser', currentUser));
26+
}
1427
}
1528

1629
class _HomeScreenState extends State<HomeScreen> {
1730
int _currentIndex = 0;
1831

1932
@override
33+
//ignore: prefer_expression_function_bodies
2034
Widget build(BuildContext context) {
2135
return Scaffold(
2236
appBar: AppBar(
2337
title: Row(
24-
children: [
38+
children: const [
2539
Icon(Icons.bike_scooter_rounded),
2640
SizedBox(width: 16),
2741
Text('Tweet It!'),
@@ -38,14 +52,12 @@ class _HomeScreenState extends State<HomeScreen> {
3852
),
3953
bottomNavigationBar: BottomNavigationBar(
4054
selectedItemColor: Colors.blue,
41-
elevation: 16.0,
55+
elevation: 16,
4256
type: BottomNavigationBarType.fixed,
4357
iconSize: 22,
44-
selectedFontSize: 14,
45-
unselectedFontSize: 12,
4658
currentIndex: _currentIndex,
4759
onTap: (index) => setState(() => _currentIndex = index),
48-
items: [
60+
items: const [
4961
BottomNavigationBarItem(
5062
backgroundColor: Colors.black,
5163
icon: Icon(Icons.timeline),

0 commit comments

Comments
 (0)