Created
May 13, 2019 04:46
-
-
Save nvquangth/84d95d1cf03e60a2f6b954c271d8ea1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text("Test"), | |
), | |
body: MyHomePage(), | |
), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return _buildText(); | |
} | |
} | |
Widget _buildText() { | |
String s = | |
"The Text widget displays a string of text with single style. " | |
"The string might break across multiple lines or might all " | |
"be displayed on the same line depending on the layout constraints."; | |
return Text( | |
s, | |
textAlign: TextAlign.left, | |
overflow: TextOverflow.clip, | |
maxLines: 10, | |
textScaleFactor: 1.5, | |
style: _buildStyle(), | |
); | |
} | |
TextStyle _buildStyle() { | |
return TextStyle( | |
color: Colors.red, | |
backgroundColor: Color.fromRGBO(255, 20, 20, 0.5), | |
fontSize: 15, | |
fontWeight: FontWeight.bold, | |
wordSpacing: 3, | |
letterSpacing: 10, | |
fontFamily: "DancingScript" | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment