Skip to content

Instantly share code, notes, and snippets.

@nvquangth
Created May 13, 2019 04:46
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 nvquangth/84d95d1cf03e60a2f6b954c271d8ea1e to your computer and use it in GitHub Desktop.
Save nvquangth/84d95d1cf03e60a2f6b954c271d8ea1e to your computer and use it in GitHub Desktop.
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