import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
title: "透明度",
home: Scaffold(
appBar: AppBar(
title: Text('透明度'),
),
body: Center(
child: Opacity(
//设置透明度
opacity: 0.3,
child: Container(
width: 100,
height: 200,
color: Colors.redAccent,
),
)),
),
);
}
}
网友评论