2022-09-17 14:35:45 +02:00
|
|
|
import 'package:flutter/widgets.dart';
|
2020-04-25 12:31:32 +02:00
|
|
|
import 'package:git_touch/models/theme.dart';
|
|
|
|
import 'package:git_touch/utils/utils.dart';
|
|
|
|
import 'package:git_touch/widgets/avatar.dart';
|
|
|
|
import 'package:git_touch/widgets/link.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
class ContributorItem extends StatelessWidget {
|
|
|
|
|
2022-09-06 18:28:12 +02:00
|
|
|
const ContributorItem({
|
2021-05-16 09:16:35 +02:00
|
|
|
required this.login,
|
|
|
|
required this.avatarUrl,
|
|
|
|
required this.commits,
|
|
|
|
required this.url,
|
2020-04-25 12:31:32 +02:00
|
|
|
});
|
2022-09-21 18:28:21 +02:00
|
|
|
final String? login;
|
|
|
|
final String? avatarUrl;
|
|
|
|
final int? commits;
|
|
|
|
final String url;
|
2020-04-25 12:31:32 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
2021-05-16 09:16:35 +02:00
|
|
|
return LinkWidget(
|
2020-04-25 12:31:32 +02:00
|
|
|
url: url,
|
|
|
|
child: Container(
|
|
|
|
padding: CommonStyle.padding,
|
|
|
|
child: Row(
|
|
|
|
children: <Widget>[
|
|
|
|
Avatar(url: avatarUrl, size: AvatarSize.large),
|
2022-09-06 18:28:12 +02:00
|
|
|
const SizedBox(width: 10),
|
2020-04-25 12:31:32 +02:00
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Row(
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
2021-05-16 09:16:35 +02:00
|
|
|
login!,
|
2020-04-25 12:31:32 +02:00
|
|
|
style: TextStyle(
|
|
|
|
color: theme.palette.primary,
|
|
|
|
fontSize: 18,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-09-06 18:28:12 +02:00
|
|
|
const SizedBox(height: 6),
|
2020-04-25 12:31:32 +02:00
|
|
|
if (commits != null)
|
|
|
|
DefaultTextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
color: theme.palette.secondaryText,
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
2022-09-18 19:02:57 +02:00
|
|
|
child: Text('Commits: $commits'),
|
2020-04-25 12:31:32 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|