带有底纹的颤动底片(类似于bottomNavigationBar:BottomAppBar的shape属性)

时间:2018-09-10 11:49:15

标签: dart flutter bottomnavigationview

问题1:  如何在floatactionbutton周围的底部面板上添加一个凹口,使其看起来像底部应用栏(形状为CircularNotchedRectangle()),但行为却像底部面板(可以拖动以关闭)

问题2: 如何使底页不可散布但仍可拖动。 (类似于android的底部表格)

问题3: 底表窥视高度,可以忽略的底表,但也可以扩展(同样,就像android底表一样)

能否实现我上面列出的内容?还是我不走运,必须使用第三方图书馆? (如果有的话?)

enter image description here

3 个答案:

答案 0 :(得分:0)

看起来BottomAppBar在beta中有点混乱。我能找到的最接近的实现是在this article中。 作者创建了一个单独的小部件来解决该问题。

可以在here中找到本文中的源代码。

这可能与您要求的不完全相同,但是您可以根据需要进行调整。

答案 1 :(得分:0)

希望它能提供帮助:)

Scaffold(
    floatingActionButtonLocation: FloatingActionButtonLocation.startDocked, //specify the location of the FAB
    floatingActionButton: FloatingActionButton(
      backgroundColor: Colors.blue,
      onPressed: () {
        print('OK');
      },
      tooltip: "start FAB",
      child: Container(
        margin: EdgeInsets.all(15.0),
        child: Icon(Icons.add),

      ),
      elevation: 4.0,
    ),
    bottomNavigationBar: BottomAppBar(
      child: Container(
        color: mycolor,
        height: 35,
      ),
    )
);

答案 2 :(得分:0)

您也可以使用此技术

Scaffold(
  backgroundColor: myBackgroundColor,
    floatingActionButtonLocation: FloatingActionButtonLocation.startDocked, //specify the location of the FAB
    floatingActionButton: CircleAvatar(
      radius: 32,
      backgroundColor: myBackgroundColor,
      child: Padding(
        padding: EdgeInsets.all(1),
        child: FloatingActionButton(
          backgroundColor: MyColor.textColor,
          onPressed: () {
            print('OK');
          },
          child: Container(
            margin: EdgeInsets.all(15.0),
            child: Icon(Icons.add),
          ),
          elevation: 4.0,
        ),
      ),
    ),
    bottomNavigationBar: BottomAppBar(
      child: Container(
        color: MyColor.textColor,
        height: 35,
      ),
    )
);