file_icons_widget.dart 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. import 'package:flutter/material.dart';
  2. import 'package:photos/ente_theme_data.dart';
  3. import 'package:photos/models/collection.dart';
  4. import 'package:photos/models/trash_file.dart';
  5. import 'package:photos/theme/colors.dart';
  6. import 'package:photos/ui/sharing/user_avator_widget.dart';
  7. import 'package:photos/utils/date_time_util.dart';
  8. class ThumbnailPlaceHolder extends StatelessWidget {
  9. const ThumbnailPlaceHolder({Key? key}) : super(key: key);
  10. @override
  11. Widget build(BuildContext context) {
  12. return Container(
  13. alignment: Alignment.center,
  14. color: Theme.of(context).colorScheme.galleryThumbBackgroundColor,
  15. );
  16. }
  17. }
  18. class UnSyncedIcon extends StatelessWidget {
  19. const UnSyncedIcon({Key? key}) : super(key: key);
  20. @override
  21. Widget build(BuildContext context) {
  22. return Container(
  23. decoration: const BoxDecoration(
  24. gradient: LinearGradient(
  25. begin: Alignment.centerLeft,
  26. end: Alignment.centerRight,
  27. // background: linear-gradient(73.58deg, rgba(0, 0, 0, 0.3) -6.66%, rgba(255, 255, 255, 0) 44.44%);
  28. colors: [
  29. Color.fromRGBO(255, 255, 255, 0),
  30. Colors.transparent,
  31. // Color.fromRGBO(0, 0, 0, 0.3),
  32. ],
  33. stops: [-0.067, 0.445],
  34. ),
  35. ),
  36. child: const Align(
  37. alignment: Alignment.bottomLeft,
  38. child: Padding(
  39. padding: EdgeInsets.only(left: 4, bottom: 4),
  40. child: Icon(
  41. Icons.cloud_off_outlined,
  42. size: 18,
  43. color: fixedStrokeMutedWhite,
  44. ),
  45. ),
  46. ),
  47. );
  48. }
  49. }
  50. class VideoOverlayIcon extends StatelessWidget {
  51. const VideoOverlayIcon({Key? key}) : super(key: key);
  52. @override
  53. Widget build(BuildContext context) {
  54. return const SizedBox(
  55. height: 64,
  56. child: Icon(
  57. Icons.play_circle_outline,
  58. size: 40,
  59. color: Colors.white70,
  60. ),
  61. );
  62. }
  63. }
  64. class LivePhotoOverlayIcon extends StatelessWidget {
  65. const LivePhotoOverlayIcon({Key? key}) : super(key: key);
  66. @override
  67. Widget build(BuildContext context) {
  68. return const Align(
  69. alignment: Alignment.bottomRight,
  70. child: Padding(
  71. padding: EdgeInsets.only(right: 4, bottom: 4),
  72. child: Icon(
  73. Icons.album_outlined,
  74. size: 14,
  75. color: Colors.white, // fixed
  76. ),
  77. ),
  78. );
  79. }
  80. }
  81. class OwnerAvatarOverlayIcon extends StatelessWidget {
  82. final User user;
  83. const OwnerAvatarOverlayIcon(this.user, {Key? key}) : super(key: key);
  84. @override
  85. Widget build(BuildContext context) {
  86. return Align(
  87. alignment: Alignment.topRight,
  88. child: Padding(
  89. padding: const EdgeInsets.only(right: 4, top: 4),
  90. child: UserAvatarWidget(
  91. user,
  92. type: AvatarType.tiny,
  93. ),
  94. ),
  95. );
  96. }
  97. }
  98. class FavoriteOverlayIcon extends StatelessWidget {
  99. const FavoriteOverlayIcon({Key? key}) : super(key: key);
  100. @override
  101. Widget build(BuildContext context) {
  102. return const Align(
  103. alignment: Alignment.bottomLeft,
  104. child: Padding(
  105. padding: EdgeInsets.only(left: 4, bottom: 4),
  106. child: Icon(
  107. Icons.favorite_rounded,
  108. size: 20,
  109. color: Colors.white, // fixed
  110. ),
  111. ),
  112. );
  113. }
  114. }
  115. class TrashedFileOverlayText extends StatelessWidget {
  116. final TrashFile file;
  117. const TrashedFileOverlayText(this.file, {Key? key}) : super(key: key);
  118. @override
  119. Widget build(BuildContext context) {
  120. return Container(
  121. decoration: BoxDecoration(
  122. gradient: LinearGradient(
  123. begin: Alignment.bottomCenter,
  124. end: Alignment.topCenter,
  125. colors: [Colors.black.withOpacity(0.33), Colors.transparent],
  126. ),
  127. ),
  128. alignment: Alignment.bottomCenter,
  129. padding: const EdgeInsets.only(bottom: 5),
  130. child: Text(
  131. daysLeft(file.deleteBy),
  132. style: Theme.of(context)
  133. .textTheme
  134. .subtitle2!
  135. .copyWith(color: Colors.white), //same for both themes
  136. ),
  137. );
  138. }
  139. }
  140. class ArchiveOverlayIcon extends StatelessWidget {
  141. const ArchiveOverlayIcon({Key? key}) : super(key: key);
  142. @override
  143. Widget build(BuildContext context) {
  144. return const Align(
  145. alignment: Alignment.bottomLeft,
  146. child: Padding(
  147. padding: EdgeInsets.only(left: 4, bottom: 4),
  148. child: Icon(
  149. Icons.archive_outlined,
  150. size: 20,
  151. color: fixedStrokeMutedWhite,
  152. ),
  153. ),
  154. );
  155. }
  156. }