У меня есть код, использующий CupertinoTabScaffold для отображения нижней навигации, я хочу отобразить нижний диалоговый лист в одном из меню, но получаю сообщение об ошибке
Следующее утверждение было выброшено сборщиком сборки (грязный, зависимости: [_InheritedTheme, _LocalizationsScope-[GlobalKey#a6d51]]): setState() или markNeedsBuild(), вызываемые во время сборки.
это мой код
class AppTab extends StatefulWidget {
final dataUser;
AppTab(this.dataUser);
@override
_AppTabState createState() => _AppTabState(dataUser);
}
class _AppTabState extends State<AppTab> {
final user;
_AppTabState(this.user);
@override
Widget build(BuildContext context) {
return BlocListener<AuthenticationBloc, AuthenticationState>(
listener: (context, state) {
if (state == AuthenticationState.unauthenticated()) {
Navigator.pushNamedAndRemoveUntil(context, '/login', (route) => false, arguments: state.loginPageState);
}
},
child: CupertinoTabScaffold(
controller: tabController,
tabBar: CupertinoTabBar(
activeColor: HexColor("#26ADE4"),
inactiveColor: HexColor("#707070"),
items: [
BottomNavigationBarItem(
label: "Menu 1",
icon: Image.asset("assets/icon_tab_home.png", height: 25, width: 22),
activeIcon: Image.asset("assets/icon_tab_home_active.png", height: 25, width: 22),
),
BottomNavigationBarItem(
label: "Menu 2",
icon: Image.asset("assets/icon_tab_buat_bill.png", height: 25, width: 22),
activeIcon: Image.asset("assets/icon_tab_buat_bill_active.png", height: 25, width: 22),
),
BottomNavigationBarItem(
label: "Menu 3",
icon: Image.asset("assets/icon_tab_account.png", height: 25, width: 22),
activeIcon: Image.asset("assets/icon_tab_account_active.png", height: 25, width: 22),
),
],
),
tabBuilder: (context, index) {
if (index == 0) {
return HomePage(user);
} else if (index == 1) {
return _bottomSheetMore(context);
}
return AccountPage(user);
}),
);
}
_bottomSheetMore(context) {
showModalBottomSheet(
context: context,
builder: (builder) {
return new Container(
padding: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(10.0),
topRight: const Radius.circular(10.0))),
child: new Wrap(
children: <Widget>[
new ListTile(
title: const Text(
'Menu Akun',
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w700,
),
),
subtitle: Text("Pilih salah satu"),
),
new Divider(
height: 10.0,
),
new ListTile(
title: const Text(
'Menu Home',
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w700,
),
),
),
new Divider(
height: 10.0,
),
new ListTile(
title: const Text(
'Logout',
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w700,
),
),
onTap: () async {
// Add Here
},
),
],
),
);
},
);
}
}