mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-23 20:49:26 +01:00
chore: Add fancy hero animations
This commit is contained in:
parent
b76453483e
commit
d25d8cc1c2
@ -39,11 +39,14 @@ class ChatAppBarTitle extends StatelessWidget {
|
|||||||
: () => VRouter.of(context).toSegments(['rooms', room.id, 'details']),
|
: () => VRouter.of(context).toSegments(['rooms', room.id, 'details']),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Avatar(
|
Hero(
|
||||||
|
tag: 'content_banner',
|
||||||
|
child: Avatar(
|
||||||
mxContent: room.avatar,
|
mxContent: room.avatar,
|
||||||
name: room.displayname,
|
name: room.displayname,
|
||||||
size: 32,
|
size: 32,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -119,7 +119,7 @@ class StoriesHeader extends StatelessWidget {
|
|||||||
...client.storiesRooms..remove(ownStoryRoom),
|
...client.storiesRooms..remove(ownStoryRoom),
|
||||||
];
|
];
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 106,
|
height: 98,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 2),
|
padding: const EdgeInsets.symmetric(horizontal: 2),
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
@ -145,6 +145,7 @@ class StoriesHeader extends StatelessWidget {
|
|||||||
avatarUrl: avatarUrl,
|
avatarUrl: avatarUrl,
|
||||||
userId: userId ?? 'Unknown',
|
userId: userId ?? 'Unknown',
|
||||||
),
|
),
|
||||||
|
heroTag: 'stories_${room.id}',
|
||||||
hasPosts: room.hasPosts || room == ownStoryRoom,
|
hasPosts: room.hasPosts || room == ownStoryRoom,
|
||||||
showEditFab: userId == client.userID,
|
showEditFab: userId == client.userID,
|
||||||
unread: room.membership == Membership.invite ||
|
unread: room.membership == Membership.invite ||
|
||||||
@ -186,10 +187,12 @@ class _StoryButton extends StatelessWidget {
|
|||||||
final bool hasPosts;
|
final bool hasPosts;
|
||||||
final void Function() onPressed;
|
final void Function() onPressed;
|
||||||
final void Function()? onLongPressed;
|
final void Function()? onLongPressed;
|
||||||
|
final String heroTag;
|
||||||
|
|
||||||
const _StoryButton({
|
const _StoryButton({
|
||||||
required this.profile,
|
required this.profile,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
|
required this.heroTag,
|
||||||
this.showEditFab = false,
|
this.showEditFab = false,
|
||||||
this.hasPosts = true,
|
this.hasPosts = true,
|
||||||
this.unread = false,
|
this.unread = false,
|
||||||
@ -246,6 +249,8 @@ class _StoryButton extends StatelessWidget {
|
|||||||
Theme.of(context).colorScheme.surface,
|
Theme.of(context).colorScheme.surface,
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
Theme.of(context).textTheme.bodyText1?.color,
|
Theme.of(context).textTheme.bodyText1?.color,
|
||||||
|
child: Hero(
|
||||||
|
tag: heroTag,
|
||||||
child: Avatar(
|
child: Avatar(
|
||||||
mxContent: profile.avatarUrl,
|
mxContent: profile.avatarUrl,
|
||||||
name: profile.displayName,
|
name: profile.displayName,
|
||||||
@ -255,6 +260,7 @@ class _StoryButton extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
if (showEditFab)
|
if (showEditFab)
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 0,
|
right: 0,
|
||||||
|
@ -83,11 +83,14 @@ class StoryView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
leading: Avatar(
|
leading: Hero(
|
||||||
|
tag: 'stories_${controller.roomId}',
|
||||||
|
child: Avatar(
|
||||||
mxContent: controller.avatar,
|
mxContent: controller.avatar,
|
||||||
name: controller.title,
|
name: controller.title,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
actions: currentEvent == null
|
actions: currentEvent == null
|
||||||
? null
|
? null
|
||||||
: [
|
: [
|
||||||
|
@ -54,10 +54,7 @@ class Avatar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
final borderRadius = BorderRadius.circular(size / 2);
|
final borderRadius = BorderRadius.circular(size / 2);
|
||||||
return InkWell(
|
final container = Container(
|
||||||
onTap: onTap,
|
|
||||||
borderRadius: borderRadius,
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: Theme.of(context).dividerColor),
|
border: Border.all(color: Theme.of(context).dividerColor),
|
||||||
borderRadius: borderRadius,
|
borderRadius: borderRadius,
|
||||||
@ -67,9 +64,8 @@ class Avatar extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: size,
|
width: size,
|
||||||
height: size,
|
height: size,
|
||||||
color: noPic
|
color:
|
||||||
? name?.lightColor
|
noPic ? name?.lightColor : Theme.of(context).secondaryHeaderColor,
|
||||||
: Theme.of(context).secondaryHeaderColor,
|
|
||||||
child: noPic
|
child: noPic
|
||||||
? textWidget
|
? textWidget
|
||||||
: CachedNetworkImage(
|
: CachedNetworkImage(
|
||||||
@ -86,7 +82,12 @@ class Avatar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
if (onTap == null) return container;
|
||||||
|
return InkWell(
|
||||||
|
onTap: onTap,
|
||||||
|
borderRadius: borderRadius,
|
||||||
|
child: container,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ class ContentBanner extends StatelessWidget {
|
|||||||
final void Function()? onEdit;
|
final void Function()? onEdit;
|
||||||
final Client? client;
|
final Client? client;
|
||||||
final double opacity;
|
final double opacity;
|
||||||
|
final String heroTag;
|
||||||
|
|
||||||
const ContentBanner(
|
const ContentBanner(
|
||||||
{this.mxContent,
|
{this.mxContent,
|
||||||
@ -24,6 +25,7 @@ class ContentBanner extends StatelessWidget {
|
|||||||
this.onEdit,
|
this.onEdit,
|
||||||
this.client,
|
this.client,
|
||||||
this.opacity = 0.75,
|
this.opacity = 0.75,
|
||||||
|
this.heroTag = 'content_banner',
|
||||||
Key? key})
|
Key? key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@ -62,7 +64,9 @@ class ContentBanner extends StatelessWidget {
|
|||||||
method: ThumbnailMethod.scale,
|
method: ThumbnailMethod.scale,
|
||||||
animated: true,
|
animated: true,
|
||||||
);
|
);
|
||||||
return CachedNetworkImage(
|
return Hero(
|
||||||
|
tag: heroTag,
|
||||||
|
child: CachedNetworkImage(
|
||||||
imageUrl: src.toString(),
|
imageUrl: src.toString(),
|
||||||
height: 300,
|
height: 300,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
@ -73,6 +77,7 @@ class ContentBanner extends StatelessWidget {
|
|||||||
.colorScheme
|
.colorScheme
|
||||||
.onSecondaryContainer,
|
.onSecondaryContainer,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
: Icon(
|
: Icon(
|
||||||
|
Loading…
Reference in New Issue
Block a user