mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 11:39:46 +08:00
feat: filter media in watchlist
This commit is contained in:
@@ -197,6 +197,7 @@ class SearchResult {
|
||||
required this.voteAverage,
|
||||
required this.voteCount,
|
||||
required this.originCountry,
|
||||
this.inWatchlist
|
||||
});
|
||||
|
||||
final String? backdropPath;
|
||||
@@ -214,6 +215,7 @@ class SearchResult {
|
||||
final double? voteAverage;
|
||||
final int? voteCount;
|
||||
final List<String> originCountry;
|
||||
final bool? inWatchlist;
|
||||
|
||||
factory SearchResult.fromJson(Map<String, dynamic> json) {
|
||||
return SearchResult(
|
||||
@@ -233,6 +235,7 @@ class SearchResult {
|
||||
firstAirDate: DateTime.tryParse(json["first_air_date"] ?? ""),
|
||||
voteAverage: json["vote_average"],
|
||||
voteCount: json["vote_count"],
|
||||
inWatchlist: json["in_watchlist"],
|
||||
originCountry: json["origin_country"] == null
|
||||
? []
|
||||
: List<String>.from(json["origin_country"]!.map((x) => x)),
|
||||
|
||||
@@ -36,8 +36,9 @@ class _SearchPageState extends ConsumerState<SearchPage> {
|
||||
child: InkWell(
|
||||
//splashColor: Colors.blue.withAlpha(30),
|
||||
onTap: () {
|
||||
//showDialog(context: context, builder: builder)
|
||||
_showSubmitDialog(context, item);
|
||||
if (item.inWatchlist != true) {
|
||||
_showSubmitDialog(context, item);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
@@ -75,7 +76,14 @@ class _SearchPageState extends ConsumerState<SearchPage> {
|
||||
))
|
||||
: const Chip(
|
||||
avatar: Icon(Icons.movie),
|
||||
label: Text("电影"))
|
||||
label: Text("电影")),
|
||||
item.inWatchlist == true
|
||||
? const Chip(
|
||||
label: Icon(
|
||||
Icons.done,
|
||||
color: Colors.green,
|
||||
))
|
||||
: const Text("")
|
||||
],
|
||||
),
|
||||
const Text(""),
|
||||
|
||||
Reference in New Issue
Block a user