Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 16, 2020 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/7efa088e0893fb12ade12aac59bec379 to your computer and use it in GitHub Desktop.
Save ryanlid/7efa088e0893fb12ade12aac59bec379 to your computer and use it in GitHub Desktop.
ListView 实现长文本滚动
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: "ListView 实现长文本滚动示例",
home: MyApp(),
));
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("ListView 实现长文本滚动示例"),
),
body: ListView(
children: <Widget>[
Center(
child: Text(
"天河区",
style: TextStyle(fontSize: 30.0),
),
),
Center(
child: Text(
"天河区公园",
style: TextStyle(fontSize: 12.0),
),
),
Center(
child: Text(
'''
天河公园,是区属综合性公园,位于广州天河区员村,
西靠天府路,南连黄埔大道,北接中山大道,来往交通十分便利。
公园总面积为70.7公顷,水体面积占10公顷。天河公园以自然生态景观为主要特色,
公园规划为五个功能区:百花园景区、文体娱乐区、
老人活动区、森林休憩区、后勤管理区。
''',
style: TextStyle(fontSize: 14.0),
),
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment