mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-27 12:36:27 +08:00
opt: replace SizedBox with spacing (#863)
This commit is contained in:
committed by
GitHub
parent
218e829fd4
commit
1efd62803a
@@ -177,8 +177,9 @@ class VideoCardV extends StatelessWidget {
|
||||
),
|
||||
videoStat(context, theme),
|
||||
Row(
|
||||
spacing: 2,
|
||||
children: [
|
||||
if (videoItem.goto == 'bangumi') ...[
|
||||
if (videoItem.goto == 'bangumi')
|
||||
PBadge(
|
||||
text: videoItem.bangumiBadge,
|
||||
isStack: false,
|
||||
@@ -186,18 +187,14 @@ class VideoCardV extends StatelessWidget {
|
||||
type: PBadgeType.line_primary,
|
||||
fontSize: 9,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
],
|
||||
if (videoItem.rcmdReason != null) ...[
|
||||
if (videoItem.rcmdReason != null)
|
||||
PBadge(
|
||||
text: videoItem.rcmdReason,
|
||||
isStack: false,
|
||||
size: PBadgeSize.small,
|
||||
type: PBadgeType.secondary,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
],
|
||||
if (videoItem.goto == 'picture') ...[
|
||||
if (videoItem.goto == 'picture')
|
||||
const PBadge(
|
||||
text: '动态',
|
||||
isStack: false,
|
||||
@@ -205,17 +202,13 @@ class VideoCardV extends StatelessWidget {
|
||||
type: PBadgeType.line_primary,
|
||||
fontSize: 9,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
],
|
||||
if (videoItem.isFollowed) ...[
|
||||
if (videoItem.isFollowed)
|
||||
const PBadge(
|
||||
text: '已关注',
|
||||
isStack: false,
|
||||
size: PBadgeSize.small,
|
||||
type: PBadgeType.secondary,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
],
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
|
||||
@@ -274,6 +274,7 @@ class OpusContent extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: switch (element.linkCard?.card?.type) {
|
||||
'LINK_CARD_TYPE_UGC' => Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
radius: 6,
|
||||
@@ -281,7 +282,6 @@ class OpusContent extends StatelessWidget {
|
||||
height: 65,
|
||||
src: element.linkCard!.card!.ugc!.cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -309,6 +309,7 @@ class OpusContent extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
'LINK_CARD_TYPE_COMMON' => Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
radius: 6,
|
||||
@@ -316,7 +317,6 @@ class OpusContent extends StatelessWidget {
|
||||
height: 65,
|
||||
src: element.linkCard!.card!.common!.cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -346,6 +346,7 @@ class OpusContent extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
'LINK_CARD_TYPE_LIVE' => Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
radius: 6,
|
||||
@@ -353,7 +354,6 @@ class OpusContent extends StatelessWidget {
|
||||
height: 65,
|
||||
src: element.linkCard!.card!.live!.cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -384,6 +384,7 @@ class OpusContent extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
'LINK_CARD_TYPE_OPUS' => Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
radius: 6,
|
||||
@@ -391,7 +392,6 @@ class OpusContent extends StatelessWidget {
|
||||
height: 65,
|
||||
src: element.linkCard!.card!.opus!.cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -410,6 +410,7 @@ class OpusContent extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
'LINK_CARD_TYPE_VOTE' => Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -426,7 +427,6 @@ class OpusContent extends StatelessWidget {
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -445,6 +445,7 @@ class OpusContent extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
'LINK_CARD_TYPE_MUSIC' => Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
radius: 6,
|
||||
@@ -452,7 +453,6 @@ class OpusContent extends StatelessWidget {
|
||||
height: 65,
|
||||
src: element.linkCard!.card!.music!.cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -482,6 +482,7 @@ class OpusContent extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
radius: 6,
|
||||
@@ -489,7 +490,6 @@ class OpusContent extends StatelessWidget {
|
||||
height: 65,
|
||||
src: e.cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
@@ -694,20 +694,18 @@ Widget moduleBlockedItem(
|
||||
decoration: bgImg(),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
if (moduleBlocked.icon != null) ...[
|
||||
icon(42),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
if (moduleBlocked.icon != null) icon(42),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: 2,
|
||||
children: [
|
||||
if (moduleBlocked.title?.isNotEmpty == true)
|
||||
Text(moduleBlocked.title!),
|
||||
if (moduleBlocked.hintMessage?.isNotEmpty == true) ...[
|
||||
const SizedBox(height: 2),
|
||||
if (moduleBlocked.hintMessage?.isNotEmpty == true)
|
||||
Text(
|
||||
moduleBlocked.hintMessage!,
|
||||
style: TextStyle(
|
||||
@@ -715,12 +713,10 @@ Widget moduleBlockedItem(
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
if (moduleBlocked.button != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
if (moduleBlocked.button != null)
|
||||
btn(
|
||||
visualDensity: const VisualDensity(vertical: -3, horizontal: -4),
|
||||
shape: const RoundedRectangleBorder(
|
||||
@@ -728,7 +724,6 @@ Widget moduleBlockedItem(
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -408,8 +408,9 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
if (cover?.isNotEmpty == true) ...[
|
||||
if (cover?.isNotEmpty == true)
|
||||
AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(
|
||||
@@ -444,17 +445,14 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
] else if (isCurrentIndex) ...[
|
||||
)
|
||||
else if (isCurrentIndex)
|
||||
Image.asset(
|
||||
'assets/images/live.png',
|
||||
color: primary,
|
||||
height: 12,
|
||||
semanticLabel: "正在播放:",
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -83,10 +83,9 @@ class SearchArticleController
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
const Text('排序', style: TextStyle(fontSize: 16)),
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
@@ -115,9 +114,7 @@ class SearchArticleController
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text('分区', style: TextStyle(fontSize: 16)),
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
|
||||
@@ -74,7 +74,7 @@ class _LogsPageState extends State<LogsPage> {
|
||||
}
|
||||
return l;
|
||||
})
|
||||
.where((dynamic l) => l.replaceAll("\n", "").trim().isNotEmpty)
|
||||
.where((l) => l.replaceAll("\n", "").trim().isNotEmpty)
|
||||
.join("\n");
|
||||
if (date != null || body != '') {
|
||||
result.add({'date': date, 'body': body, 'expand': false});
|
||||
@@ -159,8 +159,10 @@ class _LogsPageState extends State<LogsPage> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: 5,
|
||||
children: [
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Text(
|
||||
log['date'].toString(),
|
||||
@@ -171,7 +173,6 @@ class _LogsPageState extends State<LogsPage> {
|
||||
.fontSize,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
TextButton.icon(
|
||||
style: TextButton.styleFrom(
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
@@ -195,7 +196,6 @@ class _LogsPageState extends State<LogsPage> {
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Card(
|
||||
elevation: 1,
|
||||
margin: EdgeInsets.zero,
|
||||
|
||||
@@ -85,6 +85,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
@@ -121,7 +122,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => widget.showIntroDetail(
|
||||
@@ -135,6 +135,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 20,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -146,7 +147,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Obx(
|
||||
() => FilledButton.tonal(
|
||||
style: FilledButton.styleFrom(
|
||||
@@ -204,6 +204,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
],
|
||||
),
|
||||
Row(
|
||||
spacing: 6,
|
||||
children: [
|
||||
StatView(
|
||||
context: context,
|
||||
@@ -211,7 +212,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
value:
|
||||
Utils.numFormat(bangumiItem.stat!['views']),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
@@ -219,9 +219,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
bangumiItem.stat!['danmakus']),
|
||||
),
|
||||
if (isLandscape) ...[
|
||||
const SizedBox(width: 6),
|
||||
areasAndPubTime(theme, bangumiItem),
|
||||
const SizedBox(width: 6),
|
||||
newEpDesc(theme, bangumiItem),
|
||||
]
|
||||
],
|
||||
@@ -366,6 +364,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
VideoDetailController videoDetailCtr,
|
||||
) {
|
||||
return Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Obx(
|
||||
() => ActionRowItem(
|
||||
@@ -376,7 +375,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
text: bangumiItem.stat!['likes']!.toString(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Obx(
|
||||
() => ActionRowItem(
|
||||
icon: const Icon(FontAwesomeIcons.b),
|
||||
@@ -386,7 +384,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
text: bangumiItem.stat!['coins']!.toString(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Obx(
|
||||
() => ActionRowItem(
|
||||
icon: const Icon(FontAwesomeIcons.heart),
|
||||
@@ -398,7 +395,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
text: bangumiItem.stat!['favorite']!.toString(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ActionRowItem(
|
||||
icon: const Icon(FontAwesomeIcons.comment),
|
||||
onTap: () {
|
||||
@@ -408,7 +404,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
isLoading: false,
|
||||
text: bangumiItem.stat!['reply']!.toString(),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ActionRowItem(
|
||||
icon: const Icon(FontAwesomeIcons.share),
|
||||
onTap: () => bangumiIntroController.actionShareVideo(context),
|
||||
@@ -422,6 +417,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
|
||||
Widget areasAndPubTime(ThemeData theme, BangumiInfoModel bangumiItem) {
|
||||
return Row(
|
||||
spacing: 6,
|
||||
children: [
|
||||
Text(
|
||||
(bangumiItem.areas!.isNotEmpty
|
||||
@@ -432,7 +428,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiItem.publish!['pub_time_show'],
|
||||
style: TextStyle(
|
||||
|
||||
@@ -192,15 +192,16 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 12,
|
||||
children: [
|
||||
lfAvtar(),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: 6,
|
||||
children: [
|
||||
Text(
|
||||
replyItem.member.name,
|
||||
@@ -212,13 +213,11 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Image.asset(
|
||||
'assets/images/lv/lv${replyItem.member.isSeniorMember == 1 ? '6_s' : replyItem.member.level}.png',
|
||||
height: 11,
|
||||
semanticLabel: "等级:${replyItem.member.level}",
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
if (replyItem.mid == upMid)
|
||||
const PBadge(
|
||||
text: 'UP',
|
||||
|
||||
@@ -269,6 +269,7 @@ class ChatItem extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 6,
|
||||
children: [
|
||||
Text(
|
||||
content['main_title'],
|
||||
@@ -279,8 +280,7 @@ class ChatItem extends StatelessWidget {
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
for (var i in content['sub_cards']) ...[
|
||||
const SizedBox(height: 6),
|
||||
for (var i in content['sub_cards'])
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
RegExp bvRegex =
|
||||
@@ -309,13 +309,13 @@ class ChatItem extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
spacing: 6,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 130,
|
||||
height: 130 * 9 / 16,
|
||||
src: i['cover_url'],
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -354,7 +354,6 @@ class ChatItem extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user