fix: 评论区表情suggest解析错误,评论区非空错误

This commit is contained in:
orz12
2024-02-23 10:09:33 +08:00
parent b44dbdfa09
commit 0a32b30c5f
3 changed files with 112 additions and 68 deletions

View File

@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'package:PiliPalaX/models/user/my_emote.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
@@ -42,13 +43,15 @@ class _EmoteTabState extends State<EmoteTab> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: futureBuild,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done &&
myEmote.packages != null) {
return Column(
children: [
Expanded(child: TabBarView(controller: _myEmoteTabController, children: [
future: futureBuild,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done &&
myEmote != null &&
myEmote.packages != null) {
return Column(
children: [
Expanded(
child: TabBarView(controller: _myEmoteTabController, children: [
for (Packages i in myEmote.packages!) ...<Widget>[
GridView.builder(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
@@ -64,41 +67,46 @@ class _EmoteTabState extends State<EmoteTab> with TickerProviderStateMixin {
widget.onEmoteTap(i.emote![index].text!);
},
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(
width: 36,
height: 36,
type: 'emote',
src: i.emote![index].url,
),
width: 36,
height: 36,
type: 'emote',
src: i.emote![index].url?.split("@")[0]
),
);
},
),
],
]),),
SizedBox(
height: 45,
child: TabBar(
isScrollable: true,
controller: _myEmoteTabController,
tabs: [
for (var i in myEmote.packages!)
NetworkImgLayer(
width: 36,
height: 36,
type: 'emote',
src: i.url,
),
],
))
],
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
);
]),
),
SizedBox(
height: 45,
child: TabBar(
isScrollable: true,
controller: _myEmoteTabController,
tabs: [
for (var i in myEmote.packages!)
NetworkImgLayer(
width: 36,
height: 36,
type: 'emote',
src: i.url,
),
],
))
],
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
);
}
}

View File

@@ -129,6 +129,7 @@ class ReplyItem extends StatelessWidget {
}
Widget content(BuildContext context) {
if (replyItem?.member == null) return const SizedBox();
final String heroTag = Utils.makeHeroTag(replyItem!.mid);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,