mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
fix: up panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -39,6 +39,9 @@ class DynamicsController extends GetxController
|
|||||||
int allFollowedUpsPage = 1;
|
int allFollowedUpsPage = 1;
|
||||||
int allFollowedUpsTotal = 0;
|
int allFollowedUpsTotal = 0;
|
||||||
|
|
||||||
|
late int currentMid = -1;
|
||||||
|
late bool showLiveItems = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|||||||
@@ -20,13 +20,11 @@ class UpPanel extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _UpPanelState extends State<UpPanel> {
|
class _UpPanelState extends State<UpPanel> {
|
||||||
int currentMid = -1;
|
|
||||||
List<UpItem> get upList =>
|
List<UpItem> get upList =>
|
||||||
widget.dynamicsController.upData.value.upList ?? <UpItem>[];
|
widget.dynamicsController.upData.value.upList ?? <UpItem>[];
|
||||||
List<LiveUserItem> get liveList =>
|
List<LiveUserItem> get liveList =>
|
||||||
widget.dynamicsController.upData.value.liveUsers?.items ??
|
widget.dynamicsController.upData.value.liveUsers?.items ??
|
||||||
<LiveUserItem>[];
|
<LiveUserItem>[];
|
||||||
bool _showLiveItems = false;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -53,17 +51,20 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
),
|
),
|
||||||
semanticsLabel:
|
semanticsLabel:
|
||||||
'${_showLiveItems ? '展开' : '收起'}直播中的${liveList.length}个Up',
|
'${widget.dynamicsController.showLiveItems ? '展开' : '收起'}直播中的${liveList.length}个Up',
|
||||||
),
|
),
|
||||||
Icon(
|
Icon(
|
||||||
_showLiveItems ? Icons.expand_less : Icons.expand_more,
|
widget.dynamicsController.showLiveItems
|
||||||
|
? Icons.expand_less
|
||||||
|
: Icons.expand_more,
|
||||||
size: 12,
|
size: 12,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_showLiveItems = !_showLiveItems;
|
widget.dynamicsController.showLiveItems =
|
||||||
|
!widget.dynamicsController.showLiveItems;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -81,7 +82,8 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
),
|
),
|
||||||
delegate: SliverChildListDelegate(
|
delegate: SliverChildListDelegate(
|
||||||
[
|
[
|
||||||
if (_showLiveItems && liveList.isNotEmpty) ...[
|
if (widget.dynamicsController.showLiveItems &&
|
||||||
|
liveList.isNotEmpty) ...[
|
||||||
for (int i = 0; i < liveList.length; i++) ...[
|
for (int i = 0; i < liveList.length; i++) ...[
|
||||||
upItemBuild(liveList[i], i)
|
upItemBuild(liveList[i], i)
|
||||||
],
|
],
|
||||||
@@ -109,12 +111,13 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget upItemBuild(data, i) {
|
Widget upItemBuild(data, i) {
|
||||||
bool isCurrent = currentMid == data.mid || currentMid == -1;
|
bool isCurrent = widget.dynamicsController.currentMid == data.mid ||
|
||||||
|
widget.dynamicsController.currentMid == -1;
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
feedBack();
|
feedBack();
|
||||||
if (data.type == 'up') {
|
if (data.type == 'up') {
|
||||||
currentMid = data.mid;
|
widget.dynamicsController.currentMid = data.mid;
|
||||||
// dynamicsController.mid.value = data.mid;
|
// dynamicsController.mid.value = data.mid;
|
||||||
widget.dynamicsController
|
widget.dynamicsController
|
||||||
..upInfo.value = data
|
..upInfo.value = data
|
||||||
@@ -218,7 +221,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
softWrap: true,
|
softWrap: true,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: currentMid == data.mid
|
color: widget.dynamicsController.currentMid == data.mid
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.outline,
|
: Theme.of(context).colorScheme.outline,
|
||||||
height: 1.1,
|
height: 1.1,
|
||||||
|
|||||||
Reference in New Issue
Block a user