11import 'dart:io' ;
2- import 'dart:ui' as ui show Codec, FrameInfo, Image;
2+ import 'dart:ui' as ui show Image;
33
44import 'package:auto_size_text/auto_size_text.dart' ;
55import 'package:extended_text/extended_text.dart' ;
@@ -17,8 +17,7 @@ import 'package:provider/provider.dart';
1717import 'package:video_player/video_player.dart' ;
1818
1919class ImageDetailsCard extends StatelessWidget {
20- const ImageDetailsCard ({Key ? key, required this .image, this .onRemove})
21- : super (key: key);
20+ const ImageDetailsCard ({Key ? key, required this .image, this .onRemove}) : super (key: key);
2221
2322 final ImageModel image;
2423 final Function ()? onRemove;
@@ -57,9 +56,7 @@ class ImageDetailsCard extends StatelessWidget {
5756 child: ClipRRect (
5857 borderRadius: BorderRadius .circular (5.0 ),
5958 child: Builder (builder: (context) {
60- final String ? imageUrl = image
61- .getDerivativeFromString (Preferences .getImageThumbnailSize)
62- ? .url;
59+ final String ? imageUrl = image.getDerivativeFromString (Preferences .getImageThumbnailSize)? .url;
6360 return ImageNetworkDisplay (
6461 imageUrl: imageUrl,
6562 );
@@ -91,10 +88,7 @@ class ImageDetailsCard extends StatelessWidget {
9188 children: [
9289 Flexible (
9390 child: Text (
94- image.file
95- .replaceAll ('' , '\u 200B' )
96- .split (path.extension (image.file))
97- .first,
91+ image.file.replaceAll ('' , '\u 200B' ).split (path.extension (image.file)).first,
9892 maxLines: 1 ,
9993 overflow: TextOverflow .ellipsis,
10094 style: Theme .of (context).textTheme.bodySmall,
@@ -112,13 +106,11 @@ class ImageDetailsCard extends StatelessWidget {
112106 const Spacer (),
113107 if (image.dateAvailable != null )
114108 Builder (builder: (context) {
115- LocaleNotifier localeNotifier =
116- Provider .of <LocaleNotifier >(context, listen: false );
109+ LocaleNotifier localeNotifier = Provider .of <LocaleNotifier >(context, listen: false );
117110 String date =
118- DateFormat .yMMMMd (localeNotifier.locale.languageCode)
119- .format (DateTime .parse (image.dateAvailable! ));
120- String time = DateFormat .Hms (localeNotifier.locale.languageCode)
121- .format (DateTime .parse (image.dateAvailable! ));
111+ DateFormat .yMMMMd (localeNotifier.locale.languageCode).format (DateTime .parse (image.dateAvailable! ));
112+ String time =
113+ DateFormat .Hms (localeNotifier.locale.languageCode).format (DateTime .parse (image.dateAvailable! ));
122114 return AutoSizeText (
123115 "$date $time " ,
124116 maxLines: 1 ,
@@ -150,8 +142,7 @@ class ImageDetailsCard extends StatelessWidget {
150142}
151143
152144class LocalImageDetailsCard extends StatefulWidget {
153- const LocalImageDetailsCard (
154- {Key ? key, required this .image, this .onRemove, this .isDuplicate = false })
145+ const LocalImageDetailsCard ({Key ? key, required this .image, this .onRemove, this .isDuplicate = false })
155146 : super (key: key);
156147
157148 final File image;
@@ -214,17 +205,12 @@ class _LocalImageDetailsCardState extends State<LocalImageDetailsCard> {
214205 fit: StackFit .expand,
215206 children: [
216207 LayoutBuilder (builder: (context, constraints) {
217- List <String >? mimeType =
218- mime (widget.image.path.split ('/' ).last)? .split ('/' );
208+ List <String >? mimeType = mime (widget.image.path.split ('/' ).last)? .split ('/' );
219209
220210 if (mimeType? .first == 'image' ) {
221211 _checkMemory ();
222- double ? cacheWidth = constraints.maxWidth.isInfinite
223- ? constraints.maxWidth
224- : null ;
225- double ? cacheHeight = constraints.maxHeight.isInfinite
226- ? constraints.maxHeight
227- : null ;
212+ double ? cacheWidth = constraints.maxWidth.isInfinite ? constraints.maxWidth : null ;
213+ double ? cacheHeight = constraints.maxHeight.isInfinite ? constraints.maxHeight : null ;
228214 return Image .file (
229215 widget.image,
230216 fit: BoxFit .cover,
@@ -327,8 +313,7 @@ class _LocalImageDetailsCardState extends State<LocalImageDetailsCard> {
327313}
328314
329315class LocalVideoDetailsCard extends StatefulWidget {
330- const LocalVideoDetailsCard (
331- {Key ? key, required this .video, this .onRemove, this .isDuplicate = false })
316+ const LocalVideoDetailsCard ({Key ? key, required this .video, this .onRemove, this .isDuplicate = false })
332317 : super (key: key);
333318
334319 final File video;
@@ -361,9 +346,7 @@ class _LocalVideoDetailsCardState extends State<LocalVideoDetailsCard> {
361346 final Duration duration = _controller.value.duration;
362347 int hours = duration.inHours;
363348 int minutes = (duration - Duration (hours: hours)).inMinutes;
364- int seconds =
365- (duration - Duration (hours: hours) - Duration (minutes: minutes))
366- .inSeconds;
349+ int seconds = (duration - Duration (hours: hours) - Duration (minutes: minutes)).inSeconds;
367350 return '${hours > 0 ? '$hours :' : '' }${minutes < 10 ? '0$minutes ' : '$minutes ' }:${seconds < 10 ? '0$seconds ' : '$seconds ' }' ;
368351 }
369352
@@ -433,17 +416,12 @@ class _LocalVideoDetailsCardState extends State<LocalVideoDetailsCard> {
433416 bottom: 2.0 ,
434417 left: 2.0 ,
435418 child: Container (
436- padding: const EdgeInsets .symmetric (
437- horizontal: 4 , vertical: 2 ),
419+ padding: const EdgeInsets .symmetric (horizontal: 4 , vertical: 2 ),
438420 decoration: BoxDecoration (
439- borderRadius: BorderRadius .circular (5 ),
440- color: AppColors .black.withOpacity (0.7 )),
421+ borderRadius: BorderRadius .circular (5 ), color: AppColors .black.withOpacity (0.7 )),
441422 child: Text (
442423 _duration,
443- style: TextStyle (
444- color: AppColors .white,
445- fontSize: 10 ,
446- fontWeight: FontWeight .bold),
424+ style: TextStyle (color: AppColors .white, fontSize: 10 , fontWeight: FontWeight .bold),
447425 ),
448426 ),
449427 ),
0 commit comments