【问题标题】:how to make text or richtext scrollable in flutter?如何使文本或富文本在颤动中可滚动?
【发布时间】:2018-04-02 19:57:26
【问题描述】:

似乎text/richtext只支持一页,如果内容超出屏幕,则无法上下滚动。有没有简单的方法来启用它? 或者我必须使用滚动小部件?

【问题讨论】:

    标签: flutter


    【解决方案1】:

    Flutter 提供了很多 Scrolling Widgets documentation

    示例:SingleChildScrollView

    class mytext extends StatelessWidget {
    var randomtext="....";
    @override
    Widget build(BuildContext context) {
    return new Container(child: new Scaffold(
      appBar: new AppBar(),
      body: new SingleChildScrollView(child: 
        new Text(randomtext,style: new TextStyle(fontSize: 30.0),),),
    ),);
     }
    }
    

    【讨论】:

    • 太好了,谢谢!
    猜你喜欢
    • 1970-01-01
    • 2019-11-30
    • 1970-01-01
    • 1970-01-01
    • 2022-01-16
    • 1970-01-01
    • 2020-09-29
    • 2011-05-21
    • 2018-02-23
    相关资源
    最近更新 更多