Fix display of reshares in timeline

main
Hank Grabowski 2022-12-27 22:54:33 -05:00
rodzic b5ef0a21fe
commit 03a7ebc788
2 zmienionych plików z 37 dodań i 7 usunięć

Wyświetl plik

@ -22,22 +22,25 @@ class StatusHeaderControl extends StatelessWidget {
required this.openRemote,
required this.showOpenControl});
void goToProfile(BuildContext context) {
context.pushNamed(ScreenPaths.userProfile, params: {'id': entry.authorId});
void goToProfile(BuildContext context, String id) {
context.pushNamed(ScreenPaths.userProfile, params: {'id': id});
}
@override
Widget build(BuildContext context) {
final authorId = entry.isReshare ? entry.reshareAuthorId : entry.authorId;
final author = getIt<ConnectionsManager>()
.getById(authorId)
.getById(entry.authorId)
.getValueOrElse(() => Connection());
final reshareAuthor = getIt<ConnectionsManager>()
.getById(entry.reshareAuthorId)
.getValueOrElse(() => Connection());
return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () => goToProfile(context),
onTap: () => goToProfile(context, author.id),
child: CachedNetworkImage(
imageUrl: author.avatarUrl.toString(),
width: 32.0,
@ -49,7 +52,7 @@ class StatusHeaderControl extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () => goToProfile(context),
onTap: () => goToProfile(context, author.id),
child: Text(
author.name,
style: Theme.of(context).textTheme.bodyText1,
@ -75,7 +78,26 @@ class StatusHeaderControl extends StatelessWidget {
// ),
],
),
if (entry.isReshare) const Icon(Icons.repeat),
if (reshareAuthor.isNotEmpty) ...[
const HorizontalPadding(width: 3.0),
const Icon(Icons.repeat),
const HorizontalPadding(width: 3.0),
GestureDetector(
onTap: () => goToProfile(context, reshareAuthor.id),
child: CachedNetworkImage(
imageUrl: reshareAuthor.avatarUrl.toString(),
width: 32.0,
),
),
const HorizontalPadding(width: 3.0),
GestureDetector(
onTap: () => goToProfile(context, reshareAuthor.id),
child: Text(
reshareAuthor.name,
style: Theme.of(context).textTheme.bodyText1,
),
),
],
if (showOpenControl) ...[
const Expanded(child: SizedBox()),
buildActionBar(context),

Wyświetl plik

@ -21,6 +21,14 @@ class Connection {
: profileUrl = profileUrl ?? Uri(),
avatarUrl = avatarUrl ?? Uri();
bool get isEmpty =>
name.isEmpty &&
id.isEmpty &&
network.isEmpty &&
status == ConnectionStatus.unknown;
bool get isNotEmpty => !isEmpty;
Connection copy(
{ConnectionStatus? status,
String? name,