/
main.dart
117 lines (110 loc) · 2.92 KB
/
main.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import 'package:flutter/material.dart';
import 'package:flutter_driver/driver_extension.dart';
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
import 'package:hello_world/stream.dart';
part 'main.g.dart';
void main() {
enableFlutterDriverExtension();
init();
runApp(MyApp());
}
@widget
Widget myApp() => MaterialApp(
title: 'Counter App',
home: MyHomePage(title: 'Counter App Home Page'),
);
@widget
Widget myHomePage(BuildContext context, {String title}) => Scaffold(
appBar: AppBar(
title: Text(title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Tooltip(
message: 'counter_tooltip',
child: StreamBuilder<int>(
stream: counterStream,
builder: (context, snapshot) {
return Text(
'${snapshot.data}',
key: Key('counter'),
style: Theme.of(context).textTheme.display1,
semanticsLabel: 'counter_semantic',
);
}
),
),
FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(
title: Text("Second Route"),
),
body: Center(
child: SecondPage(),
),
)),
);
},
child: Text(
'Go to next route',
key: Key('next_route_key'),
),
),
],
),
),
floatingActionButton: FloatingActionButton(
// Provide a Key to this button. This allows finding this
// specific button inside the test suite, and tapping it.
key: Key('increment'),
onPressed: () => plusClickSink.add(null),
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
@widget
Widget secondPage() => ListView(
padding: const EdgeInsets.all(8.0),
children: <Widget>[
Container(
height: 100,
color: Colors.amber[600],
child: const Center(child: Text('This is 2nd route')),
),
Container(
height: 200,
color: Colors.amber[500],
child: const Center(child: Text('Entry B')),
),
Container(
height: 500,
color: Colors.amber[100],
child: const Center(child: Text('Entry C')),
),
Container(
height: 1000,
color: Colors.amber[100],
child: const Center(child: Text('Entry D')),
),
Container(
height: 1000,
color: Colors.amber[100],
child: const Center(
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Sample Input',
),
)),
),
],
);