mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 18:16:54 +08:00
tweaks (#1142)
* opt: unused layout * mod: semantics * opt: DanmakuMsg type * opt: avoid cast * opt: unnecessary_lambdas * opt: use isEven * opt: logger * opt: invalid common page * tweak * opt: unify DynController
This commit is contained in:
committed by
GitHub
parent
56ffc2781f
commit
5f8313901b
@@ -980,9 +980,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
updateFocusHighlights();
|
||||
});
|
||||
setState(updateFocusHighlights);
|
||||
}
|
||||
|
||||
bool get _shouldShowFocus =>
|
||||
|
||||
@@ -47,24 +47,32 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final noRadius = type == ImageType.emote || radius == 0;
|
||||
final Widget child;
|
||||
|
||||
if (src?.isNotEmpty == true) {
|
||||
Widget child = _buildImage(context, noRadius);
|
||||
if (noRadius) {
|
||||
return child;
|
||||
}
|
||||
if (type == ImageType.avatar) {
|
||||
return ClipOval(child: child);
|
||||
}
|
||||
return ClipRRect(
|
||||
borderRadius: radius != null
|
||||
? BorderRadius.circular(radius!)
|
||||
: StyleString.mdRadius,
|
||||
child: child,
|
||||
);
|
||||
child = noRadius
|
||||
? _buildImage(context, noRadius)
|
||||
: type == ImageType.avatar
|
||||
? ClipOval(child: _buildImage(context, noRadius))
|
||||
: ClipRRect(
|
||||
borderRadius: radius != null
|
||||
? BorderRadius.circular(radius!)
|
||||
: StyleString.mdRadius,
|
||||
child: _buildImage(context, noRadius),
|
||||
);
|
||||
} else {
|
||||
child = getPlaceHolder?.call() ?? _placeholder(context, noRadius);
|
||||
}
|
||||
|
||||
return getPlaceHolder?.call() ?? _placeholder(context, noRadius);
|
||||
return semanticsLabel?.isNotEmpty == true
|
||||
? Semantics(
|
||||
container: true,
|
||||
image: true,
|
||||
excludeSemantics: true,
|
||||
label: semanticsLabel,
|
||||
child: child,
|
||||
)
|
||||
: child;
|
||||
}
|
||||
|
||||
Widget _buildImage(BuildContext context, bool noRadius) {
|
||||
|
||||
@@ -244,9 +244,7 @@ class _CustomTabBarViewState extends State<CustomTabBarView> {
|
||||
);
|
||||
}
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_updateChildren();
|
||||
});
|
||||
setState(_updateChildren);
|
||||
}
|
||||
return Future<void>.value();
|
||||
}
|
||||
@@ -286,9 +284,7 @@ class _CustomTabBarViewState extends State<CustomTabBarView> {
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_updateChildren();
|
||||
});
|
||||
setState(_updateChildren);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ class StatWidget extends StatelessWidget {
|
||||
children: [
|
||||
Icon(
|
||||
type.iconData,
|
||||
semanticLabel: type.label,
|
||||
size: iconSize,
|
||||
color: color,
|
||||
),
|
||||
|
||||
@@ -238,9 +238,7 @@ class _CustomTabBarViewState extends State<CustomTabBarView> {
|
||||
);
|
||||
}
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_updateChildren();
|
||||
});
|
||||
setState(_updateChildren);
|
||||
}
|
||||
return Future<void>.value();
|
||||
}
|
||||
@@ -280,9 +278,7 @@ class _CustomTabBarViewState extends State<CustomTabBarView> {
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_updateChildren();
|
||||
});
|
||||
setState(_updateChildren);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,6 +190,7 @@ class VideoCardV extends StatelessWidget {
|
||||
videoItem.owner.name.toString(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.clip,
|
||||
semanticsLabel: 'UP:${videoItem.owner.name}',
|
||||
style: TextStyle(
|
||||
height: 1.5,
|
||||
fontSize: theme.textTheme.labelMedium!.fontSize,
|
||||
@@ -234,8 +235,8 @@ class VideoCardV extends StatelessWidget {
|
||||
),
|
||||
text: DateUtil.dateFormat(
|
||||
videoItem.pubdate,
|
||||
shortFormat: shortFormat,
|
||||
longFormat: longFormat,
|
||||
short: shortFormat,
|
||||
long: longFormat,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user