Flutter ColorFiltered 将ColorFilter应用于其子级。

Example

Flutter ColorFiltered 将ColorFilter应用于其子级。

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ColorFiltered(
          colorFilter: ColorFilter.mode(Colors.pink[300], BlendMode.modulate),
          child: Image.network(
              "https://i.loli.net/2019/11/30/nBZehFardWu5pAV.jpg"),
        ),
      ),
    );
  }
}

相关推荐