Home > Net >  How to increase text height flutter
How to increase text height flutter

Time:07-20

I want Text look like this. I tried height property of Text() but couldn't make like this. How can I make text like this?

increasing font is doesnt provide my desire result

 Text(
            widget.subscriptionModel.discountPrice!,
            textAlign: TextAlign.center,
            style: TextStyle(color: Colors.red,fontSize: 20),
          ),

enter image description here

CodePudding user response:

if you want to stretch the text text height without changing its width, you need to use FittedBox,you need to tweak the height and width to get the desired output

SizedBox(
  height: 90,
  width: 80,
  child: FittedBox(
    fit: BoxFit.fill,
    child: Text(
      '149',
    ),
  ),
)

CodePudding user response:

You can use Transform.scale

Transform.scale(
  scaleY: 2,
  alignment: Alignment.centerLeft,
  child: Text(
    "149",
    textAlign: TextAlign.center,
    style: TextStyle(
      color: Colors.red,
      fontSize: 20,
    ),
  ),
),
  • Related