1
0
mirror of https://github.com/git-touch/git-touch synced 2025-02-08 23:58:46 +01:00

89 lines
2.4 KiB
Dart
Raw Normal View History

2019-09-14 17:19:33 +08:00
import 'package:flutter/material.dart';
2019-11-08 18:29:08 +08:00
import 'package:git_touch/models/theme.dart';
2019-10-02 15:39:47 +08:00
import 'package:git_touch/utils/utils.dart';
2019-09-14 17:19:33 +08:00
import 'package:git_touch/widgets/avatar.dart';
2019-09-15 02:05:34 +08:00
import 'package:git_touch/widgets/link.dart';
2019-11-08 18:29:08 +08:00
import 'package:provider/provider.dart';
2019-09-14 17:19:33 +08:00
2019-09-22 01:23:38 +08:00
const userGqlChunk = '''
2019-09-27 21:02:55 +08:00
login
2019-09-22 01:23:38 +08:00
name
avatarUrl
bio
''';
2019-09-14 17:19:33 +08:00
class UserItem extends StatelessWidget {
final String login;
2020-02-01 10:32:29 +08:00
// final String name;
2019-09-14 17:19:33 +08:00
final String avatarUrl;
final Widget bio;
2020-02-01 10:32:29 +08:00
final String url;
UserItem.gh({
@required this.avatarUrl,
2020-10-04 21:42:54 +08:00
@required this.login,
2020-02-01 10:32:29 +08:00
@required this.bio,
}) : url = '/github/$login';
2019-09-14 17:19:33 +08:00
2019-09-27 21:02:55 +08:00
UserItem({
2020-02-01 10:32:29 +08:00
@required this.avatarUrl,
2020-10-04 21:42:54 +08:00
@required this.login,
2020-02-01 10:32:29 +08:00
@required this.bio,
@required this.url,
2019-09-25 20:51:23 +08:00
});
2019-09-14 17:19:33 +08:00
@override
Widget build(BuildContext context) {
2019-11-08 18:29:08 +08:00
final theme = Provider.of<ThemeModel>(context);
2020-01-02 13:56:50 +08:00
return Link(
2020-02-01 10:32:29 +08:00
url: url,
2020-01-02 13:56:50 +08:00
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 13:33:02 +08:00
// Text(
// name ?? login,
// style: TextStyle(
2020-01-27 15:11:51 +08:00
// color: theme.palette.text,
2020-01-14 13:33:02 +08:00
// fontSize: 18,
// ),
// ),
// SizedBox(width: 8),
2020-01-02 13:56:50 +08:00
Text(
2020-01-12 16:18:37 +08:00
login,
2020-01-02 13:56:50 +08:00
style: TextStyle(
2020-01-27 15:11:51 +08:00
color: theme.palette.primary,
2020-01-14 13:33:02 +08:00
fontSize: 18,
2020-01-27 10:47:34 +08:00
fontWeight: FontWeight.w600,
2020-01-12 16:18:37 +08:00
),
2020-01-02 13:56:50 +08:00
),
],
),
SizedBox(height: 6),
if (bio != null)
DefaultTextStyle(
2019-09-27 21:02:55 +08:00
style: TextStyle(
2020-01-27 15:11:51 +08:00
color: theme.palette.secondaryText,
2020-01-27 10:47:34 +08:00
fontSize: 16,
2020-01-02 13:56:50 +08:00
),
child: bio,
2019-12-21 16:16:17 +08:00
),
2020-01-02 13:56:50 +08:00
],
),
)
],
),
2019-09-15 02:05:34 +08:00
),
2019-09-14 17:19:33 +08:00
);
}
}