mirror of
https://github.com/encounter/flutter.git
synced 2026-07-10 03:18:48 -07:00
Revert "Merge pull request #2639 from Hixie/always_specify_types"
This reverts commitf41b3411da, reversing changes made toe33d8d9621. This was a bad check-in due to my mangling uploading a new version of the branch from a different machine. This reverts https://github.com/flutter/flutter/pull/2639 and will be replaced by https://github.com/flutter/flutter/pull/2640
This commit is contained in:
@@ -26,9 +26,9 @@ class CardCollectionState extends State<CardCollection> {
|
||||
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
|
||||
|
||||
// TODO(hansmuller): need a local image asset
|
||||
static const String _sunshineURL = "http://www.walltor.com/images/wallpaper/good-morning-sunshine-58540.jpg";
|
||||
static const _sunshineURL = "http://www.walltor.com/images/wallpaper/good-morning-sunshine-58540.jpg";
|
||||
|
||||
static const double kCardMargins = 8.0;
|
||||
static const kCardMargins = 8.0;
|
||||
|
||||
final TextStyle backgroundTextStyle =
|
||||
Typography.white.title.copyWith(textAlign: TextAlign.center);
|
||||
|
||||
@@ -23,7 +23,7 @@ class PageableListAppState extends State<PageableListApp> {
|
||||
List<Size> cardSizes = [
|
||||
[100.0, 300.0], [300.0, 100.0], [200.0, 400.0], [400.0, 400.0], [300.0, 400.0]
|
||||
]
|
||||
.map((List<double> args) => new Size(args[0], args[1]))
|
||||
.map((args) => new Size(args[0], args[1]))
|
||||
.toList();
|
||||
|
||||
cardModels = new List<CardModel>.generate(cardSizes.length, (int i) {
|
||||
|
||||
@@ -39,7 +39,7 @@ class PianoKey {
|
||||
player.ptr.pause();
|
||||
}
|
||||
|
||||
Future<Null> load(MediaServiceProxy mediaService) async {
|
||||
Future load(MediaServiceProxy mediaService) async {
|
||||
try {
|
||||
mediaService.ptr.createPlayer(player);
|
||||
UrlResponse response = await fetchUrl(soundUrl);
|
||||
@@ -61,11 +61,11 @@ class PianoApp extends StatelessComponent {
|
||||
new PianoKey(Colors.purple[500], iLoveYou),
|
||||
];
|
||||
|
||||
Future<Null> loadSounds() async {
|
||||
Future loadSounds() async {
|
||||
MediaServiceProxy mediaService = new MediaServiceProxy.unbound();
|
||||
try {
|
||||
shell.connectToService("mojo:media_service", mediaService);
|
||||
List<Future<Null>> pending = <Future<Null>>[];
|
||||
List<Future<MediaPlayerPrepareResponseParams>> pending = <Future<MediaPlayerPrepareResponseParams>>[];
|
||||
for (PianoKey key in keys)
|
||||
pending.add(key.load(mediaService));
|
||||
await Future.wait(pending);
|
||||
@@ -93,8 +93,8 @@ class PianoApp extends StatelessComponent {
|
||||
}
|
||||
|
||||
Widget statusBox(Widget child) {
|
||||
const Color mediumGray = const Color(0xff555555);
|
||||
const Color darkGray = const Color(0xff222222);
|
||||
const mediumGray = const Color(0xff555555);
|
||||
const darkGray = const Color(0xff222222);
|
||||
return new Center(
|
||||
child: new Container(
|
||||
decoration: const BoxDecoration(
|
||||
@@ -121,7 +121,7 @@ Widget splashScreen() {
|
||||
);
|
||||
}
|
||||
|
||||
Future<Null> main() async {
|
||||
Future main() async {
|
||||
runApp(splashScreen());
|
||||
|
||||
PianoApp app = new PianoApp();
|
||||
|
||||
@@ -80,7 +80,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
tooltip: 'Open FAB demos',
|
||||
child: new Icon(icon: Icons.add),
|
||||
onPressed: () {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
Navigator.push(context, new MaterialPageRoute(
|
||||
builder: (BuildContext context) => new TabsFabDemo()
|
||||
));
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
new RaisedButton(
|
||||
child: new Text("Launch Demo"),
|
||||
onPressed: () {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
Navigator.push(context, new MaterialPageRoute(
|
||||
builder: (BuildContext context) => new SnackBarDemo()
|
||||
));
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
new FlatButton(
|
||||
child: new Text("Launch Demo"),
|
||||
onPressed: () {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
Navigator.push(context, new MaterialPageRoute(
|
||||
builder: (_) => new DialogDemo()
|
||||
));
|
||||
}
|
||||
@@ -200,10 +200,10 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
center: new Text("Buttons"),
|
||||
tabBar: new TabBar<_ButtonDemo>(
|
||||
isScrollable: true,
|
||||
labels: new Map<_ButtonDemo, TabLabel>.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel)
|
||||
labels: new Map.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel)
|
||||
)
|
||||
),
|
||||
body: new TabBarView<_ButtonDemo>(
|
||||
body: new TabBarView(
|
||||
children: demos.map(buildTabView).toList()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -77,8 +77,8 @@ class ColorSwatchTabView extends StatelessComponent {
|
||||
}
|
||||
|
||||
final ColorSwatch swatch;
|
||||
final TextStyle blackTextStyle = Typography.black.body1;
|
||||
final TextStyle whiteTextStyle = Typography.white.body1;
|
||||
final blackTextStyle = Typography.black.body1;
|
||||
final whiteTextStyle = Typography.white.body1;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> colorItems = swatch.colors.keys.map((int index) {
|
||||
@@ -116,12 +116,12 @@ class ColorsDemo extends StatelessComponent {
|
||||
center: new Text("Colors"),
|
||||
tabBar: new TabBar<ColorSwatch>(
|
||||
isScrollable: true,
|
||||
labels: new Map<ColorSwatch, TabLabel>.fromIterable(colorSwatches, value: (ColorSwatch swatch) {
|
||||
labels: new Map.fromIterable(colorSwatches, value: (ColorSwatch swatch) {
|
||||
return new TabLabel(text: swatch.name);
|
||||
})
|
||||
)
|
||||
),
|
||||
body: new TabBarView<ColorSwatch>(
|
||||
body: new TabBarView(
|
||||
children: colorSwatches.map((ColorSwatch swatch) {
|
||||
return new ColorSwatchTabView(swatch: swatch);
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ class DatePickerDemo extends StatefulComponent {
|
||||
class _DatePickerDemoState extends State<DatePickerDemo> {
|
||||
DateTime _selectedDate = new DateTime.now();
|
||||
|
||||
Future<Null> _handleSelectDate() async {
|
||||
Future _handleSelectDate() async {
|
||||
DateTime picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: _selectedDate,
|
||||
|
||||
@@ -60,12 +60,12 @@ class DialogDemo extends StatefulComponent {
|
||||
class DialogDemoState extends State<DialogDemo> {
|
||||
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
|
||||
void showDemoDialog/*<T>*/({ BuildContext context, Dialog dialog }) {
|
||||
showDialog/*<T>*/(
|
||||
void showDemoDialog({ BuildContext context, Dialog dialog }) {
|
||||
showDialog(
|
||||
context: context,
|
||||
child: dialog
|
||||
)
|
||||
.then((dynamic/*=T*/ value) { // The value passed to Navigator.pop() or null.
|
||||
.then((dynamic value) { // The value passed to Navigator.pop() or null.
|
||||
if (value != null) {
|
||||
scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
content: new Text('You selected: $value')
|
||||
@@ -89,7 +89,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
new RaisedButton(
|
||||
child: new Text('ALERT'),
|
||||
onPressed: () {
|
||||
showDemoDialog/*<DialogDemoAction>*/(
|
||||
showDemoDialog(
|
||||
context: context,
|
||||
dialog: new Dialog(
|
||||
content: new Text(
|
||||
@@ -113,7 +113,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
new RaisedButton(
|
||||
child: new Text('ALERT WITH TITLE'),
|
||||
onPressed: () {
|
||||
showDemoDialog/*<DialogDemoAction>*/(
|
||||
showDemoDialog(
|
||||
context: context,
|
||||
dialog: new Dialog(
|
||||
title: new Text("Use Google's location service?"),
|
||||
@@ -138,7 +138,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
new RaisedButton(
|
||||
child: new Text('SIMPLE'),
|
||||
onPressed: () {
|
||||
showDemoDialog/*<String>*/(
|
||||
showDemoDialog(
|
||||
context: context,
|
||||
dialog: new Dialog(
|
||||
title: new Text('Set backup account'),
|
||||
@@ -174,7 +174,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
context: context,
|
||||
initialTime: const TimeOfDay(hour: 15, minute: 30)
|
||||
)
|
||||
.then((TimeOfDay value) { // The value passed to Navigator.pop() or null.
|
||||
.then((value) { // The value passed to Navigator.pop() or null.
|
||||
if (value != null) {
|
||||
scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
content: new Text('You selected: $value')
|
||||
@@ -186,7 +186,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
new RaisedButton(
|
||||
child: new Text('FULLSCREEN'),
|
||||
onPressed: () {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
Navigator.push(context, new MaterialPageRoute(
|
||||
builder: (BuildContext context) => new FullScreenDialogDemo()
|
||||
));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class _FitnessDemoContents extends StatefulComponent {
|
||||
|
||||
class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
||||
|
||||
Future<Null> _loadAssets(AssetBundle bundle) async {
|
||||
Future _loadAssets(AssetBundle bundle) async {
|
||||
_images = new ImageMap(bundle);
|
||||
await _images.load(<String>[
|
||||
'packages/flutter_gallery_assets/jumpingjack.png',
|
||||
@@ -267,9 +267,9 @@ class _WorkoutAnimationNode extends NodeWithSize {
|
||||
class _ProgressCircle extends NodeWithSize {
|
||||
_ProgressCircle(Size size, [this.value = 0.0]) : super(size);
|
||||
|
||||
static const double _kTwoPI = math.PI * 2.0;
|
||||
static const double _kEpsilon = .0000001;
|
||||
static const double _kSweep = _kTwoPI - _kEpsilon;
|
||||
static const _kTwoPI = math.PI * 2.0;
|
||||
static const _kEpsilon = .0000001;
|
||||
static const _kSweep = _kTwoPI - _kEpsilon;
|
||||
|
||||
double value;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class GridDemoPhotoItem extends StatelessComponent {
|
||||
final GridDemoTileStyle tileStyle;
|
||||
|
||||
void showPhoto(BuildContext context) {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
Navigator.push(context, new MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
@@ -138,7 +138,7 @@ class GridListDemoState extends State<GridListDemo> {
|
||||
GridDemoTileStyle tileStyle = GridDemoTileStyle.twoLine;
|
||||
|
||||
void showTileStyleMenu(BuildContext context) {
|
||||
final List<PopupMenuItem<GridDemoTileStyle>> items = <PopupMenuItem<GridDemoTileStyle>>[
|
||||
final List<PopupMenuItem> items = <PopupMenuItem<GridDemoTileStyle>>[
|
||||
new PopupMenuItem<GridDemoTileStyle>(
|
||||
value: GridDemoTileStyle.imageOnly,
|
||||
child: new Text('Image only')
|
||||
|
||||
@@ -37,7 +37,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
List<LeaveBehindItem> leaveBehindItems;
|
||||
|
||||
void initListItems() {
|
||||
leaveBehindItems = new List<LeaveBehindItem>.generate(16, (int index) {
|
||||
leaveBehindItems = new List.generate(16, (int index) {
|
||||
return new LeaveBehindItem(
|
||||
index: index,
|
||||
name: 'Item $index Sender',
|
||||
@@ -130,7 +130,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
right: <Widget>[
|
||||
new PopupMenuButton<LeaveBehindDemoAction>(
|
||||
onSelected: handleDemoAction,
|
||||
items: <PopupMenuEntry<LeaveBehindDemoAction>>[
|
||||
items: <PopupMenuEntry>[
|
||||
new PopupMenuItem<LeaveBehindDemoAction>(
|
||||
value: LeaveBehindDemoAction.reset,
|
||||
child: new Text('Reset the list')
|
||||
|
||||
@@ -19,7 +19,7 @@ class ListDemo extends StatefulComponent {
|
||||
class ListDemoState extends State<ListDemo> {
|
||||
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
|
||||
PersistentBottomSheetController<Null> _bottomSheet;
|
||||
ScaffoldFeatureController _bottomSheet;
|
||||
ListDemoItemSize _itemSize = ListDemoItemSize.threeLine;
|
||||
bool _dense = false;
|
||||
bool _showAvatars = true;
|
||||
|
||||
@@ -176,7 +176,7 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
right: new PopupMenuButton<String>(
|
||||
onSelected: showCheckedMenuSelections,
|
||||
items: <PopupMenuItem<String>>[
|
||||
new CheckedPopupMenuItem<String>(
|
||||
new CheckedPopupMenuItem(
|
||||
value: _checkedValue1,
|
||||
checked: isChecked(_checkedValue1),
|
||||
child: new Text(_checkedValue1)
|
||||
|
||||
@@ -21,7 +21,7 @@ class ModalBottomSheetDemo extends StatelessComponent {
|
||||
child: new RaisedButton(
|
||||
child: new Text('Show the modal bottom sheet', style: textStyle),
|
||||
onPressed: () {
|
||||
showModalBottomSheet/*<Null>*/(context: context, builder: (BuildContext context) {
|
||||
showModalBottomSheet(context: context, builder: (_) {
|
||||
return new Container(
|
||||
child: new Padding(
|
||||
padding: const EdgeDims.all(32.0),
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
|
||||
class PageSelectorDemo extends StatelessComponent {
|
||||
|
||||
void _handleArrowButtonPress(BuildContext context, int delta) {
|
||||
final TabBarSelectionState<IconData> selection = TabBarSelection.of/*<IconData>*/(context);
|
||||
final TabBarSelectionState selection = TabBarSelection.of(context);
|
||||
if (!selection.valueIsChanging)
|
||||
selection.value = selection.values[(selection.index + delta).clamp(0, selection.values.length - 1)];
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class PageSelectorDemo extends StatelessComponent {
|
||||
)
|
||||
),
|
||||
new Flexible(
|
||||
child: new TabBarView<IconData>(
|
||||
child: new TabBarView(
|
||||
children: icons.map((IconData icon) {
|
||||
return new Container(
|
||||
key: new ObjectKey(icon),
|
||||
|
||||
@@ -82,7 +82,7 @@ class _TechniqueItem extends StatelessComponent {
|
||||
final WidgetBuilder builder;
|
||||
|
||||
void showDemo(BuildContext context) {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(builder: builder));
|
||||
Navigator.push(context, new MaterialPageRoute(builder: builder));
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -25,20 +25,20 @@ class TabsDemo extends StatelessComponent {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
final Color iconColor = Theme.of(context).accentColor;
|
||||
return new TabBarSelection<IconData>(
|
||||
return new TabBarSelection(
|
||||
values: icons,
|
||||
child: new Scaffold(
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("Scrollable Tabs"),
|
||||
tabBar: new TabBar<IconData>(
|
||||
tabBar: new TabBar<String>(
|
||||
isScrollable: true,
|
||||
labels: new Map<IconData, TabLabel>.fromIterable(
|
||||
labels: new Map.fromIterable(
|
||||
icons,
|
||||
value: (IconData icon) => new TabLabel(text: labels[icon], icon: icon)
|
||||
)
|
||||
)
|
||||
),
|
||||
body: new TabBarView<IconData>(
|
||||
body: new TabBarView(
|
||||
children: icons.map((IconData icon) {
|
||||
return new Container(
|
||||
key: new ObjectKey(icon),
|
||||
|
||||
@@ -97,7 +97,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
|
||||
toolBar: new ToolBar(
|
||||
center: new Text("FAB per Tab"),
|
||||
tabBar: new TabBar<_Page>(
|
||||
labels: new Map<_Page, TabLabel>.fromIterable(pages, value: (_Page page) => page.tabLabel)
|
||||
labels: new Map.fromIterable(pages, value: (_Page page) => page.tabLabel)
|
||||
)
|
||||
),
|
||||
floatingActionButton: !selectedPage.fabDefined ? null : new FloatingActionButton(
|
||||
@@ -107,7 +107,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
|
||||
child: selectedPage.fabIcon,
|
||||
onPressed: _showExplanatoryText
|
||||
),
|
||||
body: new TabBarView<_Page>(children: pages.map(buildTabView).toList())
|
||||
body: new TabBarView(children: pages.map(buildTabView).toList())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class TimePickerDemo extends StatefulComponent {
|
||||
class _TimePickerDemoState extends State<TimePickerDemo> {
|
||||
TimeOfDay _selectedTime = const TimeOfDay(hour: 7, minute: 28);
|
||||
|
||||
Future<Null> _handleSelectTime() async {
|
||||
Future _handleSelectTime() async {
|
||||
TimeOfDay picked = await showTimePicker(
|
||||
context: context,
|
||||
initialTime: _selectedTime
|
||||
|
||||
@@ -24,7 +24,7 @@ class WeatherDemo extends StatefulComponent {
|
||||
|
||||
class _WeatherDemoState extends State<WeatherDemo> {
|
||||
|
||||
Future<Null> _loadAssets(AssetBundle bundle) async {
|
||||
Future _loadAssets(AssetBundle bundle) async {
|
||||
_images = new ImageMap(bundle);
|
||||
await _images.load(<String>[
|
||||
'packages/flutter_gallery_assets/clouds-0.png',
|
||||
|
||||
@@ -16,7 +16,7 @@ class GallerySection extends StatelessComponent {
|
||||
final List<GalleryDemo> demos;
|
||||
|
||||
void showDemo(GalleryDemo demo, BuildContext context, ThemeData theme) {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
Navigator.push(context, new MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
Widget child = (demo.builder == null) ? null : demo.builder();
|
||||
return new Theme(data: theme, child: child);
|
||||
@@ -31,7 +31,7 @@ class GallerySection extends StatelessComponent {
|
||||
);
|
||||
final double appBarHeight = 200.0;
|
||||
final Key scrollableKey = new ValueKey<String>(title); // assume section titles differ
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
Navigator.push(context, new MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return new Theme(
|
||||
data: theme,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user