flutter - TMDB db 从中获取查询 - Flutter
问题描述
我要做的是从 TMDB 数据库(https://developers.themoviedb.org/3)中获取最受欢迎电影的查询。因此,当我按标题名称搜索时,它会显示出来。我创建了一个关于程序外观的查询模板(电影)。我的问题是,如何从 TMDB 获取该查询列表,以便我可以按标题进行搜索。这是我的带有查询模板的代码
代码:
class DataSearch extends SearchDelegate<String> {
final movies = [
"film 1",
"Grmi 2",
"Movie 3",
"Test12441",
"Test1232",
"Test6612",
"aaaaaaaaaaa"
];
final recent = [
"film 1",
"Grmi 2",
"Test6612",
];
@override
List<Widget> buildActions(BuildContext context) {
return [
IconButton(
icon: Icon(Icons.clear),
onPressed: () {
query = "";
})
];
}
@override
Widget buildLeading(BuildContext context) {
return IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
close(context, null);
});
}
@override
Widget buildResults(BuildContext context) {
//nesta
}
@override
Widget buildSuggestions(BuildContext context) {
final suggesstionList = query.isEmpty
? recent
: movies.where((p) => p.startsWith(query)).toList();
return ListView.builder(
itemBuilder: (context, index) => ListTile(
leading: Icon(Icons.movie),
title: RichText(
text: TextSpan(
text: suggesstionList[index].substring(0, query.length),
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
children: [
TextSpan(
text: suggesstionList[index].substring(query.length),
style: TextStyle(color: Colors.grey))
])),
),
itemCount: 10,
);
}
}
任何帮助都会很棒。提前致谢
解决方案
推荐阅读
- logging - 有没有办法查看 lambda 函数何时部署以及是谁部署的?
- c# - 通过单击一次发布应用程序后,Visual Studio 中文件的路径
- php - SYMFONY 5 - 表单中的查询生成器
- java - 如何将 String[][] 传递给 safeargs?
- r - R中的变量如何,中心限制
- javascript - 后端响应成功后打开贝宝结帐模式
- python - 使用带有 Python 的 YouTube 数据 API 打印 YouTube 频道的 ID
- r - 有没有办法将 R 中的单个变量分成两个变量?
- html - CSS如何平滑两个标题之间的过渡
- python - Django 我可以自动填写 list_display