mirror of
https://github.com/flutter/samples.git
synced 2026-04-03 18:22:45 +00:00
Update web/ samples to work with Flutter SDK (#134)
* add package:http dependency in dad_jokes * add package:http dependency in filipino_cuisine * don't build package:http demos until flutter/flutter#34858 is resolved * update gallery * update github_dataviz * update particle_background * don't build github_dataviz (uses package:http) * update slide_puzzle * update spinning_square * update timeflow * update vision_challenge * update charts * update dad_jokes * update filipino cuisine * ignore build output * update timeflow and vision_challenge * update slide_puzzle * don't commit build/ directory * move preview.png images to assets * fix path url join * update readme * update web/readme.md
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
// Copyright 2019 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.
|
||||
|
||||
// ignore_for_file: omit_local_variable_types, annotate_overrides
|
||||
|
||||
import 'package:flutter_web_ui/ui.dart' as ui show Image;
|
||||
import 'dart:ui' as ui show Image;
|
||||
|
||||
import '../flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// A model on top of DecorationImage that supports slicing up the source image
|
||||
// efficiently to draw it as tiles in the puzzle game
|
||||
@@ -142,13 +138,13 @@ class DecorationImagePlus implements DecorationImage {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
final List<String> properties = <String>['$image'];
|
||||
final List<String> properties = <String>[];
|
||||
properties.add('$image');
|
||||
if (colorFilter != null) properties.add('$colorFilter');
|
||||
if (fit != null &&
|
||||
!(fit == BoxFit.fill && centerSlice != null) &&
|
||||
!(fit == BoxFit.scaleDown && centerSlice == null)) {
|
||||
!(fit == BoxFit.scaleDown && centerSlice == null))
|
||||
properties.add('$fit');
|
||||
}
|
||||
properties.add('$alignment');
|
||||
if (centerSlice != null) properties.add('centerSlice: $centerSlice');
|
||||
if (repeat != ImageRepeat.noRepeat) properties.add('$repeat');
|
||||
@@ -170,13 +166,16 @@ class DecorationImagePlus implements DecorationImage {
|
||||
/// longer needed.
|
||||
class DecorationImagePainterPlus implements DecorationImagePainter {
|
||||
DecorationImagePainterPlus._(this._details, this._onChanged)
|
||||
: assert(_details != null);
|
||||
: assert(_details != null) {
|
||||
_imageStreamListener = ImageStreamListener(_imageListener);
|
||||
}
|
||||
|
||||
final DecorationImagePlus _details;
|
||||
final VoidCallback _onChanged;
|
||||
|
||||
ImageStream _imageStream;
|
||||
ImageInfo _image;
|
||||
ImageStreamListener _imageStreamListener;
|
||||
|
||||
/// Draw the image onto the given canvas.
|
||||
///
|
||||
@@ -218,15 +217,14 @@ class DecorationImagePainterPlus implements DecorationImagePainter {
|
||||
|
||||
final ImageStream newImageStream = _details.image.resolve(configuration);
|
||||
if (newImageStream.key != _imageStream?.key) {
|
||||
_imageStream?.removeListener(_imageListener);
|
||||
_imageStream = newImageStream..addListener(_imageListener);
|
||||
_imageStream?.removeListener(_imageStreamListener);
|
||||
_imageStream = newImageStream..addListener(_imageStreamListener);
|
||||
}
|
||||
if (_image == null) return;
|
||||
|
||||
if (clipPath != null) {
|
||||
canvas
|
||||
..save()
|
||||
..clipPath(clipPath);
|
||||
canvas.save();
|
||||
canvas.clipPath(clipPath);
|
||||
}
|
||||
|
||||
_paintImage(
|
||||
@@ -259,7 +257,7 @@ class DecorationImagePainterPlus implements DecorationImagePainter {
|
||||
/// After this method has been called, the object is no longer usable.
|
||||
@mustCallSuper
|
||||
void dispose() {
|
||||
_imageStream?.removeListener(_imageListener);
|
||||
_imageStream?.removeListener(_imageStreamListener);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
// Copyright 2019 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 '../flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Copied from
|
||||
// https://github.com/flutter/flutter/blob/f5b02e3c05ed1ab31e890add84fb56e35de2d392/packages/flutter/lib/src/material/material.dart#L593-L715
|
||||
|
||||
Reference in New Issue
Block a user