Flutter 全屏背景图(包括 Appbar 和 状态栏)


class _HomePageState extends State<HomePage>{
@override
Widget build(BuildContext context) {
// 获取屏幕宽高
final size = MediaQuery.of(context).size;
final width = size.width;
final height = size.height;

return Container(
width: width,
height: height,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage('https://m.airchina.com.cn:9062/fu/yx/20200804/5bcecdbba76d41f19d5913aa7684469a.jpg'),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.transparent,
),
body: Container(
width: width,
child: Text('hello'),
),
),
);
}
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM