mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 15:16:15 +08:00
opt: up panel (#861)
This commit is contained in:
committed by
GitHub
parent
f87957b170
commit
acb3784071
@@ -123,28 +123,34 @@ class _UpPanelState extends State<UpPanel> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget upItemBuild(theme, data) {
|
||||
void _onSelect(UserItem data) {
|
||||
widget.dynamicsController.currentMid = data.mid;
|
||||
widget.dynamicsController.onSelectUp(data.mid);
|
||||
|
||||
data.hasUpdate = false;
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
Widget upItemBuild(ThemeData theme, UserItem data) {
|
||||
bool isCurrent = widget.dynamicsController.currentMid == data.mid ||
|
||||
widget.dynamicsController.currentMid == -1;
|
||||
final isLive = data is LiveUserItem;
|
||||
return SizedBox(
|
||||
height: 76,
|
||||
width: isTop ? 70 : null,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
feedBack();
|
||||
if (data.type == 'up') {
|
||||
widget.dynamicsController.currentMid = data.mid;
|
||||
widget.dynamicsController
|
||||
..upInfo.value = data
|
||||
..onSelectUp(data.mid);
|
||||
|
||||
data.hasUpdate = false;
|
||||
|
||||
setState(() {});
|
||||
} else if (data.type == 'live') {
|
||||
Get.toNamed('/liveRoom?roomid=${data.roomId}');
|
||||
switch (data) {
|
||||
case UpItem():
|
||||
_onSelect(data);
|
||||
break;
|
||||
case LiveUserItem():
|
||||
Get.toNamed('/liveRoom?roomid=${data.roomId}');
|
||||
}
|
||||
},
|
||||
onDoubleTap: data is LiveUserItem ? () => _onSelect(data) : null,
|
||||
onLongPress: () {
|
||||
if (data.mid == -1) {
|
||||
return;
|
||||
@@ -181,16 +187,16 @@ class _UpPanelState extends State<UpPanel> {
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: data.type == 'live' && !isTop ? -5 : 0,
|
||||
right: data.type == 'live' ? -6 : 4,
|
||||
top: isLive && !isTop ? -5 : 0,
|
||||
right: isLive ? -6 : 4,
|
||||
child: Badge(
|
||||
smallSize: 8,
|
||||
label: data.type == 'live' ? const Text(' Live ') : null,
|
||||
label: isLive ? const Text(' Live ') : null,
|
||||
textColor: theme.colorScheme.onSecondaryContainer,
|
||||
alignment: AlignmentDirectional.topStart,
|
||||
isLabelVisible: data.type == 'live' ||
|
||||
(data.type == 'up' && (data.hasUpdate ?? false)),
|
||||
backgroundColor: data.type == 'live'
|
||||
isLabelVisible: isLive ||
|
||||
(data is UpItem && (data.hasUpdate ?? false)),
|
||||
backgroundColor: isLive
|
||||
? theme.colorScheme.secondaryContainer
|
||||
.withValues(alpha: 0.75)
|
||||
: theme.colorScheme.primary,
|
||||
@@ -202,7 +208,7 @@ class _UpPanelState extends State<UpPanel> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
isTop ? '${data.uname}\n' : data.uname,
|
||||
isTop ? '${data.uname}\n' : data.uname!,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
|
||||
Reference in New Issue
Block a user