0
I’m developing an APP on flutter using a Staggeredgridview at the beginning of the build, but I’m not able to insert an image before this grid.
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
class TesteMenu extends StatefulWidget {
@override
_TesteMenuState createState() => _TesteMenuState();
}
class _TesteMenuState extends State<TesteMenu> {
Material meuCard(IconData icon, String titulo, int cor) {
return Material(
color: Colors.white,
elevation: 15.0,
shadowColor: Color(0X802196F3),
borderRadius: BorderRadius.circular(24.0),
child: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
titulo,
style: TextStyle(
color: new Color(cor),
fontSize: 20.0,
),
),
],
)
],
),
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
backgroundColor: Colors.white,
//Inserir aqui a imagem...
usando o Image.asset(ola.jpeg)
body: StaggeredGridView.count(
crossAxisCount: 2,
crossAxisSpacing: 12.0,
mainAxisSpacing: 12.0,
padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
children: <Widget>[
meuCard(Icons.home, "HOME", 0XFFED622B),
meuCard(Icons.home, "HOME", 0XFFED622B),
meuCard(Icons.home, "HOME", 0XFFED622B),
meuCard(Icons.home, "HOME", 0XFFED622B),
],
staggeredTiles: [
StaggeredTile.extent(1, 150.0),
StaggeredTile.extent(1, 150.0),
StaggeredTile.extent(1, 150.0),
StaggeredTile.extent(1, 150.0),
],
),
);
}
}