-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into kotlin-finder
- Loading branch information
Showing
6 changed files
with
168 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"appium", | ||
"flutter" | ||
], | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"author": "TruongSinh Tran-Nguyen <[email protected]>", | ||
"license": "MIT", | ||
"repository": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,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()); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Counter App', | ||
home: MyHomePage(title: 'Counter App Home Page'), | ||
); | ||
} | ||
} | ||
|
||
class MyHomePage extends StatefulWidget { | ||
MyHomePage({Key key, this.title}) : super(key: key); | ||
@widget | ||
Widget myApp() => MaterialApp( | ||
title: 'Counter App', | ||
home: MyHomePage(title: 'Counter App Home Page'), | ||
); | ||
|
||
final String title; | ||
|
||
@override | ||
_MyHomePageState createState() => _MyHomePageState(); | ||
} | ||
|
||
class _MyHomePageState extends State<MyHomePage> { | ||
int _counter = 0; | ||
|
||
void _incrementCounter() { | ||
setState(() { | ||
_counter++; | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text(widget.title), | ||
), | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
Text( | ||
'You have pushed the button this many times:', | ||
), | ||
Tooltip( | ||
message: 'counter_tooltip', | ||
child: Text( | ||
'$_counter', | ||
@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: _incrementCounter, | ||
tooltip: 'Increment', | ||
child: Icon(Icons.add), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class SecondPage extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) => 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', | ||
), | ||
)), | ||
), | ||
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', | ||
), | ||
)), | ||
), | ||
], | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'dart:async' show StreamSink; | ||
|
||
import 'package:rxdart/rxdart.dart' | ||
show BehaviorSubject; | ||
|
||
final counterSubject = new BehaviorSubject<int>.seeded(0); | ||
final counterStream = counterSubject.stream; | ||
|
||
final plusClickSubject = new BehaviorSubject<void>(); | ||
final StreamSink plusClickSink = plusClickSubject; | ||
|
||
void init() { | ||
plusClickSubject.stream.withLatestFrom<int, int>( | ||
counterSubject, | ||
(_, a) => a + 1, | ||
).pipe(counterSubject); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters