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