fix: 操作按钮尺寸错误

This commit is contained in:
orz12
2024-03-22 13:41:44 +08:00
parent 9943cc099b
commit fec6a1801d
3 changed files with 50 additions and 56 deletions

View File

@@ -395,12 +395,8 @@ class _BangumiInfoState extends State<BangumiInfo> {
padding: const EdgeInsets.only(top: 1), padding: const EdgeInsets.only(top: 1),
child: SizedBox( child: SizedBox(
height: 48, height: 48,
child: GridView.count( child: Row(
physics: const NeverScrollableScrollPhysics(), mainAxisAlignment: MainAxisAlignment.spaceAround,
primary: false,
padding: EdgeInsets.zero,
crossAxisCount: 5,
childAspectRatio: 1.25,
children: <Widget>[ children: <Widget>[
Obx(() => ActionItem( Obx(() => ActionItem(
icon: const Icon(FontAwesomeIcons.thumbsUp), icon: const Icon(FontAwesomeIcons.thumbsUp),

View File

@@ -493,12 +493,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
return Container( return Container(
margin: const EdgeInsets.only(top: 1), margin: const EdgeInsets.only(top: 1),
height: 48, height: 48,
child: GridView.count( child: Row(
physics: const NeverScrollableScrollPhysics(), mainAxisAlignment: MainAxisAlignment.spaceAround,
primary: false,
padding: EdgeInsets.zero,
crossAxisCount: 5,
childAspectRatio: 1.25,
children: <Widget>[ children: <Widget>[
Obx( Obx(
() => ActionItem( () => ActionItem(

View File

@@ -26,54 +26,56 @@ class ActionItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Semantics( return Expanded(
label: (text ?? "") + (selectStatus ? "" :"") + semanticsLabel, child: Semantics(
child: label: (text ?? "") + (selectStatus ? "" : "") + semanticsLabel,
InkWell( child: InkWell(
onTap: () => { onTap: () => {
feedBack(), feedBack(),
onTap!(), onTap!(),
},
onLongPress: () => {
if (onLongPress != null) {onLongPress!()}
},
borderRadius: StyleString.mdRadius,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// const SizedBox(height: 2),
Icon(
selectStatus
? selectIcon!.icon!
: icon!.icon!,
size: 18,
color: selectStatus
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
),
const SizedBox(height: 3),
AnimatedOpacity(
opacity: loadingStatus! ? 0 : 1,
duration: const Duration(milliseconds: 200),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
}, },
child: Text( onLongPress: () => {
text ?? '', if (onLongPress != null) {onLongPress!()}
key: ValueKey<String>(text ?? ''), },
style: TextStyle( // borderRadius: StyleString.mdRadius,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// const SizedBox(height: 2),
Icon(
selectStatus ? selectIcon!.icon! : icon!.icon!,
size: 18,
color: selectStatus color: selectStatus
? Theme.of(context).colorScheme.primary ? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline, : Theme.of(context).colorScheme.outline,
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize), ),
semanticsLabel: "", const SizedBox(height: 3),
AnimatedOpacity(
opacity: loadingStatus! ? 0 : 1,
duration: const Duration(milliseconds: 200),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
transitionBuilder:
(Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
child: Text(
text ?? '',
key: ValueKey<String>(text ?? ''),
style: TextStyle(
color: selectStatus
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
fontSize: Theme.of(context)
.textTheme
.labelSmall!
.fontSize),
semanticsLabel: "",
),
),
),
],
), ),
), )));
),
],
),
));
} }
} }