Commit 63bfa891 authored by Adam Barth's avatar Adam Barth

Use semantic names for callbacks instead of onGestureTap

Buttons and menu items use onPressed. Also, don't pass along the sky.Event
because that's a lower-level concept.

I've also reordered parameter lists to put the |child| argument last in a
number of places.

Also, fixed a bug where FloatingActionButton was missing syncFields.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1188993003.
parent 5c961fff
...@@ -46,13 +46,13 @@ class StockHome extends Component { ...@@ -46,13 +46,13 @@ class StockHome extends Component {
bool _isSearching = false; bool _isSearching = false;
String _searchQuery; String _searchQuery;
void _handleSearchBegin(_) { void _handleSearchBegin() {
setState(() { setState(() {
_isSearching = true; _isSearching = true;
}); });
} }
void _handleSearchEnd(_) { void _handleSearchEnd() {
setState(() { setState(() {
_isSearching = false; _isSearching = false;
_searchQuery = null; _searchQuery = null;
...@@ -76,14 +76,14 @@ class StockHome extends Component { ...@@ -76,14 +76,14 @@ class StockHome extends Component {
PopupMenuController _menuController; PopupMenuController _menuController;
void _handleMenuShow(_) { void _handleMenuShow() {
setState(() { setState(() {
_menuController = new PopupMenuController(); _menuController = new PopupMenuController();
_menuController.open(); _menuController.open();
}); });
} }
void _handleMenuHide(_) { void _handleMenuHide() {
setState(() { setState(() {
_menuController.close().then((_) { _menuController.close().then((_) {
setState(() { setState(() {
...@@ -122,14 +122,14 @@ class StockHome extends Component { ...@@ -122,14 +122,14 @@ class StockHome extends Component {
new MenuDivider(), new MenuDivider(),
new MenuItem( new MenuItem(
icon: 'action/thumb_up', icon: 'action/thumb_up',
onGestureTap: (event) => _handleStockModeChange(StockMode.optimistic), onPressed: () => _handleStockModeChange(StockMode.optimistic),
children: [ children: [
new Flexible(child: new Text('Optimistic')), new Flexible(child: new Text('Optimistic')),
new Radio(value: StockMode.optimistic, groupValue: _stockMode, onChanged: _handleStockModeChange) new Radio(value: StockMode.optimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
]), ]),
new MenuItem( new MenuItem(
icon: 'action/thumb_down', icon: 'action/thumb_down',
onGestureTap: (event) => _handleStockModeChange(StockMode.pessimistic), onPressed: () => _handleStockModeChange(StockMode.pessimistic),
children: [ children: [
new Flexible(child: new Text('Pessimistic')), new Flexible(child: new Text('Pessimistic')),
new Radio(value: StockMode.pessimistic, groupValue: _stockMode, onChanged: _handleStockModeChange) new Radio(value: StockMode.pessimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
...@@ -137,7 +137,7 @@ class StockHome extends Component { ...@@ -137,7 +137,7 @@ class StockHome extends Component {
new MenuDivider(), new MenuDivider(),
new MenuItem( new MenuItem(
icon: 'action/settings', icon: 'action/settings',
onGestureTap: (event) => _navigator.pushNamed('/settings'), onPressed: () => _navigator.pushNamed('/settings'),
children: [new Text('Settings')]), children: [new Text('Settings')]),
new MenuItem( new MenuItem(
icon: 'action/help', icon: 'action/help',
...@@ -150,15 +150,15 @@ class StockHome extends Component { ...@@ -150,15 +150,15 @@ class StockHome extends Component {
return new ToolBar( return new ToolBar(
left: new IconButton( left: new IconButton(
icon: 'navigation/menu_white', icon: 'navigation/menu_white',
onGestureTap: (_) => _drawerController.toggle()), onPressed: _drawerController.toggle),
center: new Text('Stocks', style: typography.white.title), center: new Text('Stocks', style: typography.white.title),
right: [ right: [
new IconButton( new IconButton(
icon: 'action/search_white', icon: 'action/search_white',
onGestureTap: _handleSearchBegin), onPressed: _handleSearchBegin),
new IconButton( new IconButton(
icon: 'navigation/more_vert_white', icon: 'navigation/more_vert_white',
onGestureTap: _handleMenuShow) onPressed: _handleMenuShow)
], ],
backgroundColor: colors.Purple[500] backgroundColor: colors.Purple[500]
); );
...@@ -169,7 +169,7 @@ class StockHome extends Component { ...@@ -169,7 +169,7 @@ class StockHome extends Component {
return new ToolBar( return new ToolBar(
left: new IconButton( left: new IconButton(
icon: 'navigation/arrow_back_grey600', icon: 'navigation/arrow_back_grey600',
onGestureTap: _handleSearchEnd), onPressed: _handleSearchEnd),
center: new Input( center: new Input(
focused: true, focused: true,
placeholder: 'Search stocks', placeholder: 'Search stocks',
......
...@@ -29,7 +29,7 @@ class StockSettings extends Component { ...@@ -29,7 +29,7 @@ class StockSettings extends Component {
return new ToolBar( return new ToolBar(
left: new IconButton( left: new IconButton(
icon: 'navigation/arrow_back_white', icon: 'navigation/arrow_back_white',
onGestureTap: (_) => _navigator.pop()), onPressed: _navigator.pop),
center: new Text('Settings', style: typography.white.title), center: new Text('Settings', style: typography.white.title),
backgroundColor: colors.Purple[500] backgroundColor: colors.Purple[500]
); );
...@@ -42,7 +42,7 @@ class StockSettings extends Component { ...@@ -42,7 +42,7 @@ class StockSettings extends Component {
child: new Block([ child: new Block([
new MenuItem( new MenuItem(
icon: 'action/thumb_up', icon: 'action/thumb_up',
onGestureTap: (event) => _handleAwesomeChanged(!_awesome), onPressed: () => _handleAwesomeChanged(!_awesome),
children: [ children: [
new Flexible(child: new Text('Everything is awesome')), new Flexible(child: new Text('Everything is awesome')),
new Checkbox(value: _awesome, onChanged: _handleAwesomeChanged) new Checkbox(value: _awesome, onChanged: _handleAwesomeChanged)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment