-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathdevboard_page.dart
More file actions
76 lines (66 loc) · 2.02 KB
/
devboard_page.dart
File metadata and controls
76 lines (66 loc) · 2.02 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import 'package:devs/core/models/dev.dart';
import 'package:devs/features/devboard/devboard_model.dart';
import 'package:devs/features/devboard/devs/devs_list.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'devs/devs_list.dart';
class DevboardPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => _DevboardPageState();
}
class _DevboardPageState extends State<DevboardPage> {
DevBoardModel devBoardModel;
@override
void didChangeDependencies() {
devBoardModel = Provider.of(context, listen: false);
super.didChangeDependencies();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Container(
child: StreamBuilder<List<Dev>>(
initialData: [],
stream: devBoardModel.devsStream,
builder: (context, data) {
return AnimatedSwitcher(
duration: Duration(milliseconds: 500),
child: (data.connectionState == ConnectionState.active)
? DevsList(devs: data.data)
: DevProgress("Loading Developers..."));
},
),
),
);
}
}
// Can also be used on jobs page
class DevProgress extends StatelessWidget {
DevProgress(this.message);
final String message;
@override
Widget build(BuildContext context) {
var itemSizeWidth = MediaQuery.of(context).size.width;
BoxConstraints constraints = itemSizeWidth < 730
? BoxConstraints.expand()
: BoxConstraints.loose(Size.fromWidth(500));
return Center(
child: ConstrainedBox(
constraints: constraints,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(message, style: Theme.of(context).textTheme.headline6),
SizedBox(height: 16),
LinearProgressIndicator(
value: null,
),
],
),
),
),
);
}
}