I'm new in Flutter+Dart and trying to increase font size but hard to understand documentation + implement to my work. Here is the file. How can I solve my problem?
import 'package:flutter/material.dart';
void main() => runApp(NewApp());
class NewApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: new Text('App Header'),
),
body: new Column(
children: [
new Container(
margin: new EdgeInsets.all(10.0),
child: new Card(
child: new Column(
children: <Widget>[
new Container(
padding: new EdgeInsets.all(10.0),
child: new Text('Hello Macaw'),
),
],
),
),
)
],
),
),
);
}
}
, style: TextStyle(fontSize: 25), ), Change the value for fontSize to change the font size of text in Text Widget.
At the beginning this is hard to understand and implement. But once you understand, you will fall in love with the Flutter framework. Here is the solution:
new Text('Hello Macaw',style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),),
After that, format the code. That's it. Let me know if it works.
You can use style
property of Text
to change some of the property of the Text
.
Example:
Text(
"Your text",
style: TextStyle(
fontSize: 20.0,
color: Colors.red,
fontWeight: FontWeight.w600,
),
)
It's a good practice to use predefined style
for Text
which gives you standard fontSize
and fontWeight
for the Text
.
You can use them like this
style: Theme.of(context).textTheme.XYZ
XYZ
can be body1
, body2
, title
, subhead
, headline
etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With