-
Notifications
You must be signed in to change notification settings - Fork 5
/
home_page_error.dart
39 lines (36 loc) · 1.04 KB
/
home_page_error.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_riverpod_sample/providers.dart';
class HomePageError extends StatelessWidget {
final String message;
final TextEditingController _userIdController = TextEditingController();
HomePageError({@required this.message});
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: TextField(
controller: _userIdController,
),
),
ElevatedButton(
onPressed: () {
context
.read(userNotifierProvider)
.getUserInfo(_userIdController.text);
},
child: Text('Get user info'),
),
Text(
message,
style: TextStyle(color: Colors.red),
),
],
),
);
}
}