2022-09-13 19:19:52 +02:00
|
|
|
import 'package:antd_mobile/antd_mobile.dart';
|
2019-02-08 16:20:28 +01:00
|
|
|
import 'package:flutter/cupertino.dart';
|
2022-09-17 14:35:45 +02:00
|
|
|
import 'package:flutter/widgets.dart';
|
2019-11-05 14:22:41 +01:00
|
|
|
import 'package:git_touch/models/theme.dart';
|
2019-09-04 16:37:22 +02:00
|
|
|
import 'package:git_touch/utils/utils.dart';
|
2022-09-13 17:52:35 +02:00
|
|
|
import 'package:git_touch/widgets/link.dart';
|
2019-11-05 14:22:41 +01:00
|
|
|
import 'package:provider/provider.dart';
|
2019-02-08 16:20:28 +01:00
|
|
|
|
2019-09-21 17:54:25 +02:00
|
|
|
class TableViewHeader extends StatelessWidget {
|
|
|
|
|
2022-09-13 17:52:35 +02:00
|
|
|
const TableViewHeader(this.title, {super.key});
|
2022-09-21 18:28:21 +02:00
|
|
|
final String? title;
|
2019-09-21 17:54:25 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2019-12-21 10:26:26 +01:00
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
2019-09-21 17:54:25 +02:00
|
|
|
return Container(
|
2022-09-06 18:28:12 +02:00
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
2019-09-21 17:54:25 +02:00
|
|
|
child: Text(
|
2021-05-16 09:16:35 +02:00
|
|
|
title!.toUpperCase(),
|
2020-01-27 08:11:51 +01:00
|
|
|
style: TextStyle(color: theme.palette.secondaryText, fontSize: 13),
|
2019-09-21 17:54:25 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-13 17:52:35 +02:00
|
|
|
class TableViewItemWidget extends StatelessWidget {
|
|
|
|
const TableViewItemWidget(this.item, {super.key});
|
|
|
|
|
2022-09-20 20:00:03 +02:00
|
|
|
final AntListItem item;
|
2021-06-14 05:28:12 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
|
|
|
|
|
|
|
return LinkWidget(
|
2022-09-13 19:19:52 +02:00
|
|
|
onTap: item.onClick,
|
2021-06-14 05:28:12 +02:00
|
|
|
child: DefaultTextStyle(
|
|
|
|
style: TextStyle(fontSize: 17, color: theme.palette.text),
|
|
|
|
overflow: TextOverflow.ellipsis,
|
2022-09-06 18:28:12 +02:00
|
|
|
child: SizedBox(
|
2021-06-14 05:28:12 +02:00
|
|
|
height: 44,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
2022-09-20 20:00:03 +02:00
|
|
|
width: (item.prefix == null) ? 12 : 44,
|
|
|
|
child: Center(child: item.prefix),
|
2021-06-14 05:28:12 +02:00
|
|
|
),
|
2022-09-13 19:19:52 +02:00
|
|
|
Expanded(child: item.child),
|
|
|
|
if (item.extra != null) ...[
|
2021-06-14 05:28:12 +02:00
|
|
|
DefaultTextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 17,
|
|
|
|
color: theme.palette.tertiaryText,
|
|
|
|
),
|
2022-09-13 19:19:52 +02:00
|
|
|
child: item.extra!,
|
2021-06-14 05:28:12 +02:00
|
|
|
),
|
2022-09-06 18:28:12 +02:00
|
|
|
const SizedBox(width: 6)
|
2021-06-14 05:28:12 +02:00
|
|
|
],
|
2022-09-20 20:00:03 +02:00
|
|
|
if (item.onClick != null)
|
2021-06-14 05:28:12 +02:00
|
|
|
Icon(Ionicons.chevron_forward,
|
|
|
|
size: 20, color: theme.palette.tertiaryText)
|
|
|
|
else
|
2022-09-06 18:28:12 +02:00
|
|
|
const SizedBox(width: 2),
|
|
|
|
const SizedBox(width: 8),
|
2021-06-14 05:28:12 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2019-02-08 16:20:28 +01:00
|
|
|
}
|