kopia lustrzana https://gitlab.com/mysocialportal/relatica
Fix display of reshares in timeline
rodzic
b5ef0a21fe
commit
03a7ebc788
|
@ -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),
|
||||
|
|
|
@ -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,
|
||||
|
|
Ładowanie…
Reference in New Issue