BottomAppBar Floating action button notch/inset is not transparent

前端 未结 3 1734
耶瑟儿~
耶瑟儿~ 2021-02-07 23:01

I\'ve added a BottomAppBar to scaffold in a materialApp, and to that I\'ve added a fab with a inset at the center. The code looks somewhat like this



        
3条回答
  •  無奈伤痛
    2021-02-07 23:33

    I was able to achieve the desired behavior by also setting the resizeToAvoidBottomInset flag to false.

    @override
    Widget build(BuildContext context) {
    
        return Scaffold(
            extendBody: true,
            resizeToAvoidBottomInset: false,
            body: IndexedStack(
                children: [],
                index: _selectedTab,
            ),
            bottomNavigationBar: ClipRRect(
                clipBehavior: Clip.antiAlias,
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(16.0),
                    topRight: Radius.circular(16.0)
                ),
                child: BottomNavigationBar(
                    backgroundColor: Colors.white,
                    elevation: 10,
                    type: BottomNavigationBarType.fixed,
                    items: [],
                    currentIndex: _selectedTab,
                ),
            ),
        );
    }
    

    Edit: keep in mind that you may have to manually set the bottom insets by using MediaQuery.of(context)

提交回复
热议问题