1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
| import 'package:flutter/material.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: HYHomePage(), ); } }
class HYHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("富文本"), ), body: HYContentBody(), ); } }
class HYContentBody extends StatelessWidget { @override Widget build(BuildContext context) { return ListView.separated( itemBuilder: (BuildContext ctx, int index){ return ListTile( title: Text("联系人$index",style: TextStyle(backgroundColor: Colors.blue),), ); }, separatorBuilder: (BuildContext ctx, int index){ return Divider( color: Colors.red, indent: 60, //前边的距离 endIndent: 100, //后边的距离 height: 5, //分割线所占的高度 thickness: 10, //分割线的厚度,即高度 ); }, itemCount: 100); } }
class HYContentBody3 extends StatelessWidget { @override Widget build(BuildContext context) { return ListView.builder( itemExtent: 80, //项的高度,或者宽度 // scrollDirection: Axis.horizontal, // reverse: true, //列表数据反转 itemCount: 100, itemBuilder: (BuildContext ctx, int index) { return ListTile( leading: Icon(Icons.people), trailing: Icon(Icons.delete), title: Text("联系人 $index"), subtitle: Text("电话号码 18811112222"), ); } ); } }
class HYContentBody2 extends StatelessWidget { @override Widget build(BuildContext context) { return ListView( children: List.generate(100, (index){ return Text("Hello world $index",style: TextStyle(fontSize: 30),); }), ); } }
class HYContentBody1 extends StatelessWidget { @override Widget build(BuildContext context) { return ListView( children: <Widget>[ Text("hello world 1"), Text("hello world 2"), Text("hello world 3"), ], ); } }
|