Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Row() 'crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null': is not true. Failed assertion:

Tags:

flutter

dart

in flutter i am getting error while using crossAxisAlignment: CrossAxisAlignment.baseline

Error::

Failed assertion: line 3791 pos 15: 'crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null': is not true.

code::

 Row(
    crossAxisAlignment: CrossAxisAlignment.baseline,

    children: <Widget>[
        Text(
            '192',
            style: kBoldNumberText,
        ),
        Text(
        'cm',
        style: kLabelText,
        )
    ],
    )
like image 298
D V Yogesh Avatar asked May 01 '20 11:05

D V Yogesh


People also ask

What is crossAxisAlignment flutter?

The crossAxisAlignment property determines how Row and Column can position their children on their cross axes. A Row 's cross axis is vertical, and a Column 's cross axis is horizontal. The crossAxisAlignment property has five possible values: CrossAxisAlignment.

What is Textbaseline flutter?

The horizontal line used to align the bottom of glyphs for alphabetic characters.


1 Answers

While using crossAxisAlignment in flutter we need to tell what element to align, for that we can use textBaseline: TextBaseline.alphabetic in alphabetic or if it is graphical

//alphabetic:::

textBaseline: TextBaseline.alphabetic,

-or-

//graphic:::

textBaseline: TextBaseline.ideographic

in my case its alphabetic::: so i re-write

Row(
    crossAxisAlignment: CrossAxisAlignment.baseline,
    textBaseline: TextBaseline.alphabetic, ////<-- HERE --> ////
    children: <Widget>[
        Text(
            '192',
            style: kBoldNumberText,
        ),
        Text(
        'cm',
        style: kLabelText,
        )
    ],
    )
like image 191
D V Yogesh Avatar answered Nov 11 '22 00:11

D V Yogesh