Skip to content

Commit

Permalink
fix: 操作按钮尺寸错误
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Mar 22, 2024
1 parent 9943cc0 commit fec6a18
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 56 deletions.
8 changes: 2 additions & 6 deletions lib/pages/bangumi/introduction/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,8 @@ class _BangumiInfoState extends State<BangumiInfo> {
padding: const EdgeInsets.only(top: 1),
child: SizedBox(
height: 48,
child: GridView.count(
physics: const NeverScrollableScrollPhysics(),
primary: false,
padding: EdgeInsets.zero,
crossAxisCount: 5,
childAspectRatio: 1.25,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Obx(() => ActionItem(
icon: const Icon(FontAwesomeIcons.thumbsUp),
Expand Down
8 changes: 2 additions & 6 deletions lib/pages/video/detail/introduction/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
return Container(
margin: const EdgeInsets.only(top: 1),
height: 48,
child: GridView.count(
physics: const NeverScrollableScrollPhysics(),
primary: false,
padding: EdgeInsets.zero,
crossAxisCount: 5,
childAspectRatio: 1.25,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Obx(
() => ActionItem(
Expand Down
90 changes: 46 additions & 44 deletions lib/pages/video/detail/introduction/widgets/action_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,56 @@ class ActionItem extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Semantics(
label: (text ?? "") + (selectStatus ? "已" :"") + semanticsLabel,
child:
InkWell(
onTap: () => {
feedBack(),
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);
return Expanded(
child: Semantics(
label: (text ?? "") + (selectStatus ? "已" : "") + semanticsLabel,
child: InkWell(
onTap: () => {
feedBack(),
onTap!(),
},
child: Text(
text ?? '',
key: ValueKey<String>(text ?? ''),
style: TextStyle(
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,
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: "",
),
),
),
],
),
),
),
],
),
));
)));
}
}

0 comments on commit fec6a18

Please sign in to comment.