【问题标题】:I want to make two text in appbar我想在 appbar 中制作两个文本
【发布时间】:2021-04-21 21:34:47
【问题描述】:

任何人都知道如何在一个顶部应用栏中制作两个文本并在触摸时使它们改变颜色和页面?我一直在寻找大约 1 周的时间,但找不到解决方案,请帮忙。谢谢!

【问题讨论】:

  • 你好,你有没有试过解决问题,你有代码sn-p吗?还是您希望从这里得到答案?
  • @SARANSURYA 大多数在问答网站上提问的人通常都希望得到答案,是的。毕竟,这就是重点。

标签: android flutter


【解决方案1】:
Make your own custom app bar.
Here I have included both the texts as desired in your case. You can customize more 
according to your design.



class CustomAppBar extends PreferredSize {
final String text1;
final String text2;
final double preferredSize;
CustomAppBar({
     this.text1,
     this.text2,
     this.preferredSize
  });

  @override

  final Size preferredSize;

  @override

  Widget build(BuildContext context) {

    return Container(

      height: preferredSize.height,

      color: Colors.orange,

      alignment: Alignment.center,

      child: Row(

          children:[
                 Text(text1),

                 Text(text2)
              ]),
    );

  }

}

【讨论】:

    【解决方案2】:

    查看作为 AppBar 小部件一部分的 TabBar 小部件。

    查看Flutter cook book for tabs

    【讨论】:

      猜你喜欢
      • 2021-06-01
      • 2018-06-26
      • 2023-04-03
      • 2022-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-04
      相关资源
      最近更新 更多