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

import 'package:flutter/material.dart';

class LayoutDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Opacity不透明度示例'),
      ),
      body: new Center(
        child: new Opacity(
          opacity: 0.3, //不透明度设置为0.3
          child: new Container(
            width: 250.0,
            height: 100.0,
            decoration: new BoxDecoration(
              color: Colors.black, //背景色设置为纯黑
            ),
            child: Text(
              '不透明度为0.3',
              style: TextStyle(
                color: Colors.white,
                fontSize: 28.0,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

void main() {
  runApp(
    new MaterialApp(
      title: 'Opacity不透明度示例',
      home: new LayoutDemo(),
    ),
  );
}

@作者: 亢少军

第11章组件装饰和视觉效果-Opacity不透明度处理

相关文章:

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