2021-12-07 23:01:23 +05:30
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2021-10-14 14:34:22 +08:00
|
|
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
2021-12-07 23:01:23 +05:30
|
|
|
import 'package:app_flowy/generated/locale_keys.g.dart';
|
2021-10-14 14:34:22 +08:00
|
|
|
|
|
|
|
import 'sizes.dart';
|
|
|
|
|
|
|
|
class TrashHeaderDelegate extends SliverPersistentHeaderDelegate {
|
|
|
|
TrashHeaderDelegate();
|
|
|
|
|
|
|
|
@override
|
2022-11-10 14:22:18 +08:00
|
|
|
Widget build(
|
|
|
|
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
2021-10-14 14:34:22 +08:00
|
|
|
return TrashHeader();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2021-10-14 22:58:20 +08:00
|
|
|
double get maxExtent => TrashSizes.headerHeight;
|
2021-10-14 14:34:22 +08:00
|
|
|
|
|
|
|
@override
|
2021-10-14 22:58:20 +08:00
|
|
|
double get minExtent => TrashSizes.headerHeight;
|
2021-10-14 14:34:22 +08:00
|
|
|
|
|
|
|
@override
|
|
|
|
bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class TrashHeaderItem {
|
|
|
|
double width;
|
|
|
|
String title;
|
|
|
|
|
|
|
|
TrashHeaderItem({required this.width, required this.title});
|
|
|
|
}
|
|
|
|
|
|
|
|
class TrashHeader extends StatelessWidget {
|
|
|
|
final List<TrashHeaderItem> items = [
|
2022-11-10 14:22:18 +08:00
|
|
|
TrashHeaderItem(
|
|
|
|
title: LocaleKeys.trash_pageHeader_fileName.tr(),
|
|
|
|
width: TrashSizes.fileNameWidth),
|
|
|
|
TrashHeaderItem(
|
|
|
|
title: LocaleKeys.trash_pageHeader_lastModified.tr(),
|
|
|
|
width: TrashSizes.lashModifyWidth),
|
|
|
|
TrashHeaderItem(
|
|
|
|
title: LocaleKeys.trash_pageHeader_created.tr(),
|
|
|
|
width: TrashSizes.createTimeWidth),
|
2021-10-14 14:34:22 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
TrashHeader({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final headerItems = List<Widget>.empty(growable: true);
|
|
|
|
items.asMap().forEach((index, item) {
|
|
|
|
headerItems.add(
|
|
|
|
SizedBox(
|
|
|
|
width: item.width,
|
|
|
|
child: FlowyText(
|
|
|
|
item.title,
|
2022-11-10 14:22:18 +08:00
|
|
|
color: Theme.of(context).disabledColor,
|
2021-10-14 14:34:22 +08:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
return Container(
|
2022-11-10 14:22:18 +08:00
|
|
|
color: Theme.of(context).colorScheme.surface,
|
2021-10-14 14:34:22 +08:00
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
...headerItems,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|