Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.