【自学Flutter】3.3 图片的混合模式和重复

3.3 图片的混合模式和重复

1.源代码

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context ){
    return MaterialApp(
      title:'All Widget Usages',
      home:Scaffold(
          body:
          Center(
              child:
              Container(
                margin: EdgeInsets.all(10.0),
                width: 220.0,
                height: 220.0,
                color: Colors.blue,
                child: Image.network("https://img.ivsky.com/img/tupian/t/201411/27/weixiao_de_ningmeng_3d_sheji.jpg",
                  fit: BoxFit.none,
                  color: Colors.red,
                  colorBlendMode: BlendMode.color,
                  repeat: ImageRepeat.repeat,
                ),
              ),
          )
      ),
    );
  }
}

2.解释源代码

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context ){
    return MaterialApp(
      title:'All Widget Usages',
      home:Scaffold(
          body:
          Center(
              child:
              Container(
                margin: EdgeInsets.all(10.0),
                width: 220.0,
                height: 220.0,
                color: Colors.blue,
                child: Image.network("https://img.ivsky.com/img/tupian/t/201411/27/weixiao_de_ningmeng_3d_sheji.jpg",
                  fit: BoxFit.none,
                  color: Colors.red,
                  //图片的混合模式
                  colorBlendMode: BlendMode.color,
                  //图片的重复
                  repeat: ImageRepeat.repeat,
                ),
              ),
          )
      ),
    );
  }
}

3.效果图

效果图

猜你喜欢

转载自blog.csdn.net/weixin_43266090/article/details/93496373