I retrieve a piece of text from an API. I want to allot a set amount of space to it (say a max Container with width: 300.0 and height: 100.0). Sometimes, the piece of text fits
You can use FittedBox to manage text based on height or width.
For Ex.
Simply just wrap your Text
widget to FittedBox
widget like, Here I want to resize my AppBar text based on width.
AppBar(
centerTitle: true,
title: FittedBox(
fit: BoxFit.fitWidth,
child: Text('Hey this is my long text appbar title')
),
),
Text will be resized based on width of AppBar.