From db3b9e805292ea6778bb2c51c0b9b9464ebe2ebd Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 9 Oct 2015 10:19:35 -0700 Subject: [PATCH] Rename App to MaterialApp MaterialApp assumes that you're using material design. Also move radial reaction and fix imports for stats box. --- examples/address_book/lib/main.dart | 2 +- examples/demo_launcher/lib/main.dart | 2 +- examples/fitness/lib/main.dart | 2 +- examples/game/example_effect_line.dart | 2 +- examples/game/lib/main.dart | 2 +- examples/game/test_bed.dart | 2 +- examples/game/test_drawatlas.dart | 2 +- examples/game/test_performance.dart | 2 +- examples/game/test_physics.dart | 2 +- examples/stocks/lib/main.dart | 2 +- examples/widgets/card_collection.dart | 2 +- examples/widgets/drag_and_drop.dart | 2 +- examples/widgets/ensure_visible.dart | 2 +- examples/widgets/indexed_stack.dart | 2 +- examples/widgets/navigation.dart | 2 +- examples/widgets/overlay_geometry.dart | 2 +- examples/widgets/pageable_list.dart | 2 +- examples/widgets/sector.dart | 2 +- packages/flutter/lib/material.dart | 9 +++++---- packages/flutter/lib/painting.dart | 1 - packages/flutter/lib/rendering.dart | 1 + .../src/material/{app.dart => material_app.dart} | 16 +++++----------- .../{painting => material}/radial_reaction.dart | 0 packages/flutter/lib/src/material/switch.dart | 3 ++- .../lib/src/widgets/statistics_overlay.dart | 4 ++-- packages/unit/test/widget/drawer_test.dart | 4 ++-- packages/unit/test/widget/snack_bar_test.dart | 2 +- 27 files changed, 36 insertions(+), 40 deletions(-) rename packages/flutter/lib/src/material/{app.dart => material_app.dart} (79%) rename packages/flutter/lib/src/{painting => material}/radial_reaction.dart (100%) diff --git a/examples/address_book/lib/main.dart b/examples/address_book/lib/main.dart index fb10eccbcc4..dee2b761489 100644 --- a/examples/address_book/lib/main.dart +++ b/examples/address_book/lib/main.dart @@ -94,7 +94,7 @@ final ThemeData theme = new ThemeData( ); void main() { - runApp(new App( + runApp(new MaterialApp( title: 'Address Book', theme: theme, routes: { diff --git a/examples/demo_launcher/lib/main.dart b/examples/demo_launcher/lib/main.dart index dd4bf62a3cf..a95c24ee5c9 100644 --- a/examples/demo_launcher/lib/main.dart +++ b/examples/demo_launcher/lib/main.dart @@ -201,7 +201,7 @@ class DemoHome extends StatelessComponent { } void main() { - runApp(new App( + runApp(new MaterialApp( title: 'Flutter Demos', theme: _theme, routes: { diff --git a/examples/fitness/lib/main.dart b/examples/fitness/lib/main.dart index c747be646d8..453648ba5f7 100644 --- a/examples/fitness/lib/main.dart +++ b/examples/fitness/lib/main.dart @@ -125,7 +125,7 @@ class FitnessAppState extends State { } Widget build(BuildContext) { - return new App( + return new MaterialApp( theme: new ThemeData( brightness: ThemeBrightness.light, primarySwatch: Colors.indigo, diff --git a/examples/game/example_effect_line.dart b/examples/game/example_effect_line.dart index 05323d00d9d..6d05848942a 100644 --- a/examples/game/example_effect_line.dart +++ b/examples/game/example_effect_line.dart @@ -53,7 +53,7 @@ class TestAppState extends State { ]; Widget build(BuildContext context) { - return new App( + return new MaterialApp( title: 'EffectLine Demo', theme: _theme, routes: { diff --git a/examples/game/lib/main.dart b/examples/game/lib/main.dart index 9150ab95fc0..098f3ebfbfe 100644 --- a/examples/game/lib/main.dart +++ b/examples/game/lib/main.dart @@ -81,7 +81,7 @@ class GameDemoState extends State { int _lastScore = 0; Widget build(BuildContext context) { - return new App( + return new MaterialApp( title: 'Asteroids', theme: _theme, routes: { diff --git a/examples/game/test_bed.dart b/examples/game/test_bed.dart index 653a566c0e1..b2dc7fbc6e6 100644 --- a/examples/game/test_bed.dart +++ b/examples/game/test_bed.dart @@ -32,7 +32,7 @@ main() async { runApp(_app); } -class TestBedApp extends App { +class TestBedApp extends MaterialApp { Widget build() { ThemeData theme = new ThemeData( diff --git a/examples/game/test_drawatlas.dart b/examples/game/test_drawatlas.dart index dba1748a259..edf568e5aea 100644 --- a/examples/game/test_drawatlas.dart +++ b/examples/game/test_drawatlas.dart @@ -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: { diff --git a/examples/game/test_performance.dart b/examples/game/test_performance.dart index 5ceab235d41..44d363c12fb 100644 --- a/examples/game/test_performance.dart +++ b/examples/game/test_performance.dart @@ -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: { diff --git a/examples/game/test_physics.dart b/examples/game/test_physics.dart index 137a3257cea..4c2ecc10b6b 100644 --- a/examples/game/test_physics.dart +++ b/examples/game/test_physics.dart @@ -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, diff --git a/examples/stocks/lib/main.dart b/examples/stocks/lib/main.dart index 1a4679006e0..f791c55e0c1 100644 --- a/examples/stocks/lib/main.dart +++ b/examples/stocks/lib/main.dart @@ -87,7 +87,7 @@ class StocksAppState extends State { } Widget build(BuildContext context) { - return new App( + return new MaterialApp( title: 'Stocks', theme: theme, routes: { diff --git a/examples/widgets/card_collection.dart b/examples/widgets/card_collection.dart index 7896c6809aa..0293a73d707 100644 --- a/examples/widgets/card_collection.dart +++ b/examples/widgets/card_collection.dart @@ -372,7 +372,7 @@ class CardCollectionState extends State { } void main() { - runApp(new App( + runApp(new MaterialApp( title: 'Cards', routes: { '/': (RouteArguments args) => new CardCollection(navigator: args.navigator), diff --git a/examples/widgets/drag_and_drop.dart b/examples/widgets/drag_and_drop.dart index a7c5ff63d73..7de9a6b3485 100644 --- a/examples/widgets/drag_and_drop.dart +++ b/examples/widgets/drag_and_drop.dart @@ -129,7 +129,7 @@ class DragAndDropAppState extends State { } void main() { - runApp(new App( + runApp(new MaterialApp( title: 'Drag and Drop Flutter Demo', routes: { '/': (RouteArguments args) => new DragAndDropApp(navigator: args.navigator) diff --git a/examples/widgets/ensure_visible.dart b/examples/widgets/ensure_visible.dart index d59e0d6cea6..fe570fdfda6 100644 --- a/examples/widgets/ensure_visible.dart +++ b/examples/widgets/ensure_visible.dart @@ -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); diff --git a/examples/widgets/indexed_stack.dart b/examples/widgets/indexed_stack.dart index e7a5e4952bd..5f23624d985 100644 --- a/examples/widgets/indexed_stack.dart +++ b/examples/widgets/indexed_stack.dart @@ -56,7 +56,7 @@ class IndexedStackDemoState extends State { } void main() { - runApp(new App( + runApp(new MaterialApp( title: 'IndexedStackDemo', theme: new ThemeData( brightness: ThemeBrightness.light, diff --git a/examples/widgets/navigation.dart b/examples/widgets/navigation.dart index 1e76049291f..9624c205881 100644 --- a/examples/widgets/navigation.dart +++ b/examples/widgets/navigation.dart @@ -57,7 +57,7 @@ final ThemeData theme = new ThemeData( ); void main() { - runApp(new App( + runApp(new MaterialApp( title: 'Navigation Example', theme: theme, routes: routes diff --git a/examples/widgets/overlay_geometry.dart b/examples/widgets/overlay_geometry.dart index 34be772d527..bc55cafbbed 100644 --- a/examples/widgets/overlay_geometry.dart +++ b/examples/widgets/overlay_geometry.dart @@ -156,7 +156,7 @@ class OverlayGeometryAppState extends State { } void main() { - runApp(new App( + runApp(new MaterialApp( theme: new ThemeData( brightness: ThemeBrightness.light, primarySwatch: Colors.blue, diff --git a/examples/widgets/pageable_list.dart b/examples/widgets/pageable_list.dart index f51083e801e..05d216d06f1 100644 --- a/examples/widgets/pageable_list.dart +++ b/examples/widgets/pageable_list.dart @@ -156,7 +156,7 @@ class PageableListAppState extends State { } void main() { - runApp(new App( + runApp(new MaterialApp( title: 'PageableList', theme: new ThemeData( brightness: ThemeBrightness.light, diff --git a/examples/widgets/sector.dart b/examples/widgets/sector.dart index c87d87c1a25..d6253c228f2 100644 --- a/examples/widgets/sector.dart +++ b/examples/widgets/sector.dart @@ -16,7 +16,7 @@ RenderBox initCircle() { ); } -class SectorApp extends App { +class SectorApp extends MaterialApp { RenderBoxToRenderSectorAdapter sectors = initCircle(); math.Random rand = new math.Random(1); diff --git a/packages/flutter/lib/material.dart b/packages/flutter/lib/material.dart index 69cabb7288a..e2e50c720cc 100644 --- a/packages/flutter/lib/material.dart +++ b/packages/flutter/lib/material.dart @@ -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'; diff --git a/packages/flutter/lib/painting.dart b/packages/flutter/lib/painting.dart index a8f20519f79..e23302cef38 100644 --- a/packages/flutter/lib/painting.dart +++ b/packages/flutter/lib/painting.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'; diff --git a/packages/flutter/lib/rendering.dart b/packages/flutter/lib/rendering.dart index d37ea3cdb64..4a9564b7b4a 100644 --- a/packages/flutter/lib/rendering.dart +++ b/packages/flutter/lib/rendering.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'; diff --git a/packages/flutter/lib/src/material/app.dart b/packages/flutter/lib/src/material/material_app.dart similarity index 79% rename from packages/flutter/lib/src/material/app.dart rename to packages/flutter/lib/src/material/material_app.dart index e73eab17bd2..8076d94f1d4 100644 --- a/packages/flutter/lib/src/material/app.dart +++ b/packages/flutter/lib/src/material/material_app.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 routes; final RouteGenerator onGenerateRoute; - _AppState createState() => new _AppState(); + _MaterialAppState createState() => new _MaterialAppState(); } -class _AppState extends State { +class _MaterialAppState extends State { GlobalObjectKey _navigator; diff --git a/packages/flutter/lib/src/painting/radial_reaction.dart b/packages/flutter/lib/src/material/radial_reaction.dart similarity index 100% rename from packages/flutter/lib/src/painting/radial_reaction.dart rename to packages/flutter/lib/src/material/radial_reaction.dart diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart index 959d940a7ac..c221028e100 100644 --- a/packages/flutter/lib/src/material/switch.dart +++ b/packages/flutter/lib/src/material/switch.dart @@ -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; diff --git a/packages/flutter/lib/src/widgets/statistics_overlay.dart b/packages/flutter/lib/src/widgets/statistics_overlay.dart index a4c5eb62a27..80fa77915e3 100644 --- a/packages/flutter/lib/src/widgets/statistics_overlay.dart +++ b/packages/flutter/lib/src/widgets/statistics_overlay.dart @@ -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 diff --git a/packages/unit/test/widget/drawer_test.dart b/packages/unit/test/widget/drawer_test.dart index 36389c8b3b8..2e976af0863 100644 --- a/packages/unit/test/widget/drawer_test.dart +++ b/packages/unit/test/widget/drawer_test.dart @@ -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; diff --git a/packages/unit/test/widget/snack_bar_test.dart b/packages/unit/test/widget/snack_bar_test.dart index eb056b390fa..4ddfd843829 100644 --- a/packages/unit/test/widget/snack_bar_test.dart +++ b/packages/unit/test/widget/snack_bar_test.dart @@ -10,7 +10,7 @@ void main() { GlobalKey placeholderKey = new GlobalKey(); Key tapTarget = new Key('tap-target'); - tester.pumpWidget(new App( + tester.pumpWidget(new MaterialApp( routes: { '/': (RouteArguments args) { return new GestureDetector(