ente/lib/ui/viewer/file/file_icons_widget.dart

151 lines
3.7 KiB
Dart
Raw Normal View History

2022-07-02 17:30:04 +00:00
import 'package:flutter/material.dart';
2022-07-03 05:37:04 +00:00
import 'package:photos/ente_theme_data.dart';
2022-07-02 17:30:04 +00:00
import 'package:photos/models/trash_file.dart';
import 'package:photos/theme/colors.dart';
2022-07-02 17:30:04 +00:00
import 'package:photos/utils/date_time_util.dart';
class ThumbnailPlaceHolder extends StatelessWidget {
2022-10-19 09:02:33 +00:00
const ThumbnailPlaceHolder({Key? key}) : super(key: key);
2022-07-02 17:30:04 +00:00
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
2022-07-03 05:37:04 +00:00
color: Theme.of(context).colorScheme.galleryThumbBackgroundColor,
2022-07-02 17:30:04 +00:00
);
}
}
class UnSyncedIcon extends StatelessWidget {
2022-10-19 09:02:33 +00:00
const UnSyncedIcon({Key? key}) : super(key: key);
2022-07-02 17:30:04 +00:00
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black.withOpacity(0.6),
],
stops: const [0.75, 1],
),
),
child: Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(right: 8, bottom: 4),
child: Icon(
Icons.cloud_off_outlined,
size: 18,
color: Colors.white.withOpacity(0.9),
),
),
),
);
}
}
class VideoOverlayIcon extends StatelessWidget {
2022-10-19 09:02:33 +00:00
const VideoOverlayIcon({Key? key}) : super(key: key);
2022-07-02 17:30:04 +00:00
@override
Widget build(BuildContext context) {
2022-07-04 06:02:17 +00:00
return const SizedBox(
2022-07-02 17:30:04 +00:00
height: 64,
child: Icon(
Icons.play_circle_outline,
size: 40,
color: Colors.white70,
),
);
}
}
class LivePhotoOverlayIcon extends StatelessWidget {
2022-10-19 09:02:33 +00:00
const LivePhotoOverlayIcon({Key? key}) : super(key: key);
2022-07-02 17:30:04 +00:00
@override
Widget build(BuildContext context) {
return const Align(
alignment: Alignment.bottomRight,
2022-07-02 17:30:04 +00:00
child: Padding(
padding: EdgeInsets.only(right: 4, bottom: 4),
2022-07-02 17:30:04 +00:00
child: Icon(
Icons.album_outlined,
2022-07-02 17:30:04 +00:00
size: 14,
color: Colors.white, // fixed
2022-07-02 17:30:04 +00:00
),
),
);
}
}
2022-11-17 05:30:51 +00:00
class FavoriteOverlayIcon extends StatelessWidget {
const FavoriteOverlayIcon({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Align(
alignment: Alignment.bottomLeft,
child: Padding(
padding: EdgeInsets.only(left: 4, bottom: 4),
child: Icon(
Icons.favorite_rounded,
size: 20,
color: Colors.white, // fixed
),
),
);
}
}
2022-07-02 17:30:04 +00:00
class TrashedFileOverlayText extends StatelessWidget {
final TrashFile file;
2022-10-19 09:02:33 +00:00
const TrashedFileOverlayText(this.file, {Key? key}) : super(key: key);
2022-07-02 17:30:04 +00:00
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [Colors.black.withOpacity(0.33), Colors.transparent],
),
),
2022-07-03 09:45:00 +00:00
alignment: Alignment.bottomCenter,
2022-07-04 06:02:17 +00:00
padding: const EdgeInsets.only(bottom: 5),
2022-07-02 17:30:04 +00:00
child: Text(
daysLeft(file.deleteBy),
style: Theme.of(context)
.textTheme
2022-10-19 09:02:33 +00:00
.subtitle2!
2022-07-02 17:30:04 +00:00
.copyWith(color: Colors.white), //same for both themes
),
);
}
}
class ArchiveOverlayIcon extends StatelessWidget {
2022-10-19 09:02:33 +00:00
const ArchiveOverlayIcon({Key? key}) : super(key: key);
2022-07-02 17:30:04 +00:00
@override
Widget build(BuildContext context) {
return const Align(
alignment: Alignment.bottomLeft,
2022-07-02 17:30:04 +00:00
child: Padding(
padding: EdgeInsets.only(left: 4, bottom: 4),
2022-07-02 17:30:04 +00:00
child: Icon(
Icons.archive_outlined,
size: 20,
color: strokeMutedDark,
2022-07-02 17:30:04 +00:00
),
),
);
}
}