gpt4 book ai didi

dart - Flutter如何使用ListTile Threeline

转载 作者:IT王子 更新时间:2023-10-29 06:48:58 24 4
gpt4 key购买 nike

Flutter当我用ListTile ThreeLines的时候,不知道ThreeLine怎么用

    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: Scaffold(
appBar: AppBar(
title: Text('ddd'),
),
body:Container(
child: Column(
children: <Widget>[
ListTile(
isThreeLine: true,
leading: Icon(Icons.event_note),
title: Text('Title 1'),
// subtitle: Text('Title2'),
subtitle: Column(

children: <Widget>[
Text('Titile2'),
Text('Title 3'),
Text('Title 4'),
Text('and so on')
],
),

)
],
),
) ,
),

);
}
}

当我删除 isThreeLines 时,代码正常

ListTile

谢谢

最佳答案

As from the docs:

The value of subtitle, which is optional, will occupy the space allocated for an additional line of text, or two lines if isThreeLine is true.

这基本上意味着 ListTilesubtitle 被赋予了更多空间以包含长度超过一行的文本:

ThreeLine Demo

关于dart - Flutter如何使用ListTile Threeline,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53539523/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com