mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #1678 from abarth/show_color_filter
Show ColorFilter
This commit is contained in:
commit
586d89ba2b
@ -226,7 +226,7 @@ class StockHomeState extends State<StockHome> {
|
||||
return new ToolBar(
|
||||
left: new IconButton(
|
||||
icon: "navigation/arrow_back",
|
||||
colorFilter: new ui.ColorFilter.mode(Theme.of(context).accentColor, ui.TransferMode.srcATop),
|
||||
colorFilter: new ColorFilter.mode(Theme.of(context).accentColor, ui.TransferMode.srcATop),
|
||||
onPressed: _handleSearchEnd
|
||||
),
|
||||
center: new Input(
|
||||
|
||||
@ -47,10 +47,10 @@ class _DrawerItemState extends State<DrawerItem> {
|
||||
return Colors.transparent;
|
||||
}
|
||||
|
||||
ui.ColorFilter _getColorFilter(ThemeData themeData) {
|
||||
ColorFilter _getColorFilter(ThemeData themeData) {
|
||||
if (config.selected)
|
||||
return new ui.ColorFilter.mode(themeData.primaryColor, TransferMode.srcATop);
|
||||
return new ui.ColorFilter.mode(const Color(0x73000000), TransferMode.dstIn);
|
||||
return new ColorFilter.mode(themeData.primaryColor, TransferMode.srcATop);
|
||||
return new ColorFilter.mode(const Color(0x73000000), TransferMode.dstIn);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@ -35,7 +35,7 @@ class Icon extends StatelessComponent {
|
||||
final int size;
|
||||
final String type;
|
||||
final IconThemeColor color;
|
||||
final ui.ColorFilter colorFilter;
|
||||
final ColorFilter colorFilter;
|
||||
|
||||
String _getColorSuffix(BuildContext context) {
|
||||
IconThemeColor iconThemeColor = color;
|
||||
|
||||
@ -20,7 +20,7 @@ class IconButton extends StatelessComponent {
|
||||
|
||||
final String icon;
|
||||
final IconThemeColor color;
|
||||
final ui.ColorFilter colorFilter;
|
||||
final ColorFilter colorFilter;
|
||||
final GestureTapCallback onPressed;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@ -321,7 +321,7 @@ class Tab extends StatelessComponent {
|
||||
Widget _buildLabelIcon() {
|
||||
assert(label.icon != null);
|
||||
Color iconColor = selected ? selectedColor : color;
|
||||
ui.ColorFilter filter = new ui.ColorFilter.mode(iconColor, TransferMode.srcATop);
|
||||
ColorFilter filter = new ColorFilter.mode(iconColor, TransferMode.srcATop);
|
||||
return new Icon(type: label.icon, size: _kTabIconSize, colorFilter: filter);
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
export 'dart:ui' show
|
||||
Canvas,
|
||||
Color,
|
||||
ColorFilter,
|
||||
FontStyle,
|
||||
FontWeight,
|
||||
Offset,
|
||||
|
||||
@ -561,10 +561,10 @@ enum ImageRepeat {
|
||||
|
||||
/// Paint an image into the given rectangle in the canvas
|
||||
void paintImage({
|
||||
ui.Canvas canvas,
|
||||
Canvas canvas,
|
||||
Rect rect,
|
||||
ui.Image image,
|
||||
ui.ColorFilter colorFilter,
|
||||
ColorFilter colorFilter,
|
||||
ImageFit fit,
|
||||
repeat: ImageRepeat.noRepeat,
|
||||
Rect centerSlice,
|
||||
@ -668,7 +668,7 @@ class BackgroundImage {
|
||||
final Rect centerSlice;
|
||||
|
||||
/// A color filter to apply to the background image before painting it.
|
||||
final ui.ColorFilter colorFilter;
|
||||
final ColorFilter colorFilter;
|
||||
|
||||
/// The image to be painted into the background.
|
||||
ui.Image get image => _image;
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
export 'dart:ui' show
|
||||
Canvas,
|
||||
Color,
|
||||
ColorFilter,
|
||||
Offset,
|
||||
Paint,
|
||||
Path,
|
||||
|
||||
@ -22,7 +22,7 @@ class RenderImage extends RenderBox {
|
||||
ui.Image image,
|
||||
double width,
|
||||
double height,
|
||||
ui.ColorFilter colorFilter,
|
||||
ColorFilter colorFilter,
|
||||
ImageFit fit,
|
||||
repeat: ImageRepeat.noRepeat,
|
||||
Rect centerSlice
|
||||
@ -67,9 +67,9 @@ class RenderImage extends RenderBox {
|
||||
}
|
||||
|
||||
/// If non-null, apply this color filter to the image before painint.
|
||||
ui.ColorFilter get colorFilter => _colorFilter;
|
||||
ui.ColorFilter _colorFilter;
|
||||
void set colorFilter (ui.ColorFilter value) {
|
||||
ColorFilter get colorFilter => _colorFilter;
|
||||
ColorFilter _colorFilter;
|
||||
void set colorFilter (ColorFilter value) {
|
||||
if (value == _colorFilter)
|
||||
return;
|
||||
_colorFilter = value;
|
||||
|
||||
@ -20,6 +20,7 @@ export 'package:flutter/rendering.dart' show
|
||||
BoxShadow,
|
||||
Canvas,
|
||||
Color,
|
||||
ColorFilter,
|
||||
EdgeDims,
|
||||
FlexAlignItems,
|
||||
FlexDirection,
|
||||
@ -894,7 +895,7 @@ class Image extends LeafRenderObjectWidget {
|
||||
final ui.Image image;
|
||||
final double width;
|
||||
final double height;
|
||||
final ui.ColorFilter colorFilter;
|
||||
final ColorFilter colorFilter;
|
||||
final ImageFit fit;
|
||||
final ImageRepeat repeat;
|
||||
final Rect centerSlice;
|
||||
@ -936,7 +937,7 @@ class ImageListener extends StatefulComponent {
|
||||
final ImageResource image;
|
||||
final double width;
|
||||
final double height;
|
||||
final ui.ColorFilter colorFilter;
|
||||
final ColorFilter colorFilter;
|
||||
final ImageFit fit;
|
||||
final ImageRepeat repeat;
|
||||
final Rect centerSlice;
|
||||
@ -998,7 +999,7 @@ class NetworkImage extends StatelessComponent {
|
||||
final String src;
|
||||
final double width;
|
||||
final double height;
|
||||
final ui.ColorFilter colorFilter;
|
||||
final ColorFilter colorFilter;
|
||||
final ImageFit fit;
|
||||
final ImageRepeat repeat;
|
||||
final Rect centerSlice;
|
||||
@ -1033,7 +1034,7 @@ class AssetImage extends StatelessComponent {
|
||||
final AssetBundle bundle;
|
||||
final double width;
|
||||
final double height;
|
||||
final ui.ColorFilter colorFilter;
|
||||
final ColorFilter colorFilter;
|
||||
final ImageFit fit;
|
||||
final ImageRepeat repeat;
|
||||
final Rect centerSlice;
|
||||
|
||||
@ -113,7 +113,7 @@ abstract class SpritePaint {
|
||||
paint.color = new Color.fromARGB((255.0*_opacity).toInt(), 255, 255, 255);
|
||||
|
||||
if (colorOverlay != null) {
|
||||
paint.colorFilter = new ui.ColorFilter.mode(colorOverlay, ui.TransferMode.srcATop);
|
||||
paint.colorFilter = new ColorFilter.mode(colorOverlay, ui.TransferMode.srcATop);
|
||||
}
|
||||
|
||||
if (transferMode != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user