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(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Avatar(url: payload['author']['avatarUrl'], size: 16),
|
Avatar.medium(url: payload['author']['avatarUrl']),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -30,7 +30,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Avatar(url: account.avatarUrl, size: 24),
|
Avatar.large(url: account.avatarUrl),
|
||||||
Padding(padding: EdgeInsets.only(left: 10)),
|
Padding(padding: EdgeInsets.only(left: 10)),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -10,9 +10,25 @@ class Avatar extends StatelessWidget {
|
|||||||
|
|
||||||
Avatar({
|
Avatar({
|
||||||
@required this.url,
|
@required this.url,
|
||||||
this.size = 18,
|
|
||||||
this.login,
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -21,8 +37,8 @@ class Avatar extends StatelessWidget {
|
|||||||
child: FadeInImage.assetNetwork(
|
child: FadeInImage.assetNetwork(
|
||||||
placeholder: 'images/octoface.png',
|
placeholder: 'images/octoface.png',
|
||||||
image: url,
|
image: url,
|
||||||
width: 2 * size,
|
width: size,
|
||||||
height: 2 * size,
|
height: size,
|
||||||
fadeInDuration: Duration(milliseconds: 200),
|
fadeInDuration: Duration(milliseconds: 200),
|
||||||
fadeOutDuration: Duration(milliseconds: 100),
|
fadeOutDuration: Duration(milliseconds: 100),
|
||||||
),
|
),
|
||||||
|
@ -43,9 +43,8 @@ class CommentItem extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
Avatar(
|
Avatar.medium(
|
||||||
url: payload['author']['avatarUrl'],
|
url: payload['author']['avatarUrl'],
|
||||||
size: 16,
|
|
||||||
login: payload['author']['login'],
|
login: payload['author']['login'],
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
|
@ -79,10 +79,9 @@ class EventItem extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Avatar(
|
Avatar.medium(
|
||||||
url: event.actorAvatarUrl,
|
url: event.actorAvatarUrl,
|
||||||
login: event.actorLogin,
|
login: event.actorLogin,
|
||||||
size: 20,
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -120,10 +120,9 @@ class IssueItem extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
// FIXME: Deleted user
|
// FIXME: Deleted user
|
||||||
if (payload['author'] != null) ...[
|
if (payload['author'] != null) ...[
|
||||||
Avatar(
|
Avatar.extraSmall(
|
||||||
login: payload['author']['login'],
|
login: payload['author']['login'],
|
||||||
url: payload['author']['avatarUrl'],
|
url: payload['author']['avatarUrl'],
|
||||||
size: 8,
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
|
@ -130,7 +130,10 @@ class RepositoryItem extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Avatar(url: payload['owner']['avatarUrl'], size: 12),
|
Avatar.small(
|
||||||
|
url: payload['owner']['avatarUrl'],
|
||||||
|
login: payload['owner']['login'],
|
||||||
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -50,7 +50,7 @@ class UserItem extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Avatar(url: avatarUrl, size: 24),
|
Avatar.large(url: avatarUrl),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
Loading…
Reference in New Issue
Block a user