💄 Use bottom modal sheet instead of popover
✨ Show strike on user profile page
This commit is contained in:
@ -39,7 +39,9 @@ class AccountPopoverCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
).padding(all: 16),
|
||||
).padding(all: 16)
|
||||
else
|
||||
const Gap(16),
|
||||
// Top padding
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -89,7 +91,9 @@ class AccountPopoverCard extends StatelessWidget {
|
||||
data.profile?.description ?? '',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
).padding(horizontal: 26, bottom: 8),
|
||||
).padding(horizontal: 26, bottom: 8)
|
||||
else
|
||||
const Gap(12),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
@ -12,7 +12,6 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:popover/popover.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:relative_time/relative_time.dart';
|
||||
@ -1274,20 +1273,11 @@ class _PostAvatar extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
showPopover(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
transition: PopoverTransition.other,
|
||||
bodyBuilder: (context) => SizedBox(
|
||||
width: math.min(400, MediaQuery.of(context).size.width - 10),
|
||||
child: PublisherPopoverCard(
|
||||
data: data.publisher,
|
||||
),
|
||||
builder: (context) => PublisherPopoverCard(
|
||||
data: data.publisher,
|
||||
),
|
||||
direction: PopoverDirection.bottom,
|
||||
arrowHeight: 5,
|
||||
arrowWidth: 15,
|
||||
arrowDxOffset: -190,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -24,125 +24,137 @@ class PublisherPopoverCard extends StatelessWidget {
|
||||
|
||||
final user = data.type == 0 ? ud.getFromCache(data.accountId) : null;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (data.banner.isNotEmpty)
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 7,
|
||||
child: AutoResizeUniversalImage(
|
||||
sn.getAttachmentUrl(data.banner),
|
||||
fit: BoxFit.cover,
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (data.banner.isNotEmpty)
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 7,
|
||||
child: AutoResizeUniversalImage(
|
||||
sn.getAttachmentUrl(data.banner),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Top padding
|
||||
Gap(16),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AccountImage(
|
||||
content: data.avatar,
|
||||
radius: 20,
|
||||
borderRadius: data.type == 1 ? 8 : 20,
|
||||
),
|
||||
).padding(all: 16)
|
||||
else
|
||||
// Top padding
|
||||
Gap(16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(data.nick).bold(),
|
||||
Text('@${data.name}').fontSize(13).opacity(0.75),
|
||||
],
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AccountImage(
|
||||
content: data.avatar,
|
||||
radius: 20,
|
||||
borderRadius: data.type == 1 ? 8 : 20,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
GoRouter.of(context).pushNamed(
|
||||
'postPublisher',
|
||||
pathParameters: {'name': data.name},
|
||||
);
|
||||
},
|
||||
icon: const Icon(Symbols.chevron_right),
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
|
||||
),
|
||||
const Gap(8)
|
||||
],
|
||||
).padding(horizontal: 16),
|
||||
if (user != null && user.badges.isNotEmpty)
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
children: user.badges
|
||||
.map(
|
||||
(ele) => AccountBadge(badge: ele),
|
||||
)
|
||||
.toList(),
|
||||
).padding(horizontal: 24, top: 16),
|
||||
const Gap(16),
|
||||
if (data.description.isNotEmpty)
|
||||
Text(
|
||||
data.description,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
).padding(horizontal: 26, bottom: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('publisherSocialPoint').tr().fontSize(13).opacity(0.75),
|
||||
Text((data.totalUpvote - data.totalDownvote).toString()),
|
||||
],
|
||||
Gap(16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(data.nick).bold(),
|
||||
Text('@${data.name}').fontSize(13).opacity(0.75),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
child: const VerticalDivider(
|
||||
thickness: 1,
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
GoRouter.of(context).pushNamed(
|
||||
'postPublisher',
|
||||
pathParameters: {'name': data.name},
|
||||
);
|
||||
},
|
||||
icon: const Icon(Symbols.chevron_right),
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity:
|
||||
const VisualDensity(horizontal: -4, vertical: -4),
|
||||
),
|
||||
).padding(horizontal: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('publisherTotalUpvote').tr().fontSize(13).opacity(0.75),
|
||||
Text(data.totalUpvote.toString()),
|
||||
],
|
||||
const Gap(8)
|
||||
],
|
||||
).padding(horizontal: 16),
|
||||
if (user != null && user.badges.isNotEmpty)
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
children: user.badges
|
||||
.map(
|
||||
(ele) => AccountBadge(badge: ele),
|
||||
)
|
||||
.toList(),
|
||||
).padding(horizontal: 24, top: 16),
|
||||
const Gap(16),
|
||||
if (data.description.isNotEmpty)
|
||||
Text(
|
||||
data.description,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
).padding(horizontal: 26, bottom: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('publisherSocialPoint')
|
||||
.tr()
|
||||
.fontSize(13)
|
||||
.opacity(0.75),
|
||||
Text((data.totalUpvote - data.totalDownvote).toString()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
child: const VerticalDivider(
|
||||
thickness: 1,
|
||||
SizedBox(
|
||||
height: 20,
|
||||
child: const VerticalDivider(
|
||||
thickness: 1,
|
||||
),
|
||||
).padding(horizontal: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('publisherTotalUpvote')
|
||||
.tr()
|
||||
.fontSize(13)
|
||||
.opacity(0.75),
|
||||
Text(data.totalUpvote.toString()),
|
||||
],
|
||||
),
|
||||
),
|
||||
).padding(horizontal: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('publisherTotalDownvote')
|
||||
.tr()
|
||||
.fontSize(13)
|
||||
.opacity(0.75),
|
||||
Text(data.totalDownvote.toString()),
|
||||
],
|
||||
SizedBox(
|
||||
height: 20,
|
||||
child: const VerticalDivider(
|
||||
thickness: 1,
|
||||
),
|
||||
).padding(horizontal: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('publisherTotalDownvote')
|
||||
.tr()
|
||||
.fontSize(13)
|
||||
.opacity(0.75),
|
||||
Text(data.totalDownvote.toString()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).padding(horizontal: 16),
|
||||
// Bottom padding
|
||||
const Gap(16),
|
||||
],
|
||||
],
|
||||
).padding(horizontal: 16),
|
||||
// Bottom padding
|
||||
const Gap(64),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user