41 lines
1.1 KiB
Dart
41 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:photo_gallery/photo_gallery.dart';
|
|
import '/trash/video_provider.dart';
|
|
import 'package:transparent_image/transparent_image.dart';
|
|
|
|
class ViewerPage extends StatelessWidget {
|
|
final Medium medium;
|
|
|
|
ViewerPage(Medium medium) : medium = medium;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
DateTime? date = medium.creationDate ?? medium.modifiedDate;
|
|
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
appBar: AppBar(
|
|
leading: IconButton(
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
icon: const Icon(Icons.arrow_back_ios),
|
|
),
|
|
title: date != null ? Text(date.toLocal().toString()) : null,
|
|
),
|
|
body: Container(
|
|
alignment: Alignment.center,
|
|
child: medium.mediumType == MediumType.image
|
|
? FadeInImage(
|
|
fit: BoxFit.cover,
|
|
placeholder: MemoryImage(kTransparentImage),
|
|
image: PhotoProvider(mediumId: medium.id),
|
|
)
|
|
: VideoProvider(
|
|
mediumId: medium.id,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|