在 persist_bottom_nav_bar 中,我使用它的 style15 在 navbardecoration 中我应用了 borderRadius 但它不接受它。我尝试过 Stack

问题描述 投票:0回答:1

我想要这种类型的borderRadius。但它不适用于 BorderRadius。

Stack(
          alignment: Alignment.bottomCenter,
          children: [
            Container(
              height: 80,
              width: double.infinity,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(25),
                color: Colors.white,
              ),
            ),
            PersistentTabView(context,
                screens: pages,
                navBarHeight: 80,
                controller: _controller,
                backgroundColor: Colors.white30,
                navBarStyle: NavBarStyle.style15,
                items: myscreens,
                confineInSafeArea: true,
                handleAndroidBackButtonPress: true,
                resizeToAvoidBottomInset: true,
                stateManagement: true,
                hideNavigationBarWhenKeyboardShows: true,
                decoration: NavBarDecoration(
                    adjustScreenBottomPaddingOnCurve: true,
                    borderRadius: BorderRadius.circular(20.0),
                    colorBehindNavBar: Colors.white),
                popAllScreensOnTapOfSelectedTab: true,
                popActionScreens: PopActionScreensType.all,
                itemAnimationProperties: const ItemAnimationProperties(
                    duration: Duration(milliseconds: 200), curve: Curves.ease),
                screenTransitionAnimation: const ScreenTransitionAnimation(
                    animateTabTransition: true,
                    curve: Curves.ease,
                    duration: Duration(milliseconds: 200))),
          ],
        ),

我已经应用了这种类型的代码,但仍然不起作用它无法应用 borderRadius 。 现在我正在定制,但我仍然想要解决方案。

我已经尝试过通过堆栈,将其包装在容器中但仍然不起作用。

flutter dart user-interface
1个回答
0
投票

对于bottomNavBar的边框半径,使用flutter的包perpetual_bottom_nav_bar_v2而不是perpetual_bottom_nav_bar

Container(
      height: double.infinity,
      child: Stack(
        alignment: Alignment.bottomCenter,
        children: [
          PersistentTabView(
            navBarHeight: 80,
            handleAndroidBackButtonPress: true,
            resizeToAvoidBottomInset: true,
            stateManagement: true,
            popAllScreensOnTapOfSelectedTab: true,
            popActionScreens: PopActionScreensType.all,
            screenTransitionAnimation: const ScreenTransitionAnimation(
              curve: Curves.ease,
              duration: Duration(milliseconds: 200),
            ),
            tabs: [
              PersistentTabConfig(
                screen: Container(),
                item: ItemConfig(
                  icon: Icon(Icons.home),
                  title: "Home",
                ),
              ),
              PersistentTabConfig(
                screen: Container(),
                item: ItemConfig(
                  icon: Icon(Icons.message),
                  title: "Messages",
                ),
              ),
              PersistentTabConfig(
                screen: Container(),
                item: ItemConfig(
                  icon: Icon(Icons.settings),
                  title: "Settings",
                ),
              ),
            ],
            navBarBuilder: (navBarConfig) => Style1BottomNavBar(
              navBarConfig: navBarConfig,
              navBarDecoration: NavBarDecoration(
                color: Colors.orange,
                borderRadius: BorderRadius.only(topLeft: Radius.circular(50), topRight: Radius.circular(50)),
              ),
            ),
          ),
        ],
      ),
    );
© www.soinside.com 2019 - 2024. All rights reserved.