Search code examples
flutterflutter-dependencies

How to add a dart. page from "AppBar" menu "Error URI doesnt exist" but i have made a page?


app bar made ontap materialpageroute made but cannont find a page i have made path LIB/pages/first_page.dart

I was thinking i need some code in the linked page maybe.

enter image description here

i tried to add line :

import 'lib/pages/First_Page.dart';

   IconButton(
            icon: const Icon(Icons.notifications),
            onPressed: () {},
          )
        ],
        backgroundColor: Colors.orangeAccent,
      ),
      drawer: Drawer(
        child: Container(
          color: Color(0xFFFF9000),
          child: ListView(
            children: [
              DrawerHeader(
                  child: Center(
                child: Text(
                  'TCB',
                  style: TextStyle(fontSize: 45),
                ),
              )),
              ListTile(
                leading: Icon(Icons.home),
                title: Text(
                  'Page 1',
                  style: TextStyle(fontSize: 30),
                ),
                onTap: () {
                  Navigator.of(context).push(
                      MaterialPageRoute(builder: (context) => First_Page()));
                },
              ),

new pic


Solution

  • i went with a slighty diffent aproach and did this:

    I found this worked my mistake was the named class "addtwonumbers"was the connector thanks all ListTile( leading: Icon(Icons.file_upload), title: Text('Rules'), onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => AddTwoNumbers()))),