当我点击按钮时我构建抽屉它显示不同的错误

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

当我点击抽屉里的链接时,它显示不同的错误。

当我点击任何抽屉链接时,它卡住并给我错误消息并将我带到其他错误页面。 _//////////////////////////////////////// /////////////

_//////////////////////////////////////// /////////////

_//////////////////////////////////////// /////////////

_//////////////////////////////////////// /////////////

class MainDrawer extends StatelessWidget {
  const MainDrawer({super.key});
  Widget buildListTitle(String title, IconData icon, Function function) {
    return ListTile(
      leading: Icon(
        icon,
        size: 20,
      ),
      title: Text(
        title,
        style: TextStyle(
            fontFamily: 'RobotoCondensed',
            fontSize: 24,
            fontWeight: FontWeight.bold),
      ),
      onTap: function(),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Drawer(
      child: Column(
        children: [
          Container(
            height: 120,
            width: double.infinity,
            padding: EdgeInsets.all(20),
            alignment: Alignment.centerLeft,
            color: Theme.of(context).accentColor,
            child: Text(
              'cooking up',
              style: TextStyle(
                fontWeight: FontWeight.w900,
                fontSize: 30,
                color: Theme.of(context).primaryColor,
              ),
            ),
          ),
          SizedBox(
            height: 20,
          ),
          buildListTitle("Meal", Icons.restaurant, () {
            Navigator.of(context).pushNamed("/");
          }),
          buildListTitle("Meal", Icons.restaurant, () {
            Navigator.of(context).pushNamed(FilterScreen.routeName);
          }),
        ],
      ),
    );
  }
}
android flutter dart iso
© www.soinside.com 2019 - 2024. All rights reserved.