Add a scrollbar to the license screen. (#5114)

And make Scrollbar work with LazyBlock.

And an about box to the Stocks sample app.
This commit is contained in:
Ian Hickson
2016-07-29 15:44:12 -07:00
committed by GitHub
parent 2b3099c814
commit 51f8fb9979
15 changed files with 278 additions and 126 deletions

View File

@@ -132,29 +132,7 @@ class StockHomeState extends State<StockHome> {
),
new DrawerItem(
icon: new Icon(Icons.account_balance),
onPressed: () {
showDialog(
context: context,
child: new Dialog(
title: new Text('Not Implemented'),
content: new Text('This feature has not yet been implemented.'),
actions: <Widget>[
new FlatButton(
onPressed: () {
Navigator.pop(context, false);
},
child: new Text('USE IT')
),
new FlatButton(
onPressed: () {
Navigator.pop(context, false);
},
child: new Text('OH WELL')
),
]
)
);
},
onPressed: null,
child: new Text('Account Balance')
),
new DrawerItem(
@@ -199,7 +177,8 @@ class StockHomeState extends State<StockHome> {
child: new Text('Settings')),
new DrawerItem(
icon: new Icon(Icons.help),
child: new Text('Help & Feedback'))
onPressed: _handleShowAbout,
child: new Text('About'))
])
);
}
@@ -208,6 +187,10 @@ class StockHomeState extends State<StockHome> {
Navigator.popAndPushNamed(context, '/settings');
}
void _handleShowAbout() {
showAboutDialog(context: context);
}
Widget buildAppBar() {
return new AppBar(
elevation: 0,

View File

@@ -58,10 +58,10 @@ void main() {
// sanity check
expect(find.text('MARKET'), findsOneWidget);
expect(find.text('Help & Feedback'), findsNothing);
expect(find.text('Account Balance'), findsNothing);
await tester.pump(new Duration(seconds: 2));
expect(find.text('MARKET'), findsOneWidget);
expect(find.text('Help & Feedback'), findsNothing);
expect(find.text('Account Balance'), findsNothing);
// drag the drawer out
Point left = new Point(0.0, ui.window.size.height / 2.0);
@@ -73,12 +73,12 @@ void main() {
await gesture.up();
await tester.pump();
expect(find.text('MARKET'), findsOneWidget);
expect(find.text('Help & Feedback'), findsOneWidget);
expect(find.text('Account Balance'), findsOneWidget);
// check the colour of the icon - light mode
checkIconColor(tester, 'Stock List', Colors.purple[500]); // theme primary color
checkIconColor(tester, 'Account Balance', Colors.black45); // enabled
checkIconColor(tester, 'Help & Feedback', Colors.black26); // disabled
checkIconColor(tester, 'Account Balance', Colors.black26); // disabled
checkIconColor(tester, 'About', Colors.black45); // enabled
// switch to dark mode
await tester.tap(find.text('Pessimistic'));
@@ -88,7 +88,7 @@ void main() {
// check the colour of the icon - dark mode
checkIconColor(tester, 'Stock List', Colors.redAccent[200]); // theme accent color
checkIconColor(tester, 'Account Balance', Colors.white); // enabled
checkIconColor(tester, 'Help & Feedback', Colors.white30); // disabled
checkIconColor(tester, 'Account Balance', Colors.white30); // disabled
checkIconColor(tester, 'About', Colors.white); // enabled
});
}