Sorry for not being able to provide code for this question since I’m still at the very beginning of the development. I’ll try to create an example with something simple that achieves what I’m looking for.
I’m trying to create 2 screens:
1st screen should contain a list, for instance a guest list for a birthday party. This first screen should show the list with name and thumbnail photo from each guest. On clicking on a specific guest, we should navigate to Screen 2.
2nd screen should be a detailed view of the guest, containing a larger version of their photo, name, age and contact information.
All this data is populated in a SQL database I already created.
Any ideas on how to go about this?
Thanks in advance!
Diogo Boëchat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
In your first screen:
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SecondScreen(
photoUrl: photoUrl.toString(),
name: name.toString(),
age: age.toString(),
phoneNumber: phoneNumber.toString(),
),
),
);
In Second Screen:
class SecondScreen extends StatefulWidget {
final String photoUrl, name, age, phoneNumber;
const SecondScreen({Key? key, required this.photoUrl, required this.name,required this.age,required this.phoneNumber}) : super(key: key);
@override
State<SecondScreen> createState() => _SecondScreenState();
}
class _SecondScreenState extends State<SecondScreen> {
Widget build(BuildContext context) {
return Text(widget.name + widget.age);
}
}