0
appBar: PreferredSize(
preferredSize: Size.fromHeight(330.0),
child: AppBar (
  backgroundColor: Color(0xFF1D153B),
  title: RichText(
    text: TextSpan (
      style: DefaultTextStyle.of(context).style,
      children: <TextSpan> [
        TextSpan (text :'Makan Bang'),
        TextSpan (text :'Makan Bang'),
        TextSpan (text :'Makan Bang'),
      ],
    ),
  ),
),

The terminal says that "no named parameter with the name 'children'." Is there any other ways for me to add a new line of text beside using the RichText widget?

1
  • maybe you missed a bracket Commented Dec 14, 2019 at 14:50

1 Answer 1

1

you can have two/three lines max before clipping title widget's bounds :

child: AppBar(
          backgroundColor: Color(0xFF1D153B),
          title: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text('first line'),
                Text('second line'),
              ],
            ),
        ),

or you can use flexible space property of AppBar (background space) to add widgets :

        child: AppBar(
          backgroundColor: Color(0xFF1D153B),
          flexibleSpace: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text('example text'),
              Text('example text'),
              Text('example text'),
              Text('example text'),
              Text('example text'),
              Text('example text'),
              Text('example text'),
              Text('example text'),
            ],
          ),
        ),
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.