git-touch-android-ios-app/lib/widgets/repo_header.dart

72 lines
2.1 KiB
Dart
Raw Normal View History

2022-09-24 20:46:37 +02:00
import 'package:antd_mobile/antd_mobile.dart';
2022-09-17 14:35:45 +02:00
import 'package:flutter/widgets.dart';
2020-01-29 11:23:51 +01:00
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/avatar.dart';
import 'package:git_touch/widgets/link.dart';
class RepoHeader extends StatelessWidget {
2022-09-06 18:28:12 +02:00
const RepoHeader({
2021-05-16 09:16:35 +02:00
required this.avatarUrl,
required this.avatarLink,
required this.owner,
required this.name,
required this.description,
2020-01-29 11:23:51 +01:00
this.homepageUrl,
this.actions,
this.trailings,
});
2022-09-21 18:28:21 +02:00
final String? avatarUrl;
final String? avatarLink;
final String? owner;
final String? name;
final String? description;
final String? homepageUrl;
final List<Widget>? actions;
final List<Widget>? trailings;
2020-01-29 11:23:51 +01:00
@override
Widget build(BuildContext context) {
2022-10-07 20:19:07 +02:00
final theme = AntTheme.of(context);
2020-01-29 11:23:51 +01:00
return Container(
padding: CommonStyle.padding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
2022-10-07 18:46:34 +02:00
children: [
2020-01-29 11:23:51 +01:00
Row(
children: <Widget>[
Avatar(
url: avatarUrl,
size: AvatarSize.small,
2020-02-01 03:46:11 +01:00
linkUrl: avatarLink,
2020-01-29 11:23:51 +01:00
),
2020-04-12 05:08:31 +02:00
Expanded(
child: Text(
2020-04-16 05:36:48 +02:00
'$owner / $name',
2022-10-07 20:19:07 +02:00
style: TextStyle(fontSize: 20, color: theme.colorPrimary),
2020-04-16 05:36:48 +02:00
overflow: TextOverflow.visible,
),
2020-01-29 11:23:51 +01:00
),
2022-10-07 20:19:07 +02:00
].withSeparator(const SizedBox(width: 8)),
2020-01-29 11:23:51 +01:00
),
2021-05-16 09:16:35 +02:00
if (actions != null) ...actions!,
if (description != null && description!.isNotEmpty)
2020-01-29 11:23:51 +01:00
Text(
2021-05-16 09:16:35 +02:00
description!,
2022-10-07 20:19:07 +02:00
style: TextStyle(color: theme.colorTextSecondary, fontSize: 16),
2020-01-29 11:23:51 +01:00
),
2021-05-16 09:16:35 +02:00
if (homepageUrl != null && homepageUrl!.isNotEmpty)
LinkWidget(
2020-01-29 11:23:51 +01:00
url: homepageUrl,
child: Text(
2021-05-16 09:16:35 +02:00
homepageUrl!,
2022-10-07 20:19:07 +02:00
style: TextStyle(color: theme.colorPrimary, fontSize: 16),
2020-01-29 11:23:51 +01:00
),
),
2021-05-16 09:16:35 +02:00
if (trailings != null) ...trailings!
2022-10-07 18:46:34 +02:00
].withSeparator(const SizedBox(height: 12)),
2020-01-29 11:23:51 +01:00
),
);
}
}