Widget build(BuildContext context) {
return Center(
child: Column(
children: <Widget>[
Expanded(
child: Image.asset('images/ball$go.png'),
),
FloatingActionButton(
onPressed: () {
setState(() {
go = Random().nextInt(5) + 1;
});
},
child: Text('Ask'),
backgroundColor: Colors.blue.shade300,
foregroundColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(16.0),
),
),
elevation: 20.0,
),
],
),
);
}
}
使用对齐小部件包装