diff --git a/examples/flutter_gallery/lib/demo/all.dart b/examples/flutter_gallery/lib/demo/all.dart index c60963a3fa..56446e0613 100644 --- a/examples/flutter_gallery/lib/demo/all.dart +++ b/examples/flutter_gallery/lib/demo/all.dart @@ -10,7 +10,6 @@ export 'colors_demo.dart'; export 'data_table_demo.dart'; export 'date_picker_demo.dart'; export 'dialog_demo.dart'; -export 'drawing_demo.dart'; export 'drop_down_demo.dart'; export 'fitness_demo.dart'; export 'flexible_space_demo.dart'; diff --git a/examples/flutter_gallery/lib/demo/drawing_demo.dart b/examples/flutter_gallery/lib/demo/drawing_demo.dart deleted file mode 100644 index 9774d52f07..0000000000 --- a/examples/flutter_gallery/lib/demo/drawing_demo.dart +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2016 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 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -import 'package:flutter_sprites/flutter_sprites.dart'; - -class DrawingDemo extends StatefulWidget { - static const String routeName = '/drawing'; - - @override - _DrawingDemoState createState() => new _DrawingDemoState(); -} - -class _DrawingDemoState extends State { - _LineDrawingNode _rootNode; - ImageMap _images; - - Future _loadAssets(AssetBundle bundle) async { - _images = new ImageMap(bundle); - await _images.load([ - 'packages/flutter_gallery_assets/fancylines.png' - ]); - } - - @override - void initState() { - super.initState(); - _loadAssets(DefaultAssetBundle.of(context)).then((_) { - setState(() { - _rootNode = new _LineDrawingNode(_images); - }); - }); - } - - @override - Widget build(BuildContext context) { - Widget body; - if (_rootNode == null) { - body = new Center( - child: new CircularProgressIndicator() - ); - } else { - body = new SpriteWidget(_rootNode, SpriteBoxTransformMode.nativePoints); - } - - return new Scaffold( - appBar: new AppBar( - title: new Text('Fancy lines') - ), - body: body - ); - } -} - -class _LineDrawingNode extends NodeWithSize { - _LineDrawingNode(this._images) : super(const Size(1024.0, 1024.0)) { - userInteractionEnabled = true; - } - - final ImageMap _images; - EffectLine _currentLine; - - @override - bool handleEvent(SpriteBoxEvent event) { - if (event.type == PointerDownEvent) { - _currentLine = new EffectLine( - texture: new Texture(_images['packages/flutter_gallery_assets/fancylines.png']), - colorSequence: new ColorSequence.fromStartAndEndColor(Colors.purple[500], Colors.purple[600]), - fadeAfterDelay: 3.0, - fadeDuration: 1.0 - ); - _currentLine.addPoint(event.boxPosition); - addChild(_currentLine); - } else if (event.type == PointerMoveEvent) { - _currentLine.addPoint(event.boxPosition); - } - - return true; - } -} diff --git a/examples/flutter_gallery/lib/gallery/app.dart b/examples/flutter_gallery/lib/gallery/app.dart index 87c935a346..1a1d44451c 100644 --- a/examples/flutter_gallery/lib/gallery/app.dart +++ b/examples/flutter_gallery/lib/gallery/app.dart @@ -11,7 +11,6 @@ import 'home.dart'; final Map kRoutes = { WeatherDemo.routeName: (BuildContext context) => new WeatherDemo(), FitnessDemo.routeName: (BuildContext context) => new FitnessDemo(), - DrawingDemo.routeName: (BuildContext context) => new DrawingDemo(), Calculator.routeName: (BuildContext context) => new Calculator(), FlexibleSpaceDemo.routeName: (BuildContext context) => new FlexibleSpaceDemo(), TabsFabDemo.routeName: (BuildContext context) => new TabsFabDemo(), diff --git a/examples/flutter_gallery/lib/gallery/home.dart b/examples/flutter_gallery/lib/gallery/home.dart index 25c6662db9..7500a818d3 100644 --- a/examples/flutter_gallery/lib/gallery/home.dart +++ b/examples/flutter_gallery/lib/gallery/home.dart @@ -75,7 +75,6 @@ class GalleryHomeState extends State { children: [ new GalleryItem(title: 'Weather', routeName: WeatherDemo.routeName), new GalleryItem(title: 'Fitness', routeName: FitnessDemo.routeName), - new GalleryItem(title: 'Fancy lines', routeName: DrawingDemo.routeName), new GalleryItem(title: 'Calculator', routeName: Calculator.routeName), new GalleryItem(title: 'Flexible space toolbar', routeName: FlexibleSpaceDemo.routeName), new GalleryItem(title: 'Floating action button', routeName: TabsFabDemo.routeName),