mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-22 11:41:09 +08:00
@@ -29,8 +29,10 @@ class MatchInfoPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
final _controller =
|
||||
Get.put(MatchInfoController(), tag: Utils.generateRandomString(8));
|
||||
final _controller = Get.put(
|
||||
MatchInfoController(),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -48,10 +50,12 @@ class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
Obx(() => _buildInfo(theme, _controller.infoState.value)),
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 80),
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||
),
|
||||
sliver: Obx(
|
||||
() => _buildReply(theme, _controller.loadingState.value)),
|
||||
)
|
||||
() => _buildReply(theme, _controller.loadingState.value),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -88,7 +92,7 @@ class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
src: 'https://i1.hdslb.com${team.logo}',
|
||||
type: ImageType.emote,
|
||||
),
|
||||
Text(team.title!)
|
||||
Text(team.title!),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -102,7 +106,8 @@ class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'${data.season?.title ?? ''} ${data.gameStage ?? ''}'),
|
||||
'${data.season?.title ?? ''} ${data.gameStage ?? ''}',
|
||||
),
|
||||
),
|
||||
Row(
|
||||
spacing: 20,
|
||||
@@ -140,30 +145,38 @@ class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
if (data.contestStatus == 2)
|
||||
FilledButton.tonal(
|
||||
style: FilledButton.styleFrom(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 12),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6),
|
||||
),
|
||||
),
|
||||
visualDensity: VisualDensity.compact,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
onPressed: () => Get.toNamed(
|
||||
'/liveRoom?roomid=${data.liveRoom}'),
|
||||
'/liveRoom?roomid=${data.liveRoom}',
|
||||
),
|
||||
child: const Text('看直播'),
|
||||
)
|
||||
else if (data.contestStatus == 3)
|
||||
Text(
|
||||
'${DateUtil.dateFormat(data.stime)}${data.contestStatus == 3 ? ' 已结束' : ''}',
|
||||
style:
|
||||
TextStyle(color: theme.colorScheme.outline),
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
)
|
||||
else if (data.contestStatus == 1)
|
||||
Text(
|
||||
DateUtil.format(data.stime,
|
||||
format: DateFormat('yy-MM-dd HH:mm')),
|
||||
style:
|
||||
TextStyle(color: theme.colorScheme.outline),
|
||||
DateUtil.format(
|
||||
data.stime,
|
||||
format: DateFormat('yy-MM-dd HH:mm'),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -175,7 +188,7 @@ class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -189,52 +202,55 @@ class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
}
|
||||
|
||||
Widget _buildReply(
|
||||
ThemeData theme, LoadingState<List<ReplyInfo>?> loadingState) {
|
||||
ThemeData theme,
|
||||
LoadingState<List<ReplyInfo>?> loadingState,
|
||||
) {
|
||||
return switch (loadingState) {
|
||||
Loading() => SliverList.builder(
|
||||
itemBuilder: (context, index) => const VideoReplySkeleton(),
|
||||
itemCount: 8,
|
||||
),
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? SliverMainAxisGroup(
|
||||
slivers: [
|
||||
_buildHeader(theme),
|
||||
SliverList.builder(
|
||||
itemCount: response!.length,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return ReplyItemGrpc(
|
||||
replyItem: response[index],
|
||||
replyLevel: 1,
|
||||
replyReply: (replyItem, id) =>
|
||||
replyReply(context, replyItem, id),
|
||||
onReply: (replyItem) => _controller.onReply(
|
||||
context,
|
||||
replyItem: replyItem,
|
||||
),
|
||||
onDelete: (item, subIndex) =>
|
||||
_controller.onRemove(index, item, subIndex),
|
||||
upMid: _controller.upMid,
|
||||
onCheckReply: (item) =>
|
||||
_controller.onCheckReply(item, isManual: true),
|
||||
onToggleTop: (item) => _controller.onToggleTop(
|
||||
item,
|
||||
index,
|
||||
_controller.cid,
|
||||
_controller.replyType,
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
: HttpError(onReload: _controller.onReload),
|
||||
itemBuilder: (context, index) => const VideoReplySkeleton(),
|
||||
itemCount: 8,
|
||||
),
|
||||
Success(:var response) =>
|
||||
response?.isNotEmpty == true
|
||||
? SliverMainAxisGroup(
|
||||
slivers: [
|
||||
_buildHeader(theme),
|
||||
SliverList.builder(
|
||||
itemCount: response!.length,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return ReplyItemGrpc(
|
||||
replyItem: response[index],
|
||||
replyLevel: 1,
|
||||
replyReply: (replyItem, id) =>
|
||||
replyReply(context, replyItem, id),
|
||||
onReply: (replyItem) => _controller.onReply(
|
||||
context,
|
||||
replyItem: replyItem,
|
||||
),
|
||||
onDelete: (item, subIndex) =>
|
||||
_controller.onRemove(index, item, subIndex),
|
||||
upMid: _controller.upMid,
|
||||
onCheckReply: (item) =>
|
||||
_controller.onCheckReply(item, isManual: true),
|
||||
onToggleTop: (item) => _controller.onToggleTop(
|
||||
item,
|
||||
index,
|
||||
_controller.cid,
|
||||
_controller.replyType,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
: HttpError(onReload: _controller.onReload),
|
||||
Error(:var errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -279,8 +295,11 @@ class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
duration: const Duration(milliseconds: 400),
|
||||
transitionBuilder:
|
||||
(Widget child, Animation<double> animation) {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
},
|
||||
return ScaleTransition(
|
||||
scale: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'${count == -1 ? 0 : NumUtil.numFormat(count)}条回复',
|
||||
key: ValueKey<int>(count),
|
||||
@@ -298,15 +317,17 @@ class _MatchInfoPageState extends State<MatchInfoPage> {
|
||||
size: 16,
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
label: Obx(() => Text(
|
||||
_controller.sortType.value.label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
)),
|
||||
label: Obx(
|
||||
() => Text(
|
||||
_controller.sortType.value.label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user