Created
April 21, 2020 00:39
-
-
Save PoojaB26/d548285fd710d4c94cb1ff59835b85bd to your computer and use it in GitHub Desktop.
Text: Example 1
This file contains 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( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: AppBar(title: Text("Text Widget: Example 1")), | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
final Widget text1 = Text( | |
"Flutter is absolutely awesome!", | |
textAlign: TextAlign.right, | |
textDirection: TextDirection.ltr, | |
overflow: TextOverflow.ellipsis, | |
maxLines: 1, | |
style: TextStyle( | |
color: Colors.red, | |
fontSize: 22.0, | |
fontWeight: FontWeight.w200, | |
letterSpacing: 2.0, | |
wordSpacing: 40.0, | |
decoration: TextDecoration.overline, | |
decorationStyle: TextDecorationStyle.dotted), | |
); | |
final Widget text2 = Text( | |
"Flutter is absolutely awesome!", | |
textAlign: TextAlign.right, | |
textDirection: TextDirection.ltr, | |
overflow: TextOverflow.ellipsis, | |
maxLines: 1, | |
style: TextStyle( | |
color: Colors.orange, | |
fontSize: 20.0, | |
fontWeight: FontWeight.w500, | |
letterSpacing: 2.0, | |
wordSpacing: 30.0, | |
decoration: TextDecoration.overline, | |
decorationStyle: TextDecorationStyle.wavy), | |
); | |
final Widget text3 = Text( | |
"Flutter is absolutely awesome!", | |
textAlign: TextAlign.right, | |
textDirection: TextDirection.ltr, | |
overflow: TextOverflow.ellipsis, | |
maxLines: 1, | |
style: TextStyle( | |
color: Colors.yellow, | |
fontSize: 20.0, | |
fontWeight: FontWeight.w800, | |
letterSpacing: 2.0, | |
wordSpacing: 20.0, | |
decoration: TextDecoration.overline, | |
decorationStyle: TextDecorationStyle.solid), | |
); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
padding: EdgeInsets.all(20), | |
child: Column( | |
// mainAxisAlignment: MainAxisAlignment.spaceAround, | |
children: <Widget>[ | |
text1, | |
text2, | |
text3, | |
]), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment