* tweaks

* opt: semantics
This commit is contained in:
My-Responsitories
2026-06-13 02:43:37 +00:00
committed by GitHub
parent 1c19925b58
commit 199ad274b7
23 changed files with 123 additions and 180 deletions

View File

@@ -44,6 +44,7 @@ class ActionItem extends StatelessWidget {
selectStatus ? selectIcon!.icon! : icon.icon,
size: 18,
color: selectStatus ? primary : icon.color ?? colorScheme.outline,
semanticLabel: semanticsLabel,
);
if (animation != null) {
@@ -53,11 +54,8 @@ class ActionItem extends StatelessWidget {
children: [
AnimatedBuilder(
animation: animation!,
builder: (context, child) => Arc(
size: 28,
color: primary,
progress: -animation!.value,
),
builder: (context, child) =>
Arc(size: 28, color: primary, progress: -animation!.value),
),
child,
],
@@ -69,7 +67,7 @@ class ActionItem extends StatelessWidget {
child = Material(
type: .transparency,
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(6)),
borderRadius: const .all(.circular(6)),
onTap: _isThumbsUp ? null : onTap,
onLongPress: _isThumbsUp ? null : onLongPress,
onSecondaryTap: PlatformUtils.isMobile || _isThumbsUp
@@ -104,9 +102,8 @@ class ActionItem extends StatelessWidget {
if (hasText) {
return AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
transitionBuilder: (child, animation) =>
ScaleTransition(scale: animation, child: child),
child: child,
);
}

View File

@@ -203,17 +203,16 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
}
return _header(theme, firstFloor);
}),
_sortWidget(theme),
_sortWidget(theme.colorScheme),
],
Obx(() => _buildBody(theme, _controller.loadingState.value)),
Obx(
() => _buildBody(theme.colorScheme, _controller.loadingState.value),
),
],
),
);
if (widget.isNested) {
return ExtendedVisibilityDetector(
uniqueKey: Key(_tag),
child: child,
);
return ExtendedVisibilityDetector(uniqueKey: Key(_tag), child: child);
}
return child;
}
@@ -243,9 +242,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
);
}
Widget _sortWidget(ThemeData theme) {
Widget _sortWidget(ColorScheme colorScheme) {
return SliverPinnedHeader(
backgroundColor: theme.colorScheme.surface,
backgroundColor: colorScheme.surface,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 2.5, 6, 2.5),
child: Row(
@@ -265,18 +264,11 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
TextButton.icon(
style: Style.buttonStyle,
onPressed: _controller.queryBySort,
icon: Icon(
Icons.sort,
size: 16,
color: theme.colorScheme.secondary,
),
icon: Icon(Icons.sort, size: 16, color: colorScheme.secondary),
label: Obx(
() => Text(
_controller.sortType.value.text!,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.secondary,
),
style: TextStyle(fontSize: 13, color: colorScheme.secondary),
),
),
),
@@ -287,7 +279,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
}
Widget _buildBody(
ThemeData theme,
ColorScheme colorScheme,
LoadingState<List<ReplyInfo>?> loadingState,
) {
final jumpIndex = _controller.index.value;
@@ -305,15 +297,13 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
return Container(
height: 125,
alignment: Alignment.center,
margin: EdgeInsets.only(
bottom: MediaQuery.viewPaddingOf(context).bottom,
),
margin: .only(bottom: MediaQuery.viewPaddingOf(context).bottom),
child: Text(
_controller.isEnd ? '没有更多了' : '加载中...',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.outline,
color: colorScheme.outline,
),
),
);
@@ -323,13 +313,10 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
return ColoredBoxTransition(
color: _colorAnimation ??= _controller.animController.drive(
ColorTween(
begin: theme.colorScheme.onInverseSurface,
end: theme.colorScheme.surface,
).chain(
CurveTween(
curve: const Interval(0.8, 1.0), // 前0.8s不变, 后0.2s开始动画
),
),
begin: colorScheme.onInverseSurface,
end: colorScheme.surface,
// 前0.8s不变, 后0.2s开始动画
).chain(CurveTween(curve: const Interval(0.8, 1.0))),
),
child: child,
);

View File

@@ -1614,9 +1614,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
return FilledButton.tonal(
style: FilledButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(6),
),
borderRadius: .all(.circular(6)),
),
backgroundColor: themeData
.colorScheme
@@ -1634,9 +1632,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
item,
isStein: true,
);
videoDetailController.getSteinEdgeInfo(
item.id,
);
videoDetailController.getSteinEdgeInfo(item.id);
},
child: Text(item.option!),
);

View File

@@ -1974,9 +1974,7 @@ class HeaderControlState extends State<HeaderControl>
FontAwesomeIcons.thumbsUp,
color: Colors.white,
),
selectIcon: const Icon(
FontAwesomeIcons.solidThumbsUp,
),
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
selectStatus: introController.hasLike.value,
semanticsLabel: '点赞',
animation: introController.tripleAnimation,