1
1
import 'package:example/app_user.dart' ;
2
- import 'extension.dart' ;
2
+ import 'package:example/client_provider.dart' ;
3
+ import 'package:example/extension.dart' ;
4
+ import 'package:example/home.dart' ;
5
+ import 'package:flutter/foundation.dart' ;
3
6
import 'package:flutter/material.dart' ;
4
7
import 'package:stream_feed/stream_feed.dart' ;
5
8
6
- import 'client_provider.dart' ;
7
- import 'home.dart' ;
8
-
9
9
void main () {
10
10
WidgetsFlutterBinding .ensureInitialized ();
11
11
final _key = String .fromEnvironment ('key' );
@@ -18,22 +18,41 @@ void main() {
18
18
);
19
19
}
20
20
21
+ //ignore: public_member_api_docs
21
22
class MyApp extends StatelessWidget {
22
- const MyApp ({Key ? key, required this .client}) : super (key: key);
23
+ //ignore: public_member_api_docs
24
+ const MyApp ({
25
+ required this .client,
26
+ Key ? key,
27
+ }) : super (key: key);
28
+
29
+ //ignore: public_member_api_docs
23
30
final StreamFeedClient client;
24
31
25
32
@override
33
+ //ignore: prefer_expression_function_bodies
26
34
Widget build (BuildContext context) {
27
35
return MaterialApp (
28
36
title: 'Stream Feed Demo' ,
29
- home: LoginScreen (),
30
- builder: (context, child) =>
31
- ClientProvider (client: client, child: child! ),
37
+ home: const LoginScreen (),
38
+ builder: (context, child) => ClientProvider (
39
+ client: client,
40
+ child: child! ,
41
+ ),
32
42
);
33
43
}
44
+
45
+ @override
46
+ void debugFillProperties (DiagnosticPropertiesBuilder properties) {
47
+ super .debugFillProperties (properties);
48
+ properties.add (DiagnosticsProperty <StreamFeedClient >('client' , client));
49
+ }
34
50
}
35
51
52
+ //ignore: public_member_api_docs
36
53
class LoginScreen extends StatefulWidget {
54
+ //ignore: public_member_api_docs
55
+ const LoginScreen ({Key ? key}) : super (key: key);
37
56
@override
38
57
_LoginScreenState createState () => _LoginScreenState ();
39
58
}
@@ -46,28 +65,28 @@ class _LoginScreenState extends State<LoginScreen> {
46
65
return Scaffold (
47
66
// backgroundColor: Colors.grey.shade100,
48
67
body: Padding (
49
- padding: const EdgeInsets .symmetric (horizontal: 24.0 ),
50
- child: Container (
68
+ padding: const EdgeInsets .symmetric (horizontal: 24 ),
69
+ child: SizedBox (
51
70
width: size.width,
52
71
height: size.height,
53
72
child: Column (
54
73
mainAxisAlignment: MainAxisAlignment .center,
55
74
children: [
56
- Text (
75
+ const Text (
57
76
'Login with a User' ,
58
77
style: TextStyle (
59
78
fontSize: 42 ,
60
79
fontWeight: FontWeight .w500,
61
80
),
62
81
),
63
- SizedBox (height: 42 ),
82
+ const SizedBox (height: 42 ),
64
83
for (final user in appUsers)
65
84
Padding (
66
- padding: const EdgeInsets .all (8.0 ),
67
- child: RaisedButton (
85
+ padding: const EdgeInsets .all (8 ),
86
+ child: ElevatedButton (
68
87
onPressed: () async {
69
88
ScaffoldMessenger .of (context).showSnackBar (
70
- SnackBar (
89
+ const SnackBar (
71
90
content: Text ('Loading User' ),
72
91
),
73
92
);
@@ -76,7 +95,7 @@ class _LoginScreenState extends State<LoginScreen> {
76
95
getOrCreate: true ,
77
96
);
78
97
ScaffoldMessenger .of (context).showSnackBar (
79
- SnackBar (
98
+ const SnackBar (
80
99
content: Text ('User Loaded' ),
81
100
),
82
101
);
@@ -88,25 +107,30 @@ class _LoginScreenState extends State<LoginScreen> {
88
107
),
89
108
);
90
109
},
91
- padding: const EdgeInsets .symmetric (horizontal: 4.0 ),
92
- color: Colors .white,
93
- shape: RoundedRectangleBorder (
94
- borderRadius: BorderRadius .circular (24.0 ),
110
+ style: ElevatedButton .styleFrom (
111
+ padding: const EdgeInsets .symmetric (horizontal: 4 ),
112
+ primary: Colors .white,
113
+ shape: RoundedRectangleBorder (
114
+ borderRadius: BorderRadius .circular (24 ),
115
+ ),
95
116
),
96
117
child: Padding (
97
118
padding: const EdgeInsets .symmetric (
98
- vertical: 36.0 , horizontal: 24.0 ),
119
+ vertical: 36 , horizontal: 24 ),
99
120
child: Row (
100
121
mainAxisAlignment: MainAxisAlignment .spaceBetween,
101
122
children: [
102
123
Text (
103
124
user.name,
104
- style: TextStyle (
125
+ style: const TextStyle (
105
126
fontSize: 24 ,
106
127
color: Colors .blue,
107
128
),
108
129
),
109
- Icon (Icons .arrow_forward_ios)
130
+ Icon (
131
+ Icons .arrow_forward_ios,
132
+ color: Theme .of (context).colorScheme.onSurface,
133
+ )
110
134
],
111
135
),
112
136
),
0 commit comments