Flutter——CircleAvatar组件(圆形头像组件)

 

 

import 'package:flutter/material.dart';
import 'res/listData.dart';

void main() {
  runApp(MaterialApp(
    title: "demo",
    home: MyApp(),
  ));
}


class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("FlutterDemo"),),
      body: ListView(
        children: listData.map((value) {
          return Card(
            margin: EdgeInsets.all(10),
            child: Column(
              children: <Widget>[
                AspectRatio(
                  aspectRatio: 20/9,
                  child: Image.network(value["imageUrl"],fit: BoxFit.cover,),
                ),
                ListTile(
                  leading: CircleAvatar(
                    backgroundImage: NetworkImage(value["imageUrl"]),
                  ),
                  title: Text(value["title"]),
                  subtitle: Text(value["description"],maxLines: 1,overflow: TextOverflow.ellipsis),
                )
              ],
            ),
          );
        }).toList()
      )
    );
  }
}

 

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2021-08-28
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2021-05-31
猜你喜欢
  • 2022-12-23
  • 2021-05-02
  • 2022-01-07
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2021-11-22
相关资源
相似解决方案