mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Effen] Use the checkbox widget in the stocks app.
- add a checkbox to the stock app, so that we're testing the checkbox widget (it's not currently wired up to anything, that can come later) - make InkSplash use FlexContainer so that we can use flex in the popup menu items - make effen's Text be more similar to Image and Container, so that it can be styled - make layout.dart's RenderCSSText correctly support being styled - also fixes a bug with the stock list where we were rendering one too few a row when scrolling - check in the code to dump the DOM so I don't have to keep remembering how to do this R=eseidel@chromium.org Review URL: https://codereview.chromium.org/1134163003
This commit is contained in:
parent
f32b32343d
commit
09183a7fd1
@ -21,6 +21,11 @@ import 'stock_data.dart';
|
||||
import 'stock_list.dart';
|
||||
import 'stock_menu.dart';
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:sky/framework/layout.dart';
|
||||
|
||||
const bool debug = false; // set to true to dump the DOM for debugging purposes
|
||||
|
||||
class StocksApp extends App {
|
||||
DrawerController _drawerController = new DrawerController();
|
||||
PopupMenuController _menuController;
|
||||
@ -39,6 +44,8 @@ class StocksApp extends App {
|
||||
String _searchQuery;
|
||||
|
||||
StocksApp() : super() {
|
||||
if (debug)
|
||||
new Timer(new Duration(seconds: 1), dumpState);
|
||||
new StockDataFetcher((StockData data) {
|
||||
setState(() {
|
||||
data.appendTo(_stocks);
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:sky/framework/components/popup_menu.dart';
|
||||
import 'package:sky/framework/fn.dart';
|
||||
import 'package:sky/framework/layout.dart';
|
||||
import 'package:sky/framework/components/popup_menu.dart';
|
||||
import 'package:sky/framework/components/checkbox.dart';
|
||||
import 'package:sky/framework/theme/view_configuration.dart';
|
||||
|
||||
class StockMenu extends Component {
|
||||
@ -14,16 +16,26 @@ class StockMenu extends Component {
|
||||
|
||||
PopupMenuController controller;
|
||||
|
||||
StockMenu({Object key, this.controller}) : super(key: key);
|
||||
StockMenu({Object key, this.controller, this.autorefresh: false, this.onAutorefreshChanged}) : super(key: key);
|
||||
|
||||
final bool autorefresh;
|
||||
final ValueChanged onAutorefreshChanged;
|
||||
|
||||
static FlexBoxParentData _flex1 = new FlexBoxParentData()..flex = 1;
|
||||
|
||||
UINode build() {
|
||||
var checkbox = new Checkbox(
|
||||
checked: this.autorefresh,
|
||||
onChanged: this.onAutorefreshChanged
|
||||
);
|
||||
|
||||
return new StyleNode(
|
||||
new PopupMenu(
|
||||
controller: controller,
|
||||
items: [
|
||||
[new Text('Add stock')],
|
||||
[new Text('Remove stock')],
|
||||
[new Text('Help & feedback')],
|
||||
[new ParentDataNode(new Text('Autorefresh'), _flex1), checkbox],
|
||||
],
|
||||
level: 4),
|
||||
_style
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user