2019-09-14 11:19:33 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2019-11-08 11:29:08 +01:00
|
|
|
import 'package:git_touch/models/theme.dart';
|
2019-10-02 09:39:47 +02:00
|
|
|
import 'package:git_touch/utils/utils.dart';
|
2019-09-14 11:19:33 +02:00
|
|
|
import 'package:git_touch/widgets/avatar.dart';
|
2019-09-14 20:05:34 +02:00
|
|
|
import 'package:git_touch/widgets/link.dart';
|
2019-11-08 11:29:08 +01:00
|
|
|
import 'package:provider/provider.dart';
|
2019-09-14 11:19:33 +02:00
|
|
|
|
2019-09-21 19:23:38 +02:00
|
|
|
const userGqlChunk = '''
|
2019-09-27 15:02:55 +02:00
|
|
|
login
|
2019-09-21 19:23:38 +02:00
|
|
|
name
|
|
|
|
avatarUrl
|
|
|
|
bio
|
|
|
|
''';
|
|
|
|
|
2019-09-14 11:19:33 +02:00
|
|
|
class UserItem extends StatelessWidget {
|
|
|
|
final String login;
|
|
|
|
final String name;
|
|
|
|
final String avatarUrl;
|
2020-01-01 07:09:26 +01:00
|
|
|
final Widget bio;
|
2019-09-14 11:19:33 +02:00
|
|
|
|
2019-09-27 15:02:55 +02:00
|
|
|
UserItem({
|
|
|
|
this.login,
|
2019-09-25 14:51:23 +02:00
|
|
|
this.name,
|
|
|
|
this.avatarUrl,
|
|
|
|
this.bio,
|
|
|
|
});
|
2019-09-14 11:19:33 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2019-11-08 11:29:08 +01:00
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
2020-01-02 06:56:50 +01:00
|
|
|
return Link(
|
|
|
|
url: '/$login',
|
|
|
|
child: Container(
|
|
|
|
padding: CommonStyle.padding,
|
|
|
|
child: Row(
|
|
|
|
children: <Widget>[
|
|
|
|
Avatar(url: avatarUrl, size: AvatarSize.large),
|
|
|
|
SizedBox(width: 10),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Row(
|
|
|
|
children: <Widget>[
|
2020-01-14 06:33:02 +01:00
|
|
|
// Text(
|
|
|
|
// name ?? login,
|
|
|
|
// style: TextStyle(
|
2020-01-27 08:11:51 +01:00
|
|
|
// color: theme.palette.text,
|
2020-01-14 06:33:02 +01:00
|
|
|
// fontSize: 18,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// SizedBox(width: 8),
|
2020-01-02 06:56:50 +01:00
|
|
|
Text(
|
2020-01-12 09:18:37 +01:00
|
|
|
login,
|
2020-01-02 06:56:50 +01:00
|
|
|
style: TextStyle(
|
2020-01-27 08:11:51 +01:00
|
|
|
color: theme.palette.primary,
|
2020-01-14 06:33:02 +01:00
|
|
|
fontSize: 18,
|
2020-01-27 03:47:34 +01:00
|
|
|
fontWeight: FontWeight.w600,
|
2020-01-12 09:18:37 +01:00
|
|
|
),
|
2020-01-02 06:56:50 +01:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height: 6),
|
|
|
|
if (bio != null)
|
|
|
|
DefaultTextStyle(
|
2019-09-27 15:02:55 +02:00
|
|
|
style: TextStyle(
|
2020-01-27 08:11:51 +01:00
|
|
|
color: theme.palette.secondaryText,
|
2020-01-27 03:47:34 +01:00
|
|
|
fontSize: 16,
|
2020-01-02 06:56:50 +01:00
|
|
|
),
|
|
|
|
child: bio,
|
2019-12-21 09:16:17 +01:00
|
|
|
),
|
2020-01-02 06:56:50 +01:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
2019-09-14 20:05:34 +02:00
|
|
|
),
|
2019-09-14 11:19:33 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|