我正在尝试在我的 Flutter 应用程序中获取我的 WordPress 帖子,并且我成功获取了帖子。现在的问题是只显示了 10 个帖子。
Future<List> fetchWpCats() async{
final response = await http.get(
Uri.parse('https://rashtrasandeshnews.com/wp-json/wp/v2/posts'),
headers: {"Accept": "application/json"}
);
var convertedDatatoJson = jsonDecode(response.body);
return convertedDatatoJson;
}
这是我的 ListView,其中我只得到 10 个项目。
FutureBuilder(
future: fetchWpPosts('posts'),
builder: (context, AsyncSnapshot snapshot) {
if (snapshot.data != null) {
return ListView.builder(
itemCount: snapshot.data.length!,
itemBuilder: (context, index) {
Map JSON = snapshot.data![index];
return InkWell(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PostDetails(
id: JSON['id'],
title: JSON['title']['rendered'],
content: JSON['content']['rendered'],
image: JSON['_embedded']
['wp:featuredmedia'][0]
["source_url"],
))),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
elevation: 10,
shadowColor: Colors.pink,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Html(
data: JSON['title']['rendered'],
style: {
"body": Style(
fontSize: FontSize(18.0),
fontWeight: FontWeight.bold,
textAlign: TextAlign.center),
},
),
],
),
),
),
);
},
);
}
return Center(
child: CircularProgressIndicator(
backgroundColor: Colors.pink,
));
},
),
现在,请向我提供详细说明/步骤,以便我获取所有帖子。