fix leaderboard formatting, save shared users to drafts, display shared legs
All checks were successful
Release / meta (push) Successful in 8s
Release / linux-build (push) Successful in 6m59s
Release / web-build (push) Successful in 6m37s
Release / android-build (push) Successful in 18m3s
Release / release-master (push) Successful in 23s
Release / release-dev (push) Successful in 25s
All checks were successful
Release / meta (push) Successful in 8s
Release / linux-build (push) Successful in 6m59s
Release / web-build (push) Successful in 6m37s
Release / android-build (push) Successful in 18m3s
Release / release-master (push) Successful in 23s
Release / release-dev (push) Successful in 25s
This commit is contained in:
@@ -28,6 +28,8 @@ class _LegCardState extends State<LegCard> {
|
||||
Widget build(BuildContext context) {
|
||||
final leg = widget.leg;
|
||||
final isShared = leg.legShareId != null && leg.legShareId!.isNotEmpty;
|
||||
final sharedFrom = leg.sharedFrom;
|
||||
final sharedTo = leg.sharedTo;
|
||||
final distanceUnits = context.watch<DistanceUnitService>();
|
||||
final routeSegments = _parseRouteSegments(leg.route);
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
@@ -198,16 +200,9 @@ class _LegCardState extends State<LegCard> {
|
||||
],
|
||||
],
|
||||
),
|
||||
if (isShared) ...[
|
||||
if (isShared || sharedFrom != null || (sharedTo.isNotEmpty)) ...[
|
||||
const SizedBox(width: 8),
|
||||
Tooltip(
|
||||
message: 'Shared entry',
|
||||
child: Icon(
|
||||
Icons.share,
|
||||
size: 18,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
_SharedIcons(sharedFrom: sharedFrom, sharedTo: sharedTo, isShared: isShared),
|
||||
],
|
||||
if (widget.showEditButton) ...[
|
||||
const SizedBox(width: 8),
|
||||
@@ -461,3 +456,61 @@ class _LegCardState extends State<LegCard> {
|
||||
return route.map((e) => e.toString()).where((e) => e.trim().isNotEmpty).toList();
|
||||
}
|
||||
}
|
||||
|
||||
class _SharedIcons extends StatelessWidget {
|
||||
const _SharedIcons({
|
||||
required this.sharedFrom,
|
||||
required this.sharedTo,
|
||||
required this.isShared,
|
||||
});
|
||||
|
||||
final LegShareMeta? sharedFrom;
|
||||
final List<LegShareMeta> sharedTo;
|
||||
final bool isShared;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final icons = <Widget>[];
|
||||
if (isShared || sharedFrom != null) {
|
||||
final fromName = sharedFrom?.sharedFromDisplay ?? '';
|
||||
icons.add(
|
||||
Tooltip(
|
||||
message: fromName.isNotEmpty ? 'Shared from $fromName' : 'Shared entry',
|
||||
child: Icon(
|
||||
Icons.share,
|
||||
size: 18,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (sharedTo.isNotEmpty) {
|
||||
final names = sharedTo
|
||||
.map((s) => s.sharedToDisplay)
|
||||
.where((name) => name.isNotEmpty)
|
||||
.toList();
|
||||
final tooltip = names.isEmpty
|
||||
? 'Shared to others'
|
||||
: 'Shared to: ${names.join(', ')}';
|
||||
icons.add(
|
||||
Tooltip(
|
||||
message: tooltip,
|
||||
child: Icon(
|
||||
Icons.group,
|
||||
size: 18,
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (int i = 0; i < icons.length; i++) ...[
|
||||
if (i > 0) const SizedBox(width: 6),
|
||||
icons[i],
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user