@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
2
2
import 'package:hooks_riverpod/hooks_riverpod.dart' ;
3
3
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart' ;
4
4
import 'package:immich_mobile/extensions/build_context_extensions.dart' ;
5
+ import 'package:immich_mobile/extensions/duration_extensions.dart' ;
5
6
import 'package:immich_mobile/extensions/theme_extensions.dart' ;
6
7
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart' ;
7
8
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart' ;
@@ -76,23 +77,33 @@ class ThumbnailTile extends ConsumerWidget {
76
77
alignment: Alignment .topRight,
77
78
child: Padding (
78
79
padding: const EdgeInsets .only (right: 10.0 , top: 6.0 ),
79
- child: _VideoIndicator (asset.durationInSeconds ?? 0 ),
80
+ child: _VideoIndicator (asset.duration ),
80
81
),
81
82
),
82
83
if (showStorageIndicator)
83
- Align (
84
- alignment: Alignment .bottomRight,
85
- child: Padding (
86
- padding: const EdgeInsets .only (right: 10.0 , bottom: 6.0 ),
87
- child: _TileOverlayIcon (
88
- switch (asset.storage) {
89
- AssetState .local => Icons .cloud_off_outlined,
90
- AssetState .remote => Icons .cloud_outlined,
91
- AssetState .merged => Icons .cloud_done_outlined,
92
- },
84
+ switch (asset.storage) {
85
+ AssetState .local => const Align (
86
+ alignment: Alignment .bottomRight,
87
+ child: Padding (
88
+ padding: EdgeInsets .only (right: 10.0 , bottom: 6.0 ),
89
+ child: _TileOverlayIcon (Icons .cloud_off_outlined),
90
+ ),
93
91
),
94
- ),
95
- ),
92
+ AssetState .remote => const Align (
93
+ alignment: Alignment .bottomRight,
94
+ child: Padding (
95
+ padding: EdgeInsets .only (right: 10.0 , bottom: 6.0 ),
96
+ child: _TileOverlayIcon (Icons .cloud_outlined),
97
+ ),
98
+ ),
99
+ AssetState .merged => const Align (
100
+ alignment: Alignment .bottomRight,
101
+ child: Padding (
102
+ padding: EdgeInsets .only (right: 10.0 , bottom: 6.0 ),
103
+ child: _TileOverlayIcon (Icons .cloud_done_outlined),
104
+ ),
105
+ ),
106
+ },
96
107
if (asset.isFavorite)
97
108
const Align (
98
109
alignment: Alignment .bottomLeft,
@@ -138,7 +149,7 @@ class _SelectionIndicator extends StatelessWidget {
138
149
@override
139
150
Widget build (BuildContext context) {
140
151
if (isLocked) {
141
- return Container (
152
+ return DecoratedBox (
142
153
decoration: BoxDecoration (
143
154
shape: BoxShape .circle,
144
155
color: color,
@@ -149,7 +160,7 @@ class _SelectionIndicator extends StatelessWidget {
149
160
),
150
161
);
151
162
} else if (isSelected) {
152
- return Container (
163
+ return DecoratedBox (
153
164
decoration: BoxDecoration (
154
165
shape: BoxShape .circle,
155
166
color: color,
@@ -169,23 +180,8 @@ class _SelectionIndicator extends StatelessWidget {
169
180
}
170
181
171
182
class _VideoIndicator extends StatelessWidget {
172
- final int durationInSeconds;
173
- const _VideoIndicator (this .durationInSeconds);
174
-
175
- String _formatDuration (int durationInSec) {
176
- final int hours = durationInSec ~ / 3600 ;
177
- final int minutes = (durationInSec % 3600 ) ~ / 60 ;
178
- final int seconds = durationInSec % 60 ;
179
-
180
- final String minutesPadded = minutes.toString ().padLeft (2 , '0' );
181
- final String secondsPadded = seconds.toString ().padLeft (2 , '0' );
182
-
183
- if (hours > 0 ) {
184
- return "$hours :$minutesPadded :$secondsPadded " ; // H:MM:SS
185
- } else {
186
- return "$minutesPadded :$secondsPadded " ; // MM:SS
187
- }
188
- }
183
+ final Duration duration;
184
+ const _VideoIndicator (this .duration);
189
185
190
186
@override
191
187
Widget build (BuildContext context) {
@@ -197,15 +193,15 @@ class _VideoIndicator extends StatelessWidget {
197
193
crossAxisAlignment: CrossAxisAlignment .end,
198
194
children: [
199
195
Text (
200
- _formatDuration (durationInSeconds ),
201
- style: TextStyle (
196
+ duration. format ( ),
197
+ style: const TextStyle (
202
198
color: Colors .white,
203
199
fontSize: 12 ,
204
200
fontWeight: FontWeight .bold,
205
201
shadows: [
206
202
Shadow (
207
203
blurRadius: 5.0 ,
208
- color: Colors .black. withValues (alpha : 0.6 ),
204
+ color: Color . fromRGBO ( 0 , 0 , 0 , 0.6 ),
209
205
),
210
206
],
211
207
),
@@ -228,10 +224,10 @@ class _TileOverlayIcon extends StatelessWidget {
228
224
color: Colors .white,
229
225
size: 16 ,
230
226
shadows: [
231
- Shadow (
227
+ const Shadow (
232
228
blurRadius: 5.0 ,
233
- color: Colors .black. withValues (alpha : 0.6 ),
234
- offset: const Offset (0.0 , 0.0 ),
229
+ color: Color . fromRGBO ( 0 , 0 , 0 , 0.6 ),
230
+ offset: Offset (0.0 , 0.0 ),
235
231
),
236
232
],
237
233
);
0 commit comments