我是flutter-dart的新手,我一直在尝试将图像加载到我的draw header中,但到目前为止没有成功。任何人都可以对此有所了解吗?请在下面找到我的代码。
class MainDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
decoration: BoxDecoration(
//color: Theme.of(context).backgroundColor,
image: DecorationImage(
image: AssetImage('assets/images/title_fb_600.png'),
fit: BoxFit.cover,
)),
child: Text("Some Text"),
//ListTile(
// leading: Icon(Icons.monetization_on),
// title: Text(
// "TRIPLE A",
// style: TextStyle(color: Colors.white, fontSize: 20),
// ),
),
ItemDrawer("Carteira Recomendada", Icons.star, 16),
ItemDrawer("Carteira R\$10", Icons.ten_k, 16),
ItemDrawer("Minha Carteira", Icons.favorite, 16),
ItemDrawer("Notícias", Icons.new_releases, 16),
ItemDrawer("Minha Conta", Icons.account_circle, 16),
ItemDrawer("Configurações", Icons.settings, 16),
],
),
);
}
}
我的 pubspec.yaml....
> flutter:
>
uses-material-design: true
>
assets:
> - assets/images/title3a_fb_600.png
和文件夹结构...