我使用indexedStack来显示我的网页,他们都有一个抽屉,一切都好,直到现在,但当我打开抽屉的网页,它不涵盖垂直页面,我会附上图像。我会很高兴,如果你帮我。
body: IndexedStack(
index: selectedTabIndex,
children: const [
HomePage(),
ExplorePage(),
],
),
字符串
这是抽屉
drawer: Drawer(
child: ListView(
padding: EdgeInsets.symmetric(vertical: 50),
children: <Widget>[
Icon(
Icons.account_circle,
size: 150,
color: Colors.grey[600],
),
const SizedBox(
height: 15,
),
Text(
userName,
textAlign: TextAlign.center,
),
const SizedBox(
height: 30,
),
const Divider(
height: 2,
),
ListTile(
onTap: () {},
selected: true,
contentPadding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
leading: const Icon(Icons.group),
title: Text(
'Groups',
style: themeData.textTheme.bodyMedium!
.copyWith(fontWeight: FontWeight.w600),
),
),
ListTile(
onTap: () {
nextScreenReplace(
context,
ProfilePage(
userName: userName,
email: email,
nationality: nationality,
));
},
contentPadding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
leading: const Icon(Icons.person),
title: Text(
'Profile',
style: themeData.textTheme.bodyMedium!
.copyWith(fontWeight: FontWeight.w600),
),
),
ListTile(
onTap: () async {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) {
return AlertDialog(
title: Text('Logout',
style: themeData.textTheme.bodyMedium!
.copyWith(fontWeight: FontWeight.w500)),
content: Text(
'Are you sure you want do logout?',
style: TextStyle(color: Colors.black),
),
actions: [
IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(
Icons.cancel,
color: Colors.red,
)),
IconButton(
onPressed: () async {
await authService.logOut();
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) =>
const LoginPage()),
(route) => false);
},
icon: const Icon(
Icons.done,
color: Colors.green,
)),
],
);
});
},
contentPadding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
leading: const Icon(Icons.exit_to_app),
title: Text(
'Logout',
style: themeData.textTheme.bodyMedium!.copyWith(
fontFamily: 'OpenSans', fontWeight: FontWeight.w600),
),
),
],
))
型
as you see the drawer it doesn't cover the page vertically
我尝试了太多的东西,如堆栈和.但我找不到解决方案。在一些地方,我看到了一些答案,包括一些键,但我没有得到它。
1条答案
按热度按时间jw5wzhpr1#
我认为你是在每一页上使用单独的脚手架,并在这些页面上添加抽屉。你需要在根脚手架上提供抽屉,以覆盖垂直高度,如下所示,
字符串