mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Each layer is supposed to reexport the parts of the previous layer that are part of its API. - In painting.dart, export from dart:ui all the Canvas-related APIs that make sense to be used at higher levels, e.g. PaintingStyle. - Delete painting/shadows.dart. It was dead code. - In rendering/object.dart, export all of painting.dart. - In widgets/basic.dart, export all of painting.dart and animation.dart. Some classes in animation/ are renamed to make this less disruptive and confusing to the namespace. - Split out Stocks back into an import model rather than a part model, so that it's easier to manage its dependencies on a per-file basis. - Move Ticker to scheduler library. - Remove as many redundant imports as possible now. - Some minor nit picking cleanup in various files.
111 lines
3.2 KiB
Dart
111 lines
3.2 KiB
Dart
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'dart:async';
|
|
import 'dart:ui' as ui show window;
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/scheduler.dart' show timeDilation;
|
|
|
|
enum _MenuItems { autorefresh, autorefreshCheckbox, refresh, speedUp, speedDown }
|
|
|
|
const double _kMenuMargin = 16.0; // 24.0 on tablet
|
|
|
|
Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool> onAutorefreshChanged }) async {
|
|
StateSetter autorefreshStateSetter;
|
|
switch (await showMenu(
|
|
context: context,
|
|
position: new ModalPosition(
|
|
right: ui.window.padding.right + _kMenuMargin,
|
|
top: ui.window.padding.top + _kMenuMargin
|
|
),
|
|
items: <PopupMenuItem>[
|
|
new PopupMenuItem(
|
|
value: _MenuItems.autorefresh,
|
|
child: new Row(
|
|
children: <Widget>[
|
|
new Flexible(child: new Text('Autorefresh')),
|
|
new StatefulBuilder(
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
autorefreshStateSetter = setState;
|
|
return new Checkbox(
|
|
value: autorefresh,
|
|
onChanged: (bool value) {
|
|
setState(() {
|
|
autorefresh = value;
|
|
});
|
|
Navigator.pop(context, _MenuItems.autorefreshCheckbox);
|
|
}
|
|
);
|
|
}
|
|
)
|
|
]
|
|
)
|
|
),
|
|
new PopupMenuItem(
|
|
value: _MenuItems.refresh,
|
|
child: new Text('Refresh')
|
|
),
|
|
new PopupMenuItem(
|
|
value: _MenuItems.speedUp,
|
|
child: new Text('Increase animation speed')
|
|
),
|
|
new PopupMenuItem(
|
|
value: _MenuItems.speedDown,
|
|
child: new Text('Decrease animation speed')
|
|
),
|
|
]
|
|
)) {
|
|
case _MenuItems.autorefresh:
|
|
autorefreshStateSetter(() {
|
|
autorefresh = !autorefresh;
|
|
});
|
|
continue autorefreshNotify;
|
|
autorefreshNotify:
|
|
case _MenuItems.autorefreshCheckbox:
|
|
onAutorefreshChanged(autorefresh);
|
|
break;
|
|
case _MenuItems.speedUp:
|
|
timeDilation /= 5.0;
|
|
break;
|
|
case _MenuItems.speedDown:
|
|
timeDilation *= 5.0;
|
|
break;
|
|
case _MenuItems.refresh:
|
|
await 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(
|
|
child: new Row(
|
|
children: <Widget>[
|
|
new Icon(
|
|
icon: 'device/dvr',
|
|
size: IconSize.s18
|
|
),
|
|
new Container(
|
|
width: 8.0
|
|
),
|
|
new Text('DUMP APP TO CONSOLE'),
|
|
]
|
|
),
|
|
onPressed: () { debugDumpApp(); }
|
|
),
|
|
new FlatButton(
|
|
child: new Text('OH WELL'),
|
|
onPressed: () {
|
|
Navigator.pop(context, false);
|
|
}
|
|
),
|
|
]
|
|
)
|
|
);
|
|
break;
|
|
default:
|
|
// menu was canceled.
|
|
}
|
|
}
|