mirror of
https://github.com/git-touch/git-touch
synced 2024-12-16 18:28:51 +01:00
refactor: avatar size
This commit is contained in:
parent
378f8d10d8
commit
ae5660061c
@ -94,7 +94,7 @@ class CommitsScreen extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar(url: payload['author']['avatarUrl'], size: 16),
|
||||
Avatar.medium(url: payload['author']['avatarUrl']),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
@ -30,7 +30,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Avatar(url: account.avatarUrl, size: 24),
|
||||
Avatar.large(url: account.avatarUrl),
|
||||
Padding(padding: EdgeInsets.only(left: 10)),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
@ -10,9 +10,25 @@ class Avatar extends StatelessWidget {
|
||||
|
||||
Avatar({
|
||||
@required this.url,
|
||||
this.size = 18,
|
||||
this.login,
|
||||
@required this.size,
|
||||
});
|
||||
Avatar.extraSmall({
|
||||
@required this.url,
|
||||
this.login,
|
||||
}) : size = 16;
|
||||
Avatar.small({
|
||||
@required this.url,
|
||||
this.login,
|
||||
}) : size = 24;
|
||||
Avatar.medium({
|
||||
@required this.url,
|
||||
this.login,
|
||||
}) : size = 36;
|
||||
Avatar.large({
|
||||
@required this.url,
|
||||
this.login,
|
||||
}) : size = 48;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -21,8 +37,8 @@ class Avatar extends StatelessWidget {
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: 'images/octoface.png',
|
||||
image: url,
|
||||
width: 2 * size,
|
||||
height: 2 * size,
|
||||
width: size,
|
||||
height: size,
|
||||
fadeInDuration: Duration(milliseconds: 200),
|
||||
fadeOutDuration: Duration(milliseconds: 100),
|
||||
),
|
||||
|
@ -43,9 +43,8 @@ class CommentItem extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(children: <Widget>[
|
||||
Avatar(
|
||||
Avatar.medium(
|
||||
url: payload['author']['avatarUrl'],
|
||||
size: 16,
|
||||
login: payload['author']['login'],
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
|
@ -79,10 +79,9 @@ class EventItem extends StatelessWidget {
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar(
|
||||
Avatar.medium(
|
||||
url: event.actorAvatarUrl,
|
||||
login: event.actorLogin,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
|
@ -120,10 +120,9 @@ class IssueItem extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
// FIXME: Deleted user
|
||||
if (payload['author'] != null) ...[
|
||||
Avatar(
|
||||
Avatar.extraSmall(
|
||||
login: payload['author']['login'],
|
||||
url: payload['author']['avatarUrl'],
|
||||
size: 8,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
|
@ -130,7 +130,10 @@ class RepositoryItem extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar(url: payload['owner']['avatarUrl'], size: 12),
|
||||
Avatar.small(
|
||||
url: payload['owner']['avatarUrl'],
|
||||
login: payload['owner']['login'],
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
@ -50,7 +50,7 @@ class UserItem extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar(url: avatarUrl, size: 24),
|
||||
Avatar.large(url: avatarUrl),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
Loading…
Reference in New Issue
Block a user