mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 11:22:16 +08:00
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPlus/common/widgets/avatars.dart';
|
||||
import 'package:PiliPlus/common/widgets/flutter/dyn/ink_well.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
@@ -93,39 +94,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
height: 1,
|
||||
color: theme.dividerColor.withValues(alpha: 0.1),
|
||||
),
|
||||
InkWell(
|
||||
onTap: onUnfold,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 13,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
strutStyle: const StrutStyle(
|
||||
height: 1,
|
||||
leading: 0,
|
||||
fontSize: 13,
|
||||
),
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(text: moduleFold.statement ?? '展开'),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Icon(
|
||||
size: 19,
|
||||
Icons.keyboard_arrow_down,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildFoldItem(theme, moduleFold),
|
||||
],
|
||||
] else if (!isSave)
|
||||
const SizedBox(height: 12),
|
||||
@@ -216,4 +185,52 @@ class DynamicPanel extends StatelessWidget {
|
||||
bvid: bvid,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFoldItem(ThemeData theme, ModuleFold moduleFold) {
|
||||
Widget child = Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 13,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
strutStyle: const StrutStyle(
|
||||
height: 1,
|
||||
leading: 0,
|
||||
fontSize: 13,
|
||||
),
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(text: moduleFold.statement ?? '展开'),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Icon(
|
||||
size: 19,
|
||||
Icons.keyboard_arrow_down,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
final users = moduleFold.users;
|
||||
if (users != null && users.isNotEmpty) {
|
||||
child = Row(
|
||||
spacing: 5,
|
||||
mainAxisAlignment: .center,
|
||||
children: [
|
||||
avatars(colorScheme: theme.colorScheme, users: users),
|
||||
child,
|
||||
],
|
||||
);
|
||||
}
|
||||
return InkWell(
|
||||
onTap: onUnfold,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/avatars.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/dialog/report.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
@@ -149,51 +150,6 @@ class _VotePanelState extends State<VotePanel> {
|
||||
Obx(() {
|
||||
final list = followeeVote.value;
|
||||
if (list != null && list.isNotEmpty) {
|
||||
Widget child;
|
||||
const size = 22.0;
|
||||
const gap = 6.0;
|
||||
const offset = size - gap;
|
||||
if (list.length == 1) {
|
||||
child = NetworkImgLayer(
|
||||
src: list.first.face,
|
||||
width: size,
|
||||
height: size,
|
||||
);
|
||||
} else {
|
||||
final decoration = BoxDecoration(
|
||||
shape: .circle,
|
||||
border: Border.all(color: theme.colorScheme.surface),
|
||||
);
|
||||
child = SizedBox(
|
||||
height: size,
|
||||
width: offset * min(3, list.length) + gap,
|
||||
child: Stack(
|
||||
clipBehavior: .none,
|
||||
children: list
|
||||
.take(3)
|
||||
.indexed
|
||||
.map(
|
||||
(e) => Positioned(
|
||||
top: 0,
|
||||
left: e.$1 * offset,
|
||||
bottom: 0,
|
||||
child: DecoratedBox(
|
||||
decoration: decoration,
|
||||
child: Padding(
|
||||
padding: const .all(.8),
|
||||
child: NetworkImgLayer(
|
||||
src: e.$2.face,
|
||||
width: size - .8,
|
||||
height: size - .8,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
return GestureDetector(
|
||||
behavior: .opaque,
|
||||
onTap: () {
|
||||
@@ -213,7 +169,7 @@ class _VotePanelState extends State<VotePanel> {
|
||||
(e) => ListTile(
|
||||
dense: true,
|
||||
onTap: () =>
|
||||
Get.toNamed('/member?mid=${e.uid}'),
|
||||
Get.toNamed('/member?mid=${e.mid}'),
|
||||
leading: NetworkImgLayer(
|
||||
src: e.face,
|
||||
width: 40,
|
||||
@@ -259,7 +215,10 @@ class _VotePanelState extends State<VotePanel> {
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
child,
|
||||
avatars(
|
||||
colorScheme: theme.colorScheme,
|
||||
users: list.take(3),
|
||||
),
|
||||
Icon(
|
||||
size: 18,
|
||||
color: theme.colorScheme.outline.withValues(alpha: .7),
|
||||
|
||||
Reference in New Issue
Block a user