card-组件布局

  card-组件布局

 

 

import 'package:flutter/material.dart'; import 'res/listData.dart';
void main() {   runApp(MyApp()); }
class MyApp extends StatelessWidget {   @override   Widget build(BuildContext context) {     return MaterialApp(         home: Scaffold(       appBar: AppBar(title: Text("flutterDemo")),       body: HomeContent(),     ));   } }
class HomeContent extends StatelessWidget {   @override   Widget build(BuildContext context) {     return ListView(         children: listData.map((value) {       return Card(         margin: EdgeInsets.all(10),         child: Column(           children: [             AspectRatio(               aspectRatio: 20 / 9,               child: Image.network(value['imageUrl'], fit: BoxFit.cover),             ),             SizedBox(height: 10),             ListTile(                 leading: CircleAvatar(                     backgroundImage: NetworkImage(value['imageUrl'])),                 title: Text(value['title']),                 subtitle: Text(                   value['description'],                   overflow: TextOverflow.ellipsis,                   maxLines: 2,                 )),           ],         ),       );     }).toList());   } }
上一篇:Python元组拆包捡到8倍镜快准狠


下一篇:Django——静态文件配置