Flutter. I can't download the third window. Black screen



  • I have three pages in the annex. From the first to the second transition, and from the second to the third, some black window. I split into different classes of MaterialApp and the first page. From the first page, I call auxiliary class, hand over the cotext to it, and from the auxiliary class, I'm already calling the second page, and from the second page, I'm calling the third, transmitting the very first context. What am I doing wrong?

    Yeah, I really missed Scaffold. And yet I'm a little confused. On page one, I have Scaffold with AppBar, the body has a second page. On my second page, I have an ElevatedButton button, writing onPressed:

    Navigator.of(mainContext).push
                (
                  MaterialPageRoute<ConnectorDetails>
                  (
                    builder: (BuildContext context)
                    {
                      return ConnectorPage(details.connectors[i], mainContext);
                    }
                  )
                );
    

    In ConnectorPage:

    return Scaffold
        (
          body: Center(child: Text('123', style: TextStyle(fontSize: 30)))
        );
    

    But I'm losing AppBar. What am I missing again? Or re-establish it on page three?

    введите сюда описание изображения

    I'm sorry, as long as it's hard to figure out how to format the text and make pictures.


    I don't know how right it is, but I still had to create AppBar on page three. How to change the body, I haven't found it yet.


    All I've come to mind is I've created a separate view of AppBar, and I'll tell you what I need to picture. And I use it on the pages I need.

    class AppBarWidget extends StatelessWidget with PreferredSizeWidget{
      final Station station;
      AppBarWidget(this.station);
    

    @override
    Size get preferredSize => Size.fromHeight(kToolbarHeight);

    @override
    Widget build (BuildContext context) {
    return AppBar(
    title: Column(
    children: [
    Text('Станция ' + station.label),
    Text(station.address),
    ],
    ));
    }
    }



  • Every Scaffold has its own Appbar. You can create a static view of AppBar and call it in any of your Scaffold.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2