【发布时间】:2021-11-08 14:03:09
【问题描述】:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
'Category',
),
),
body: Center(
child: FutureBuilder(
future: fetchCategory(),
builder: (ctx, snapShot) {
if (snapShot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else {
return ListView.builder(
itemCount: snapShot.data["table"].length,
itemBuilder: (context, index) {
return ListTile(
title: TextButton(
style: TextButton.styleFrom(
textStyle: TextStyle(fontSize: 20),
),
onPressed: () {
Navigator.pushNamed(context, '/second');
},
child: Text(snapShot.data["table"][index]["name"]),
),
//subtitle: Text("price: ${snapShot.data["table"][index]["price"]}"),
);
},
);
}
},
),
),
);
}
我想传输这些数据 (snapShot.data["table"][index]["id"]) 并用它在第二个屏幕上显示结果/数据返回字符串/ 我想用数据在第二页显示相同编号的项目,我该怎么做
【问题讨论】:
-
参考我的回答here希望对你有帮助
标签: flutter flutter-http