我最近开始学习flutter,我想添加背景图片,我想在上面添加两个平面按钮,但是我做不到,我在代码中添加了背景图片,但它不起作用我没有了解问题。谁能帮帮我?
void main() {
return runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
title: Text('Ani & genny',
style: TextStyle(
fontFamily: 'Pacifico',
color: Colors.white,
)),
backgroundColor: Colors.red,
),
body: MyApp(),
),
),
);
}
class MyApp extends StatelessWidget {
void navigateToPage() {
print('Button pressed!!!!');
}
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: <Widget>[
SizedBox(
height: 50,
),
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("images/Ani.png"),
fit: BoxFit.cover
),
),
),
FlatButton(
child: Image.asset(
'images/li.png',
height: 120,
width: 120,
),
onPressed: () {
navigateToPage();
}),
),
],
),
);
}
}