mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
fix: 评论区表情suggest解析错误,评论区非空错误
This commit is contained in:
@@ -62,7 +62,7 @@ class Packages {
|
|||||||
PackagesMeta? meta;
|
PackagesMeta? meta;
|
||||||
List<Emote>? emote;
|
List<Emote>? emote;
|
||||||
PackagesFlags? flags;
|
PackagesFlags? flags;
|
||||||
dynamic label;
|
Label? label;
|
||||||
String? packageSubTitle;
|
String? packageSubTitle;
|
||||||
int? refMid;
|
int? refMid;
|
||||||
|
|
||||||
@@ -94,8 +94,9 @@ class Packages {
|
|||||||
emote!.add(Emote.fromJson(v));
|
emote!.add(Emote.fromJson(v));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
flags = json['flags'] != null ? PackagesFlags.fromJson(json['flags']) : null;
|
flags =
|
||||||
label = json['label'];
|
json['flags'] != null ? PackagesFlags.fromJson(json['flags']) : null;
|
||||||
|
label = json['label'] != null ? Label.fromJson(json['label']) : null;
|
||||||
packageSubTitle = json['package_sub_title'];
|
packageSubTitle = json['package_sub_title'];
|
||||||
refMid = json['ref_mid'];
|
refMid = json['ref_mid'];
|
||||||
}
|
}
|
||||||
@@ -117,28 +118,58 @@ class Packages {
|
|||||||
if (flags != null) {
|
if (flags != null) {
|
||||||
data['flags'] = flags!.toJson();
|
data['flags'] = flags!.toJson();
|
||||||
}
|
}
|
||||||
data['label'] = label;
|
if (label != null) {
|
||||||
|
data['label'] = label!.toJson();
|
||||||
|
}
|
||||||
data['package_sub_title'] = packageSubTitle;
|
data['package_sub_title'] = packageSubTitle;
|
||||||
data['ref_mid'] = refMid;
|
data['ref_mid'] = refMid;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Label {
|
||||||
|
String? fontColor;
|
||||||
|
String? backgroundColor;
|
||||||
|
String? text;
|
||||||
|
|
||||||
|
Label({this.fontColor, this.backgroundColor, this.text});
|
||||||
|
|
||||||
|
Label.fromJson(Map<String, dynamic> json) {
|
||||||
|
fontColor = json['font_color'];
|
||||||
|
backgroundColor = json['background_color'];
|
||||||
|
text = json['text'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['font_color'] = fontColor;
|
||||||
|
data['background_color'] = backgroundColor;
|
||||||
|
data['text'] = text;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class PackagesMeta {
|
class PackagesMeta {
|
||||||
int? size;
|
int? size;
|
||||||
int? itemId;
|
int? itemId;
|
||||||
|
String? itemUrl;
|
||||||
|
int? assetId;
|
||||||
|
|
||||||
PackagesMeta({this.size, this.itemId});
|
PackagesMeta({this.size, this.itemId, this.itemUrl, this.assetId});
|
||||||
|
|
||||||
PackagesMeta.fromJson(Map<String, dynamic> json) {
|
PackagesMeta.fromJson(Map<String, dynamic> json) {
|
||||||
size = json['size'];
|
size = json['size'];
|
||||||
itemId = json['item_id'];
|
itemId = json['item_id'];
|
||||||
|
itemUrl = json['item_url'];
|
||||||
|
assetId = json['asset_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['size'] = size;
|
data['size'] = size;
|
||||||
data['item_id'] = itemId;
|
data['item_id'] = itemId;
|
||||||
|
data['item_url'] = itemUrl;
|
||||||
|
data['asset_id'] = assetId;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,7 +245,9 @@ class EmoteMeta {
|
|||||||
|
|
||||||
EmoteMeta.fromJson(Map<String, dynamic> json) {
|
EmoteMeta.fromJson(Map<String, dynamic> json) {
|
||||||
size = json['size'];
|
size = json['size'];
|
||||||
suggest = json['suggest'].cast<String>();
|
suggest = json['suggest'] == null
|
||||||
|
? null
|
||||||
|
: List<String>.from(json['suggest'].map((x) => x));
|
||||||
alias = json['alias'];
|
alias = json['alias'];
|
||||||
gifUrl = json['gif_url'];
|
gifUrl = json['gif_url'];
|
||||||
}
|
}
|
||||||
@@ -231,16 +264,18 @@ class EmoteMeta {
|
|||||||
|
|
||||||
class EmoteFlags {
|
class EmoteFlags {
|
||||||
bool? unlocked;
|
bool? unlocked;
|
||||||
|
bool? recentUseForbid;
|
||||||
|
|
||||||
EmoteFlags({this.unlocked});
|
EmoteFlags({this.unlocked, this.recentUseForbid});
|
||||||
|
|
||||||
EmoteFlags.fromJson(Map<String, dynamic> json) {
|
EmoteFlags.fromJson(Map<String, dynamic> json) {
|
||||||
unlocked = json['unlocked'];
|
unlocked = json['unlocked'];
|
||||||
|
recentUseForbid = json['recent_use_forbid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['unlocked'] = unlocked;
|
data['unlocked'] = unlocked;
|
||||||
|
data['recent_use_forbid'] = recentUseForbid;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
import 'package:PiliPalaX/models/user/my_emote.dart';
|
import 'package:PiliPalaX/models/user/my_emote.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
@@ -45,10 +46,12 @@ class _EmoteTabState extends State<EmoteTab> with TickerProviderStateMixin {
|
|||||||
future: futureBuild,
|
future: futureBuild,
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done &&
|
if (snapshot.connectionState == ConnectionState.done &&
|
||||||
|
myEmote != null &&
|
||||||
myEmote.packages != null) {
|
myEmote.packages != null) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: TabBarView(controller: _myEmoteTabController, children: [
|
Expanded(
|
||||||
|
child: TabBarView(controller: _myEmoteTabController, children: [
|
||||||
for (Packages i in myEmote.packages!) ...<Widget>[
|
for (Packages i in myEmote.packages!) ...<Widget>[
|
||||||
GridView.builder(
|
GridView.builder(
|
||||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
@@ -64,18 +67,23 @@ class _EmoteTabState extends State<EmoteTab> with TickerProviderStateMixin {
|
|||||||
widget.onEmoteTap(i.emote![index].text!);
|
widget.onEmoteTap(i.emote![index].text!);
|
||||||
},
|
},
|
||||||
child: i.type == 4
|
child: i.type == 4
|
||||||
? Text(i.emote![index].text!,overflow: TextOverflow.clip,maxLines: 1,)
|
? Text(
|
||||||
|
i.emote![index].text!,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
maxLines: 1,
|
||||||
|
)
|
||||||
: NetworkImgLayer(
|
: NetworkImgLayer(
|
||||||
width: 36,
|
width: 36,
|
||||||
height: 36,
|
height: 36,
|
||||||
type: 'emote',
|
type: 'emote',
|
||||||
src: i.emote![index].url,
|
src: i.emote![index].url?.split("@")[0]
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
]),),
|
]),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 45,
|
height: 45,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ class ReplyItem extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget content(BuildContext context) {
|
Widget content(BuildContext context) {
|
||||||
|
if (replyItem?.member == null) return const SizedBox();
|
||||||
final String heroTag = Utils.makeHeroTag(replyItem!.mid);
|
final String heroTag = Utils.makeHeroTag(replyItem!.mid);
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
Reference in New Issue
Block a user