我下面有以下代码,我希望它仅对一张图像有背景,但我不能:
drawer: new Drawer(
child: new ListView(
children: <Widget>[
//header
InkWell(
//click özelliği burada back-end sonra yapılacak
onTap:(){},
child: ListTile(
title: Text("Little Sister's Farm"),
leading: Icon(Icons.wb_sunny,color: Colors.orangeAccent),
subtitle: Text('Deneme@gmail.com'),
),
),
// yan tarafta açılan sidebar menü
new UserAccountsDrawerHeader(
accountName: Text('Kullanıcı Adı'),
accountEmail: Text('deneme@gmail.com'),
decoration:
new BoxDecoration(
color: Colors.green,
image: DecorationImage(
image: AssetImage("images/wood.jpg"),
fit: BoxFit.cover)
),
),
// body
InkWell(
//click özelliği burada back-end sonra yapılacak
onTap:(){},
child: ListTile(
title: Text('Kayıt/Giriş'),
leading: Icon(Icons.person_add,color: Colors.blueGrey),
),
),
InkWell(
//click özelliği burada back-end sonra yapılacak
onTap:(){},
child: ListTile(
title: Text('Anasayfa'),
leading: Icon(Icons.home,color: Colors.green),
),
),
InkWell(
onTap:(){},
child: ListTile(
title: Text('Hesabım'),
leading: Icon(Icons.account_box,color: Colors.deepPurple),
),
),
InkWell(
onTap:(){},
child: ListTile(
title: Text('Siparişlerim'),
leading: Icon(Icons.fastfood,color: Colors.tealAccent),
),
),
InkWell(
onTap:(){},
child: ListTile(
title: Text('Kategoriler'),
leading: Icon(Icons.dashboard,color: Colors.orange),
),
),
InkWell(
onTap:(){},
child: ListTile(
title: Text('Favoriler'),
leading: Icon(Icons.favorite,color: Colors.red),
),
),
Divider(),
InkWell(
onTap:(){},
child: ListTile(
title: Text('Ayarlar'),
leading: Icon(Icons.settings,color: Colors.lightBlueAccent),
),
),
InkWell(
onTap:(){},
child: ListTile(
title: Text('Yardım'),
leading: Icon(Icons.help_outline,color: Colors.yellow),
),
),
InkWell(
//click özelliği burada back-end sonra yapılacak
onTap:(){},
child: ListTile(
title: Text('Lokasyon'),
leading: Icon(Icons.location_city,color: Colors.black),
),
),
],
),
),
答案 0 :(得分:1)
使用Stack()小部件并将背景图像和抽屉项目放入其中。
Drawer(
child: Stack(
children: <Widget>[
Image.asset("your image adress"),
ListView(
children: <Widget>[
// your Drawer Items
],
)
],
),
);