-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/develop' into feature/notifica…
…tion-page
- Loading branch information
Showing
20 changed files
with
151 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:lemmy_api_client/v3.dart'; | ||
import 'package:cached_network_image/cached_network_image.dart'; | ||
|
||
/// A community avatar. Displays the associated community icon if available. | ||
/// | ||
/// Otherwise, displays the first letter of the community title (display name). | ||
/// If no title is available, displays the first letter of the community name. | ||
class CommunityAvatar extends StatelessWidget { | ||
/// The community information to display | ||
final Community? community; | ||
|
||
/// The radius of the avatar. Defaults to 12 | ||
final double radius; | ||
|
||
const CommunityAvatar({super.key, this.community, this.radius = 12.0}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = Theme.of(context); | ||
|
||
CircleAvatar placeholderIcon = CircleAvatar( | ||
backgroundColor: theme.colorScheme.secondaryContainer, | ||
maxRadius: radius, | ||
child: Text( | ||
community?.title.isNotEmpty == true | ||
? community!.title[0].toUpperCase() | ||
: community?.name.isNotEmpty == true | ||
? community!.name[0].toUpperCase() | ||
: '', | ||
semanticsLabel: '', | ||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: radius), | ||
), | ||
); | ||
|
||
if (community?.icon?.isNotEmpty != true) return placeholderIcon; | ||
|
||
return CachedNetworkImage( | ||
imageUrl: community!.icon!, | ||
imageBuilder: (context, imageProvider) { | ||
return CircleAvatar( | ||
backgroundColor: Colors.transparent, | ||
foregroundImage: imageProvider, | ||
maxRadius: radius, | ||
); | ||
}, | ||
placeholder: (context, url) => placeholderIcon, | ||
errorWidget: (context, url, error) => placeholderIcon, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:lemmy_api_client/v3.dart'; | ||
import 'package:cached_network_image/cached_network_image.dart'; | ||
|
||
/// A user avatar. Displays the associated user icon if available. | ||
/// | ||
/// Otherwise, displays the first letter of the user's display name. | ||
/// If no display name is available, displays the first letter of the user's username. | ||
class UserAvatar extends StatelessWidget { | ||
/// The user information to display | ||
final Person? person; | ||
|
||
/// The radius of the avatar. Defaults to 16 | ||
final double radius; | ||
|
||
const UserAvatar({super.key, this.person, this.radius = 16.0}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = Theme.of(context); | ||
|
||
CircleAvatar placeholderIcon = CircleAvatar( | ||
backgroundColor: theme.colorScheme.secondaryContainer, | ||
maxRadius: radius, | ||
child: Text( | ||
person?.displayName?.isNotEmpty == true | ||
? person!.displayName![0].toUpperCase() | ||
: person?.name.isNotEmpty == true | ||
? person!.name[0].toUpperCase() | ||
: '', | ||
semanticsLabel: '', | ||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: radius), | ||
), | ||
); | ||
|
||
if (person?.avatar?.isNotEmpty != true) return placeholderIcon; | ||
|
||
return CachedNetworkImage( | ||
imageUrl: person!.avatar!, | ||
imageBuilder: (context, imageProvider) { | ||
return CircleAvatar( | ||
backgroundColor: Colors.transparent, | ||
foregroundImage: imageProvider, | ||
maxRadius: radius, | ||
); | ||
}, | ||
placeholder: (context, url) => placeholderIcon, | ||
errorWidget: (context, url, error) => placeholderIcon, | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.