user18710300
user18710300

Reputation:

How to increase text height flutter

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

Upvotes: 1

Views: 935

Answers (2)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63769

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,
    ),
  ),
),

Upvotes: 2

Hosam Hasan
Hosam Hasan

Reputation: 692

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',
    ),
  ),
)

Upvotes: 3

Related Questions