Home > Software design >  Flutter: Adding button shows up behind ListView, "duplicate child" error
Flutter: Adding button shows up behind ListView, "duplicate child" error

Time:04-04

I'm trying to add a button to navigate to another screen but I'm not sure how to get it on the bottom of my list instead of behind it. This is my current list:

    class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.teal[800],
      appBar: AppBar(
        title: Text(widget.title),
          ),
      body: SafeArea(
        child: ListView.builder(
          itemCount: Type.samples.length,
          itemBuilder: (BuildContext context, int index) {
            return GestureDetector(
              onTap: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) {
                      return BoardingDetail(boarding: Type.samples[index]);
                    },
                  ),
                );
              },
              child: buildBoardingCard(Type.samples[index]),
            );
          },
        ),
      ),
    );
  }

And I think this is the code I want to add to navigate to a new screen, I got this code from enter image description here

  • Related