mirror of
https://github.com/immich-app/immich.git
synced 2025-06-21 14:31:03 -04:00
* wip: timeline * more segment extensions * added scrubber * refactor: timeline state * more refactors * fix scrubber segments * added remote thumb & thumbhash provider * feat: merged view * scrub / merged asset fixes * rename stuff & add tile indicators * fix local album timeline query * ignore hidden assets during sync * ignore recovered assets during sync * old scrubber * add video indicator * handle groupBy * handle partner inTimeline * show duration * reduce widget nesting in thumb tile * merge main * chore: extend cacheExtent * ignore touch events on scrub label when not visible * scrub label ignore events and hide immediately * auto reload on sync * refactor image providers * throttle db updates --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
61 lines
1.9 KiB
Dart
61 lines
1.9 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:immich_mobile/domain/models/timeline.model.dart';
|
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
|
|
|
class TimelineHeader extends StatelessWidget {
|
|
final Bucket bucket;
|
|
final HeaderType header;
|
|
final double height;
|
|
|
|
const TimelineHeader({
|
|
super.key,
|
|
required this.bucket,
|
|
required this.header,
|
|
required this.height,
|
|
});
|
|
|
|
String _formatMonth(BuildContext context, DateTime date) {
|
|
final formatter = date.year == DateTime.now().year
|
|
? DateFormat.MMMM(context.locale.toLanguageTag())
|
|
: DateFormat.yMMMM(context.locale.toLanguageTag());
|
|
return formatter.format(date);
|
|
}
|
|
|
|
String _formatDay(BuildContext context, DateTime date) {
|
|
final formatter = DateFormat.yMMMEd(context.locale.toLanguageTag());
|
|
return formatter.format(date);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (bucket is! TimeBucket || header == HeaderType.none) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
|
|
final date = (bucket as TimeBucket).date;
|
|
return Container(
|
|
padding: const EdgeInsets.only(left: 10, top: 30, bottom: 10),
|
|
height: height,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
if (header == HeaderType.month || header == HeaderType.monthAndDay)
|
|
Text(
|
|
_formatMonth(context, date),
|
|
style: context.textTheme.labelLarge
|
|
?.copyWith(fontSize: 24, fontWeight: FontWeight.w500),
|
|
),
|
|
if (header == HeaderType.day || header == HeaderType.monthAndDay)
|
|
Text(
|
|
_formatDay(context, date),
|
|
style: context.textTheme.labelLarge
|
|
?.copyWith(fontWeight: FontWeight.w500),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|