I'm learning to program mobile apps in flutter following this video tutorial " https://www.youtube.com/watch?v=DAroZ2-OAaY&t=472s&ab_channel=Dero " of a flutter application, and within the modifications I made to the video code I managed to make the containers where the carousels are work as buttons, however, the way I did it works badly since I cannot assign a new screen to each button but they all redirect to the same screen.
So I wonder if it is possible with the way I have written the code to be able to assign each button a different screen or is it necessary to structure the code in another way.
Below I leave the code extracts that I modified from the video where I added the gesture detector
import 'package:hielder2/screens/avances.dart';
import 'package:hielder2/screens/mainscreen.dart';
import 'package:hielder2/models/tool.dart';
import 'package:flutter/material.dart';
import 'package:hielder2/screens/mainscreen.dart';
class CompactItemJob extends StatelessWidget {
Tool tool;
CompactItemJob(this.tool);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MainScreen())
);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0),
child: Container(
decoration: _boxDecoration(),
height: 125.0,
width: 100.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
_companyLogo(),
_infoJobTexts(context),
],
),
],
),
),
),
);
}