mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-21 17:46:24 +08:00
top up panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
||||
import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/up.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/controller.dart';
|
||||
@@ -8,11 +9,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class UpPanel extends StatefulWidget {
|
||||
final DynamicsController dynamicsController;
|
||||
const UpPanel({
|
||||
required this.dynamicsController,
|
||||
super.key,
|
||||
});
|
||||
final DynamicsController dynamicsController;
|
||||
|
||||
@override
|
||||
State<UpPanel> createState() => _UpPanelState();
|
||||
@@ -22,6 +23,8 @@ class _UpPanelState extends State<UpPanel> {
|
||||
List<UpItem>? get upList => widget.dynamicsController.upData.value.upList;
|
||||
List<LiveUserItem>? get liveList =>
|
||||
widget.dynamicsController.upData.value.liveUsers?.items;
|
||||
late final isTop =
|
||||
widget.dynamicsController.upPanelPosition == UpPanelPosition.top;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -30,41 +33,63 @@ class _UpPanelState extends State<UpPanel> {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return CustomScrollView(
|
||||
scrollDirection: isTop ? Axis.horizontal : Axis.vertical,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: widget.dynamicsController.scrollController,
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 45,
|
||||
child: TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
widget.dynamicsController.showLiveItems =
|
||||
!widget.dynamicsController.showLiveItems;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
height: isTop ? 76 : 60,
|
||||
padding: isTop ? const EdgeInsets.symmetric(horizontal: 6) : null,
|
||||
child: Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text:
|
||||
'Live(${widget.dynamicsController.upData.value.liveUsers?.count})',
|
||||
),
|
||||
if (!isTop) ...[
|
||||
const TextSpan(text: '\n'),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Icon(
|
||||
widget.dynamicsController.showLiveItems
|
||||
? Icons.expand_less
|
||||
: Icons.expand_more,
|
||||
size: 12,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
] else
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Icon(
|
||||
widget.dynamicsController.showLiveItems
|
||||
? Icons.keyboard_arrow_right
|
||||
: Icons.keyboard_arrow_left,
|
||||
color: theme.colorScheme.primary,
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'Live(${widget.dynamicsController.upData.value.liveUsers?.count})',
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
Icon(
|
||||
widget.dynamicsController.showLiveItems
|
||||
? Icons.expand_less
|
||||
: Icons.expand_more,
|
||||
size: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
widget.dynamicsController.showLiveItems =
|
||||
!widget.dynamicsController.showLiveItems;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SliverToBoxAdapter(child: SizedBox(height: 10)),
|
||||
if (widget.dynamicsController.showLiveItems &&
|
||||
liveList?.isNotEmpty == true)
|
||||
SliverList.builder(
|
||||
@@ -93,7 +118,7 @@ class _UpPanelState extends State<UpPanel> {
|
||||
return upItemBuild(theme, upList![index]);
|
||||
},
|
||||
),
|
||||
const SliverToBoxAdapter(child: SizedBox(height: 200)),
|
||||
if (!isTop) const SliverToBoxAdapter(child: SizedBox(height: 200)),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -103,6 +128,7 @@ class _UpPanelState extends State<UpPanel> {
|
||||
widget.dynamicsController.currentMid == -1;
|
||||
return SizedBox(
|
||||
height: 76,
|
||||
width: isTop ? 65 : null,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
feedBack();
|
||||
@@ -172,13 +198,13 @@ class _UpPanelState extends State<UpPanel> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
const SizedBox(height: 4),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
data.uname,
|
||||
overflow: TextOverflow.clip,
|
||||
maxLines: 2,
|
||||
maxLines: isTop ? 1 : 2,
|
||||
softWrap: true,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
|
||||
Reference in New Issue
Block a user