-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathwidget_example.dart
46 lines (43 loc) · 1.07 KB
/
widget_example.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
40
41
42
43
44
45
46
import 'package:flutter/material.dart';
import 'package:flutter_storyboard/flutter_storyboard.dart';
import 'package:random_color/random_color.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StoryBoard(
crossAxisCount: 7,
showAppBar: true,
children: [
for (var i = 0; i < 25; i++)
SizedBox.fromSize(
size: Size(400, 700),
child: _generateScreen(
title: Text('Screen$i'),
color: RandomColor(i).randomColor(),
),
),
],
);
}
}
Widget _generateScreen({
Text title,
FloatingActionButton fab,
Color color,
}) {
return Builder(
builder: (context) {
final Map<String, dynamic> args =
ModalRoute.of(context).settings.arguments;
return Scaffold(
appBar: AppBar(title: title),
backgroundColor: color,
body: args == null ? null : Center(child: Text(args.toString())),
floatingActionButton: fab,
);
},
);
}