how can i get individual data variables into another page after building a function that displays them all
This is the calling of the function which i will be using php for later to query list of them from the database.
buildOrderItem('images/shoe.jpg', "Men's Italian Shoe", 150.00),
buildOrderItem('images/suit.jpg', 'FloTextile Suit', 450.00),
buildOrderItem('images/heels.jpg', "Women's Heel", 200.00),
and this is the function
Container buildOrderItem(imagelink, productName, price) {
return Container(
child: InkWell(
onTap: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new ProductPage()));
},
child: Container(
margin: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(10)),
child: Column(
children: [
Container(
child: Image.asset(
imagelink,
width: 250,
height: 150,
fit: BoxFit.scaleDown,
),
),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: EdgeInsets.all(20),
child: Text(
productName,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
Container(
padding: EdgeInsets.all(20),
child: Text(
'N' + price.toString(),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.deepOrange),
),
)
],
),
),
],
),
),
),
);
from the ontap, how can i pass the data variables (imagelink, productName, price) from the particular product i click into the next screen...
onTap:(){
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new ProductPage()));
},
i tried sending the variables as parameters into the routes but I'm receiving null.
kindly help, thanks