上面的照片显示了我遇到的错误。底部溢出了 484 像素,并且导航在侧边栏中不起作用。然后我无法找到错误。
class MyHeaderDrawer extends StatelessWidget {
const MyHeaderDrawer({super.key});
@override
Widget build(BuildContext context) {
return SafeArea(
child: Center(
child: Container(
color: Colors.green,
width: double.infinity,
height: 200,
padding: const EdgeInsets.only(top: 40.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height:80,
width: 80,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("img/logo.png"),
),
),
),
const Text(
"Travel With Me",
style: TextStyle(
color: Colors.white, fontSize: 15, fontWeight: FontWeight.bold),
),
const Text(
"info@[email protected]",
style: TextStyle(
color: Color.fromARGB(255, 106, 105, 105), fontSize: 10),
),
const SizedBox(
height: 70,
),
Container(
child: Column(
children: [
ListTile(
title: const Text('My TODO'),
leading: const Icon(Icons.list),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const HomePage(),
),
);
},
),
ListTile(
title: const Text('My Time Table'),
leading: const Icon(Icons.timeline),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const HomePage(),
),
);
},
),
ListTile(
title: const Text('Notification'),
leading: const Icon(Icons.notification_add),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const HomePage(),
),
);
},
),
),
const Divider(color: Colors.black),
ListTile(
title: const Text('About Us'),
leading: const Icon(Icons.person),
onTap: () => {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const About()),
)
},
),
ListTile(
title: const Text('Privacy and policy'),
leading: const Icon(Icons.privacy_tip),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const PrivacyAndPolicy(),
),
);
},
)
],
),
),
],
),
),
),
);
}
}
为什么我们不能使用 onPresed() ,而不是使用 onTap() 。我需要解决我的问题。你能帮助我吗?
谢谢你!
查米图。
希望对你有帮助,