Macaw
Macaw

Reputation: 405

How do I increase font size in Dart

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'),
                    ),
                  ],
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}

Upvotes: 13

Views: 21064

Answers (2)

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.

Upvotes: 20

CopsOnRoad
CopsOnRoad

Reputation: 267464

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.

Upvotes: 7

Related Questions