Skip to content

Commit 0ef4251

Browse files
committed
Merge branch 'master' into kotlin-finder
2 parents 1e696d7 + 1aace44 commit 0ef4251

File tree

6 files changed

+168
-117
lines changed

6 files changed

+168
-117
lines changed

driver/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"appium",
66
"flutter"
77
],
8-
"version": "0.0.17",
8+
"version": "0.0.18",
99
"author": "TruongSinh Tran-Nguyen <i@truongsinh.pro>",
1010
"license": "MIT",
1111
"repository": {
+101-116
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,117 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_driver/driver_extension.dart';
3+
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
4+
import 'package:hello_world/stream.dart';
5+
6+
part 'main.g.dart';
37

48
void main() {
59
enableFlutterDriverExtension();
10+
init();
611
runApp(MyApp());
712
}
813

9-
class MyApp extends StatelessWidget {
10-
@override
11-
Widget build(BuildContext context) {
12-
return MaterialApp(
13-
title: 'Counter App',
14-
home: MyHomePage(title: 'Counter App Home Page'),
15-
);
16-
}
17-
}
18-
19-
class MyHomePage extends StatefulWidget {
20-
MyHomePage({Key key, this.title}) : super(key: key);
14+
@widget
15+
Widget myApp() => MaterialApp(
16+
title: 'Counter App',
17+
home: MyHomePage(title: 'Counter App Home Page'),
18+
);
2119

22-
final String title;
23-
24-
@override
25-
_MyHomePageState createState() => _MyHomePageState();
26-
}
2720

28-
class _MyHomePageState extends State<MyHomePage> {
29-
int _counter = 0;
3021

31-
void _incrementCounter() {
32-
setState(() {
33-
_counter++;
34-
});
35-
}
36-
37-
@override
38-
Widget build(BuildContext context) {
39-
return Scaffold(
40-
appBar: AppBar(
41-
title: Text(widget.title),
42-
),
43-
body: Center(
44-
child: Column(
45-
mainAxisAlignment: MainAxisAlignment.center,
46-
children: <Widget>[
47-
Text(
48-
'You have pushed the button this many times:',
49-
),
50-
Tooltip(
51-
message: 'counter_tooltip',
52-
child: Text(
53-
'$_counter',
22+
@widget
23+
Widget myHomePage(BuildContext context, {String title}) => Scaffold(
24+
appBar: AppBar(
25+
title: Text(title),
26+
),
27+
body: Center(
28+
child: Column(
29+
mainAxisAlignment: MainAxisAlignment.center,
30+
children: <Widget>[
31+
Text(
32+
'You have pushed the button this many times:',
33+
),
34+
Tooltip(
35+
message: 'counter_tooltip',
36+
child: StreamBuilder<int>(
37+
stream: counterStream,
38+
builder: (context, snapshot) {
39+
return Text(
40+
'${snapshot.data}',
5441
key: Key('counter'),
5542
style: Theme.of(context).textTheme.display1,
5643
semanticsLabel: 'counter_semantic',
57-
),
58-
),
59-
FlatButton(
60-
onPressed: () {
61-
Navigator.push(
62-
context,
63-
MaterialPageRoute(
64-
builder: (context) => Scaffold(
65-
appBar: AppBar(
66-
title: Text("Second Route"),
67-
),
68-
body: Center(
69-
child: SecondPage(),
70-
),
71-
)),
72-
);
73-
},
74-
child: Text(
75-
'Go to next route',
76-
key: Key('next_route_key'),
77-
),
78-
),
79-
],
80-
),
81-
),
82-
floatingActionButton: FloatingActionButton(
83-
// Provide a Key to this button. This allows finding this
84-
// specific button inside the test suite, and tapping it.
85-
key: Key('increment'),
86-
onPressed: _incrementCounter,
87-
tooltip: 'Increment',
88-
child: Icon(Icons.add),
89-
),
90-
);
91-
}
92-
}
93-
94-
class SecondPage extends StatelessWidget {
95-
@override
96-
Widget build(BuildContext context) => ListView(
97-
padding: const EdgeInsets.all(8.0),
98-
children: <Widget>[
99-
Container(
100-
height: 100,
101-
color: Colors.amber[600],
102-
child: const Center(child: Text('This is 2nd route')),
103-
),
104-
Container(
105-
height: 200,
106-
color: Colors.amber[500],
107-
child: const Center(child: Text('Entry B')),
108-
),
109-
Container(
110-
height: 500,
111-
color: Colors.amber[100],
112-
child: const Center(child: Text('Entry C')),
44+
);
45+
}
11346
),
114-
Container(
115-
height: 1000,
116-
color: Colors.amber[100],
117-
child: const Center(child: Text('Entry D')),
118-
),
119-
Container(
120-
height: 1000,
121-
color: Colors.amber[100],
122-
child: const Center(
123-
child: TextField(
124-
decoration: InputDecoration(
125-
border: OutlineInputBorder(),
126-
labelText: 'Sample Input',
127-
),
128-
)),
47+
),
48+
FlatButton(
49+
onPressed: () {
50+
Navigator.push(
51+
context,
52+
MaterialPageRoute(
53+
builder: (context) => Scaffold(
54+
appBar: AppBar(
55+
title: Text("Second Route"),
56+
),
57+
body: Center(
58+
child: SecondPage(),
59+
),
60+
)),
61+
);
62+
},
63+
child: Text(
64+
'Go to next route',
65+
key: Key('next_route_key'),
12966
),
130-
],
131-
);
132-
}
67+
),
68+
],
69+
),
70+
),
71+
floatingActionButton: FloatingActionButton(
72+
// Provide a Key to this button. This allows finding this
73+
// specific button inside the test suite, and tapping it.
74+
key: Key('increment'),
75+
onPressed: () => plusClickSink.add(null),
76+
tooltip: 'Increment',
77+
child: Icon(Icons.add),
78+
),
79+
);
80+
81+
@widget
82+
Widget secondPage() => ListView(
83+
padding: const EdgeInsets.all(8.0),
84+
children: <Widget>[
85+
Container(
86+
height: 100,
87+
color: Colors.amber[600],
88+
child: const Center(child: Text('This is 2nd route')),
89+
),
90+
Container(
91+
height: 200,
92+
color: Colors.amber[500],
93+
child: const Center(child: Text('Entry B')),
94+
),
95+
Container(
96+
height: 500,
97+
color: Colors.amber[100],
98+
child: const Center(child: Text('Entry C')),
99+
),
100+
Container(
101+
height: 1000,
102+
color: Colors.amber[100],
103+
child: const Center(child: Text('Entry D')),
104+
),
105+
Container(
106+
height: 1000,
107+
color: Colors.amber[100],
108+
child: const Center(
109+
child: TextField(
110+
decoration: InputDecoration(
111+
border: OutlineInputBorder(),
112+
labelText: 'Sample Input',
113+
),
114+
)),
115+
),
116+
],
117+
);

example/flutter_app_under_test/lib/main.g.dart

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'dart:async' show StreamSink;
2+
3+
import 'package:rxdart/rxdart.dart'
4+
show BehaviorSubject;
5+
6+
final counterSubject = new BehaviorSubject<int>.seeded(0);
7+
final counterStream = counterSubject.stream;
8+
9+
final plusClickSubject = new BehaviorSubject<void>();
10+
final StreamSink plusClickSink = plusClickSubject;
11+
12+
void init() {
13+
plusClickSubject.stream.withLatestFrom<int, int>(
14+
counterSubject,
15+
(_, a) => a + 1,
16+
).pipe(counterSubject);
17+
}

example/flutter_app_under_test/pubspec.lock

+14
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ packages:
9898
description: flutter
9999
source: sdk
100100
version: "0.0.0"
101+
functional_widget_annotation:
102+
dependency: "direct main"
103+
description:
104+
name: functional_widget_annotation
105+
url: "https://pub.dartlang.org"
106+
source: hosted
107+
version: "0.5.1"
101108
glob:
102109
dependency: transitive
103110
description:
@@ -266,6 +273,13 @@ packages:
266273
url: "https://pub.dartlang.org"
267274
source: hosted
268275
version: "2.0.3"
276+
rxdart:
277+
dependency: "direct main"
278+
description:
279+
name: rxdart
280+
url: "https://pub.dartlang.org"
281+
source: hosted
282+
version: "0.22.1+1"
269283
shelf:
270284
dependency: transitive
271285
description:

example/flutter_app_under_test/pubspec.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ environment:
66
sdk: ">=2.1.0 <3.0.0"
77

88
dependencies:
9+
functional_widget_annotation: ^0.5.0
10+
rxdart: 0.22.1+1
911
flutter:
1012
sdk: flutter
1113

@@ -18,3 +20,6 @@ dev_dependencies:
1820

1921
flutter:
2022
uses-material-design: true
23+
24+
builders:
25+
functional_widget: ^0.6.0

0 commit comments

Comments
 (0)