Вы можете использовать GridView
, установить crossAxisCount
равным 2 и поместить Column
внутри Card
.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: GridView.builder(
itemCount: 6,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
childAspectRatio: 8.0 / 10.0,
crossAxisCount: 2,
),
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(5),
child: Card(
semanticContainer: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
clipBehavior: Clip.antiAlias,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/no_image.png'),
fit: BoxFit.fill),
),
)),
Padding(
padding: EdgeInsets.all(10.0),
child: Text(
"Name",
style: TextStyle(fontSize: 18.0),
)),
],
)));
},
));
}
}