如何在flutter中实现图像背景



我想要一个background Image,但不知道如何实现它,我写下了我的代码的第一部分,我认为这是解决我的问题所需要的。

我需要Dart(Flutter(的解决方案。我尝试了DecoratedBox,但没有成功,希望有人能帮助我。

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
// appBar: AppBar(title: Text('App',style: TextStyle(fontWeight: FontWeight.w900),),backgroundColor: Colors.brown[500],),
body: Center(
child: Padding(

试试这个:

@override
Widget build(BuildContext context){
return Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(''),
fit: BoxFit.cover,
),
),
child: Container(),
),
);
}

最新更新