Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter for web: text cut off at bottom

With web flutter my text is cut at the bottom when I display text I tried to put padding but it doesn't work.

this problem this product everywhere even on the TextField

enter image description here

    new Container(
      width: menuRightWidthDesktop,
      height: getSize == 0 ? heightHeaderDesktop : getSize == 1 ? heightHeaderTablette : heightHeaderMobile,
      color: Colors.red,
      child: new Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          new GestureDetector(
            child: new Container(
              color: Colors.indigoAccent,
              child: new Text("Surfeur >"),
            ),
            onTap: () {},
          ),
          new GestureDetector(
            child: new Text("Photographe >", ),
            onTap: () {},
          ),
        ],
      ),
    ),
like image 904
dafep Avatar asked Dec 23 '22 19:12

dafep


2 Answers

I've been having the same issue and solved it by increasing the height property of the text by a small value

Text("Surfeur >",
  style: TextStyle(
    height: 1.1,
  ),
),
like image 157
madebyAyan Avatar answered Dec 28 '22 10:12

madebyAyan


There is a new pull request https://github.com/flutter/engine/pull/13929
experimental implementation of text measurement that's based on Canvas2d

You can use the following command

flutter run -d web-server --release --dart-define=FLUTTER_WEB_USE_EXPERIMENTAL_CANVAS_TEXT=true
like image 33
chunhunghan Avatar answered Dec 28 '22 08:12

chunhunghan