Remove fancy lines demo from Gallery (#4323)
This demo burns battery continuously even when there's no change to the visual appearance. This patch removes this demo to avoid giving the impression that Flutter burns battery. Related to #4120
This commit is contained in:
parent
e7a28f31e5
commit
0679da0a23
@ -10,7 +10,6 @@ export 'colors_demo.dart';
|
|||||||
export 'data_table_demo.dart';
|
export 'data_table_demo.dart';
|
||||||
export 'date_picker_demo.dart';
|
export 'date_picker_demo.dart';
|
||||||
export 'dialog_demo.dart';
|
export 'dialog_demo.dart';
|
||||||
export 'drawing_demo.dart';
|
|
||||||
export 'drop_down_demo.dart';
|
export 'drop_down_demo.dart';
|
||||||
export 'fitness_demo.dart';
|
export 'fitness_demo.dart';
|
||||||
export 'flexible_space_demo.dart';
|
export 'flexible_space_demo.dart';
|
||||||
|
@ -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<DrawingDemo> {
|
|
||||||
_LineDrawingNode _rootNode;
|
|
||||||
ImageMap _images;
|
|
||||||
|
|
||||||
Future<Null> _loadAssets(AssetBundle bundle) async {
|
|
||||||
_images = new ImageMap(bundle);
|
|
||||||
await _images.load(<String>[
|
|
||||||
'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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,6 @@ import 'home.dart';
|
|||||||
final Map<String, WidgetBuilder> kRoutes = <String, WidgetBuilder>{
|
final Map<String, WidgetBuilder> kRoutes = <String, WidgetBuilder>{
|
||||||
WeatherDemo.routeName: (BuildContext context) => new WeatherDemo(),
|
WeatherDemo.routeName: (BuildContext context) => new WeatherDemo(),
|
||||||
FitnessDemo.routeName: (BuildContext context) => new FitnessDemo(),
|
FitnessDemo.routeName: (BuildContext context) => new FitnessDemo(),
|
||||||
DrawingDemo.routeName: (BuildContext context) => new DrawingDemo(),
|
|
||||||
Calculator.routeName: (BuildContext context) => new Calculator(),
|
Calculator.routeName: (BuildContext context) => new Calculator(),
|
||||||
FlexibleSpaceDemo.routeName: (BuildContext context) => new FlexibleSpaceDemo(),
|
FlexibleSpaceDemo.routeName: (BuildContext context) => new FlexibleSpaceDemo(),
|
||||||
TabsFabDemo.routeName: (BuildContext context) => new TabsFabDemo(),
|
TabsFabDemo.routeName: (BuildContext context) => new TabsFabDemo(),
|
||||||
|
@ -75,7 +75,6 @@ class GalleryHomeState extends State<GalleryHome> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new GalleryItem(title: 'Weather', routeName: WeatherDemo.routeName),
|
new GalleryItem(title: 'Weather', routeName: WeatherDemo.routeName),
|
||||||
new GalleryItem(title: 'Fitness', routeName: FitnessDemo.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: 'Calculator', routeName: Calculator.routeName),
|
||||||
new GalleryItem(title: 'Flexible space toolbar', routeName: FlexibleSpaceDemo.routeName),
|
new GalleryItem(title: 'Flexible space toolbar', routeName: FlexibleSpaceDemo.routeName),
|
||||||
new GalleryItem(title: 'Floating action button', routeName: TabsFabDemo.routeName),
|
new GalleryItem(title: 'Floating action button', routeName: TabsFabDemo.routeName),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user