【发布时间】:2026-01-01 16:00:01
【问题描述】:
我在我的颤振应用程序中使用 CupertinoTabBar。 问题是当键盘出现时底部栏显示,它不应该。它是一个底栏,它应该总是在底部。
我还没有找到一些方法或技巧来做到这一点。 也许有人可以指导我获得正确的行为。
这是我的颤振医生输出
医生总结(要查看所有详细信息,请运行 flutter doctor -v):
[✓] Flutter(Channel master,v1.6.1-pre.50,在 Linux 上,语言环境 en_US.UTF-8)
[✓] Android 工具链 - 为 Android 设备开发(Android SDK 版本 28.0.3)
[✓] Android Studio(版本 3.3)
[✓] VS 代码(版本 1.33.1)
[✓] 已连接设备(1 个可用)
这是 cupertinoTabBar 唯一允许的选项:
const CupertinoTabBar({
Key key,
@required this.items,
this.onTap,
this.currentIndex = 0,
this.backgroundColor,
this.activeColor,
this.inactiveColor = CupertinoColors.inactiveGray,
this.iconSize = 30.0,
this.border = const Border(
top: BorderSide(
color: _kDefaultTabBarBorderColor,
width: 0.0, // One physical pixel.
style: BorderStyle.solid,
),
),
})
这是我的 CupertinoTabBar 在键盘出现时上升的方式:
更新:
我正在尝试验证键盘的状态是否不显示 CupertinoTabBar,但它位于 CupertinoTabScaffold 内:
return Scaffold(
body: CupertinoTabScaffold(
tabBuilder: (BuildContext context, int index) {
switch (index) {
case 0: // Home
return CupertinoTabView(
navigatorKey: Undoc3Keys.homeNavigator,
routes: getRoutes(context, store),
onGenerateRoute: handleRoutes,
builder: (BuildContext context) => FeedScreen(),
);
break;
case 1: // Preguntar
return CupertinoTabView(
navigatorKey: Undoc3Keys.askNavigator,
routes: getRoutes(context, store),
onGenerateRoute: handleRoutes,
builder: (BuildContext context) => SearchResultScreen(
arguments: {"askScreen": ""},
),
);
break;
case 2: // Perfil
return CupertinoTabView(
navigatorKey: Undoc3Keys.perfilNavigator,
routes: getRoutes(context, store),
onGenerateRoute: handleRoutes,
builder: (BuildContext context) => ProfileScreen(),
);
break;
default:
}
},
tabBar: Undoc3Keys.keyboardStatus // Here is validation of keyboard.
? CupertinoTabBar( // A try for making invisible bar.
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(
Icons.radio_button_unchecked,
color: Colors.transparent,
),
backgroundColor: Colors.transparent),
BottomNavigationBarItem(
icon: Icon(
Icons.radio_button_unchecked,
color: Colors.transparent,
),
backgroundColor: Colors.transparent)
],
backgroundColor: Colors.transparent.withOpacity(0.0),
inactiveColor: Colors.transparent,
activeColor: Colors.transparent,
border: Border(
top: BorderSide(
color: Colors.transparent,
width: 0.0, // One physical pixel.
style: BorderStyle.none,
),
),
)
: _buildTabBar(),
),
);
这是键盘出现时的情况:
【问题讨论】:
标签: flutter flutter-cupertino cupertinotabbar