防采集标记:亢少军老师的课程和资料

import 'package:flutter/material.dart';
class LayoutDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('BoxDecoration装饰盒子-背景图示例'),
      ),
      body: new Center(
        child: Container(
          width: 300.0,
          height: 300.0,
          decoration: BoxDecoration(
            color: Colors.grey,
            image: DecorationImage(
              image: ExactAssetImage('images/1.jpeg'),//添加image属性
              fit: BoxFit.cover,//填充类型
            ),
          ),
        )
      ),
    );
  }
}
void main() {
  runApp(
    new MaterialApp(
      title: 'BoxDecoration装饰盒子-背景图示例',
      home: new LayoutDemo(),
    ),
  );
}

@作者: 亢少军

第11章组件装饰和视觉效果-DecoratedBox装饰盒子-背景图效果

相关文章:

  • 2021-04-20
  • 2021-08-02
  • 2021-07-15
  • 2021-10-22
  • 2021-11-24
  • 2021-12-12
  • 2021-06-23
  • 2021-08-19
猜你喜欢
  • 2021-05-02
  • 2022-01-17
  • 2021-07-23
  • 2021-07-25
  • 2021-06-08
  • 2021-09-21
  • 2021-08-01
相关资源
相似解决方案