Skip to content

Commit

Permalink
fix(post): Fix hero animation when back from thread to notification
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Jul 8, 2024
1 parent 6480703 commit 4436b89
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- 关于:修复提交次数记录一直为1的问题。
- 主页:修复宽屏设备中侧边栏边框弧度问题。
- 设置:修复某些情况下Windows上本地更新日志乱码的问题。
- 通知:修复从通知进入对应帖子后,再返回通知界面时用户名称动画错误的问题。

### Changed

Expand Down
5 changes: 5 additions & 0 deletions lib/widgets/card/post_card/post_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ class _PostCardState extends State<PostCard>
},
child: Hero(
tag: nameHeroTag,
flightShuttleBuilder: (_, __, ___, ____, toHeroContext) =>
DefaultTextStyle(
style: DefaultTextStyle.of(toHeroContext).style,
child: toHeroContext.widget,
),
child: Text(widget.post.author.name),
),
),
Expand Down
10 changes: 9 additions & 1 deletion lib/widgets/heroes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ final class HeroUserAvatar extends StatelessWidget {
if (disableHero) {
return avatar;
}
return Hero(tag: heroTag ?? 'UserAvatar_$username', child: avatar);
return Hero(
tag: heroTag ?? 'UserAvatar_$username',
flightShuttleBuilder: (_, __, ___, ____, toHeroContext) =>
DefaultTextStyle(
style: DefaultTextStyle.of(toHeroContext).style,
child: toHeroContext.widget,
),
child: avatar,
);
}
}

0 comments on commit 4436b89

Please sign in to comment.