flutter - 如何在flutter中设置App Bar底部的标题和副标题

标签 flutter flutter-layout flutter-appbar

我正在设计一个登录页面,我想在应用栏底部显示我的标题和副标题,但没有找到正确的方法

我使用了这段代码:

  @override
   Widget build(BuildContext context) {
   return Scaffold(
   appBar: PreferredSize(
   preferredSize: Size.fromHeight(150.0),
     child: AppBar(
        centerTitle: false,
        titleSpacing: 0.0,
        leading: IconButton(
          icon: Icon(Icons.arrow_back, color: Colors.black), onPressed: () {  },
          //onPressed: () => Navigator.of(context).pop(),
           ),  
       title: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(
          'LOGIN',
          style: TextStyle(color: Colors.black, fontSize: 16.0),
        ),
        Text(
          'Enter your email and passowrd',
          style: TextStyle(color: Colors.black, fontSize: 14.0),
        )
      ],
    ),
  ],
),

最佳答案

结果:

enter image description here

代码:

Scaffold(
      appBar: PreferredSize(
        preferredSize: Size.fromHeight(150.0),
        child: AppBar(
          leading: IconButton(
            icon: Icon(Icons.arrow_back, color: Colors.black),
            onPressed: () {},
            //onPressed: () => Navigator.of(context).pop(),
          ),
          bottom: PreferredSize(
            preferredSize: Size.fromHeight(30.0),
            child: Container(
              alignment: Alignment.centerLeft,
              padding: EdgeInsets.symmetric(horizontal: 20),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    'LOGIN',
                    style: TextStyle(color: Colors.black, fontSize: 16.0),
                  ),
                  Text(
                    'Enter your email and passowrd',
                    style: TextStyle(color: Colors.black, fontSize: 14.0),
                  )
                ],
              ),
            ),
          ),
        ),
      ),
    )

关于flutter - 如何在flutter中设置App Bar底部的标题和副标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66237816/

相关文章:

flutter - Flutter 中的自定义 SliverAppBar

flutter - 如何在flutter中使个人资料应用栏像电报一样?

android - 有没有办法从 native 代码访问 Flutter 资源?

flutter - 如何在 Flutter 中将参数发送到 setstate

android - 抽屉动画报错:'Animation<FractionalOffset>'无法赋值给参数类型 'Animation<Offset>'

flutter - 如何在 flutter 中更改 textField 的下划线颜色?

flutter - (watch)表达式没有计算出一个函数,所以它不能被调用

flutter - 如何使用动画隐藏/最小化 ListView?

flutter reordable_grid_view 包子白色背景

flutter - SliverAppBar 仅在滚动一段时间后向上推