Skip to content

Text widget to change its colour and fontSize without using TextStyle #61690

Closed
@happyharis

Description

@happyharis

Use case

I believe new developers has benefitted from the readability of the 'out of the box' colour parameter in container. Therefore, I am proposing the same with the commonly used Text widget.

Colour changes in Container widget has been introduced as follows:

Container(color: Colors.red)

// Instead of
Container(decoration: BoxDecoration(color: Colors.red));

Is the reason for container out of the box colour parameter better readability and ease of understanding for new Flutter developers? Otherwise, what's the reason?

However, text widget has no colour parameter out of the box. To change a colour, you have to type an additional object.

Text('example', style: TextStyle(color: Colors.red));

Proposal

Have the text widget to have a colour and fontSize parameters without using TextStyle. These two parameters I believe is the most used parameters in the Text widget.

// Before
Text('example', style: TextStyle(color: Colors.red, fontSize: 30));

// After
Text('example', color: Colors.red, fontSize: 30);

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: typographyText rendering, possibly libtxtc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.r: solvedIssue is closed as solvedteam-designOwned by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions