mirror of
https://github.com/flutter/flutter.git
synced 2026-02-04 19:00:09 +08:00
Rename App to MaterialApp
MaterialApp assumes that you're using material design. Also move radial reaction and fix imports for stats box.
This commit is contained in:
parent
cceb4187cc
commit
db3b9e8052
@ -94,7 +94,7 @@ final ThemeData theme = new ThemeData(
|
||||
);
|
||||
|
||||
void main() {
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'Address Book',
|
||||
theme: theme,
|
||||
routes: <String, RouteBuilder>{
|
||||
|
||||
@ -201,7 +201,7 @@ class DemoHome extends StatelessComponent {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'Flutter Demos',
|
||||
theme: _theme,
|
||||
routes: {
|
||||
|
||||
@ -125,7 +125,7 @@ class FitnessAppState extends State<FitnessApp> {
|
||||
}
|
||||
|
||||
Widget build(BuildContext) {
|
||||
return new App(
|
||||
return new MaterialApp(
|
||||
theme: new ThemeData(
|
||||
brightness: ThemeBrightness.light,
|
||||
primarySwatch: Colors.indigo,
|
||||
|
||||
@ -53,7 +53,7 @@ class TestAppState extends State<TestApp> {
|
||||
];
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new App(
|
||||
return new MaterialApp(
|
||||
title: 'EffectLine Demo',
|
||||
theme: _theme,
|
||||
routes: {
|
||||
|
||||
@ -81,7 +81,7 @@ class GameDemoState extends State<GameDemo> {
|
||||
int _lastScore = 0;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new App(
|
||||
return new MaterialApp(
|
||||
title: 'Asteroids',
|
||||
theme: _theme,
|
||||
routes: {
|
||||
|
||||
@ -32,7 +32,7 @@ main() async {
|
||||
runApp(_app);
|
||||
}
|
||||
|
||||
class TestBedApp extends App {
|
||||
class TestBedApp extends MaterialApp {
|
||||
|
||||
Widget build() {
|
||||
ThemeData theme = new ThemeData(
|
||||
|
||||
@ -32,7 +32,7 @@ main() async {
|
||||
String json = await _bundle.loadString('assets/sprites.json');
|
||||
_spriteSheet = new SpriteSheet(_images['assets/sprites.png'], json);
|
||||
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'Test drawAtlas',
|
||||
theme: _theme,
|
||||
routes: {
|
||||
|
||||
@ -33,7 +33,7 @@ main() async {
|
||||
String json = await _bundle.loadString('assets/sprites.json');
|
||||
_spriteSheet = new SpriteSheet(_images['assets/sprites.png'], json);
|
||||
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'Test Sprite Performance',
|
||||
theme: _theme,
|
||||
routes: {
|
||||
|
||||
@ -27,7 +27,7 @@ main() async {
|
||||
String json = await _bundle.loadString('assets/sprites.json');
|
||||
_spriteSheet = new SpriteSheet(_images['assets/sprites.png'], json);
|
||||
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'Test Physics',
|
||||
theme: new ThemeData(
|
||||
brightness: ThemeBrightness.light,
|
||||
|
||||
@ -87,7 +87,7 @@ class StocksAppState extends State<StocksApp> {
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new App(
|
||||
return new MaterialApp(
|
||||
title: 'Stocks',
|
||||
theme: theme,
|
||||
routes: <String, RouteBuilder>{
|
||||
|
||||
@ -372,7 +372,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'Cards',
|
||||
routes: {
|
||||
'/': (RouteArguments args) => new CardCollection(navigator: args.navigator),
|
||||
|
||||
@ -129,7 +129,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'Drag and Drop Flutter Demo',
|
||||
routes: {
|
||||
'/': (RouteArguments args) => new DragAndDropApp(navigator: args.navigator)
|
||||
|
||||
@ -13,7 +13,7 @@ class CardModel {
|
||||
Key get key => new ObjectKey(this);
|
||||
}
|
||||
|
||||
class EnsureVisibleApp extends App {
|
||||
class EnsureVisibleApp extends MaterialApp {
|
||||
|
||||
static const TextStyle cardLabelStyle =
|
||||
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: bold);
|
||||
|
||||
@ -56,7 +56,7 @@ class IndexedStackDemoState extends State<IndexedStackDemo> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'IndexedStackDemo',
|
||||
theme: new ThemeData(
|
||||
brightness: ThemeBrightness.light,
|
||||
|
||||
@ -57,7 +57,7 @@ final ThemeData theme = new ThemeData(
|
||||
);
|
||||
|
||||
void main() {
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'Navigation Example',
|
||||
theme: theme,
|
||||
routes: routes
|
||||
|
||||
@ -156,7 +156,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
theme: new ThemeData(
|
||||
brightness: ThemeBrightness.light,
|
||||
primarySwatch: Colors.blue,
|
||||
|
||||
@ -156,7 +156,7 @@ class PageableListAppState extends State<PageableListApp> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new App(
|
||||
runApp(new MaterialApp(
|
||||
title: 'PageableList',
|
||||
theme: new ThemeData(
|
||||
brightness: ThemeBrightness.light,
|
||||
|
||||
@ -16,7 +16,7 @@ RenderBox initCircle() {
|
||||
);
|
||||
}
|
||||
|
||||
class SectorApp extends App {
|
||||
class SectorApp extends MaterialApp {
|
||||
|
||||
RenderBoxToRenderSectorAdapter sectors = initCircle();
|
||||
math.Random rand = new math.Random(1);
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
/// See https://www.google.com/design/spec/material-design/introduction.html
|
||||
library material;
|
||||
|
||||
export 'src/material/app.dart';
|
||||
export 'src/material/card.dart';
|
||||
export 'src/material/checkbox.dart';
|
||||
export 'src/material/colors.dart';
|
||||
@ -25,10 +24,11 @@ export 'src/material/icon_button.dart';
|
||||
export 'src/material/icon.dart';
|
||||
export 'src/material/ink_well.dart';
|
||||
export 'src/material/input.dart';
|
||||
export 'src/material/material_button.dart';
|
||||
export 'src/material/material.dart';
|
||||
export 'src/material/popup_menu.dart';
|
||||
export 'src/material/material_app.dart';
|
||||
export 'src/material/material_button.dart';
|
||||
export 'src/material/popup_menu_item.dart';
|
||||
export 'src/material/popup_menu.dart';
|
||||
export 'src/material/progress_indicator.dart';
|
||||
export 'src/material/radio.dart';
|
||||
export 'src/material/raised_button.dart';
|
||||
@ -37,10 +37,11 @@ export 'src/material/shadows.dart';
|
||||
export 'src/material/snack_bar.dart';
|
||||
export 'src/material/switch.dart';
|
||||
export 'src/material/tabs.dart';
|
||||
export 'src/material/theme.dart';
|
||||
export 'src/material/theme_data.dart';
|
||||
export 'src/material/theme.dart';
|
||||
export 'src/material/title.dart';
|
||||
export 'src/material/tool_bar.dart';
|
||||
export 'src/material/typography.dart';
|
||||
export 'src/material/radial_reaction.dart';
|
||||
|
||||
export 'widgets.dart';
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
library painting;
|
||||
|
||||
export 'src/painting/box_painter.dart';
|
||||
export 'src/painting/radial_reaction.dart';
|
||||
export 'src/painting/shadows.dart';
|
||||
export 'src/painting/text_painter.dart';
|
||||
export 'src/painting/text_style.dart';
|
||||
|
||||
@ -23,6 +23,7 @@ export 'src/rendering/proxy_box.dart';
|
||||
export 'src/rendering/shifted_box.dart';
|
||||
export 'src/rendering/binding.dart';
|
||||
export 'src/rendering/stack.dart';
|
||||
export 'src/rendering/statistics_box.dart';
|
||||
export 'src/rendering/toggleable.dart';
|
||||
export 'src/rendering/view.dart';
|
||||
export 'src/rendering/viewport.dart';
|
||||
|
||||
@ -23,21 +23,15 @@ const TextStyle _errorTextStyle = const TextStyle(
|
||||
decorationStyle: TextDecorationStyle.double
|
||||
);
|
||||
|
||||
class App extends StatefulComponent {
|
||||
App({
|
||||
class MaterialApp extends StatefulComponent {
|
||||
MaterialApp({
|
||||
Key key,
|
||||
this.title,
|
||||
this.theme,
|
||||
this.routes,
|
||||
this.onGenerateRoute
|
||||
}) : super(key: key) {
|
||||
assert(() {
|
||||
'The "routes" argument to App() is required.';
|
||||
'This might be a sign that you have not upgraded to our new Widgets framework.';
|
||||
'For more details see: https://groups.google.com/forum/#!topic/flutter-dev/hcX3OvLws9c';
|
||||
'...or look at our examples: https://github.com/flutter/engine/tree/master/examples';
|
||||
return routes != null;
|
||||
});
|
||||
assert(routes != null);
|
||||
}
|
||||
|
||||
final String title;
|
||||
@ -45,10 +39,10 @@ class App extends StatefulComponent {
|
||||
final Map<String, RouteBuilder> routes;
|
||||
final RouteGenerator onGenerateRoute;
|
||||
|
||||
_AppState createState() => new _AppState();
|
||||
_MaterialAppState createState() => new _MaterialAppState();
|
||||
}
|
||||
|
||||
class _AppState extends State<App> {
|
||||
class _MaterialAppState extends State<MaterialApp> {
|
||||
|
||||
GlobalObjectKey _navigator;
|
||||
|
||||
@ -5,11 +5,12 @@
|
||||
import 'dart:async';
|
||||
import 'dart:sky' as sky;
|
||||
|
||||
import 'package:sky/material.dart';
|
||||
import 'package:sky/painting.dart';
|
||||
import 'package:sky/rendering.dart';
|
||||
import 'package:sky/widgets.dart';
|
||||
|
||||
import 'radial_reaction.dart';
|
||||
import 'shadows.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
export 'package:sky/rendering.dart' show ValueChanged;
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'framework.dart';
|
||||
import 'package:sky/rendering.dart';
|
||||
|
||||
import 'package:sky/src/rendering/statistics_box.dart';
|
||||
import 'framework.dart';
|
||||
|
||||
/// The options that control whether the statistics overlay displays certain
|
||||
/// aspects of the compositor
|
||||
|
||||
@ -10,7 +10,7 @@ void main() {
|
||||
testWidgets((WidgetTester tester) {
|
||||
NavigatorState navigator;
|
||||
tester.pumpWidget(
|
||||
new App(
|
||||
new MaterialApp(
|
||||
routes: {
|
||||
'/': (RouteArguments args) {
|
||||
navigator = args.navigator;
|
||||
@ -39,7 +39,7 @@ void main() {
|
||||
NavigatorState navigator;
|
||||
tester.pumpWidget(new Container()); // throw away the old App and its Navigator
|
||||
tester.pumpWidget(
|
||||
new App(
|
||||
new MaterialApp(
|
||||
routes: {
|
||||
'/': (RouteArguments args) {
|
||||
navigator = args.navigator;
|
||||
|
||||
@ -10,7 +10,7 @@ void main() {
|
||||
GlobalKey<PlaceholderState> placeholderKey = new GlobalKey<PlaceholderState>();
|
||||
Key tapTarget = new Key('tap-target');
|
||||
|
||||
tester.pumpWidget(new App(
|
||||
tester.pumpWidget(new MaterialApp(
|
||||
routes: {
|
||||
'/': (RouteArguments args) {
|
||||
return new GestureDetector(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user