Set a blurred backdrop to memories
This commit is contained in:
parent
904c63f040
commit
54984ad661
2 changed files with 37 additions and 1 deletions
28
lib/ui/blurred_file_backdrop.dart
Normal file
28
lib/ui/blurred_file_backdrop.dart
Normal file
|
@ -0,0 +1,28 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:photos/models/file.dart';
|
||||
import 'package:photos/ui/thumbnail_widget.dart';
|
||||
|
||||
class BlurredFileBackdrop extends StatelessWidget {
|
||||
final File file;
|
||||
|
||||
BlurredFileBackdrop(this.file, {Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(children: [
|
||||
ThumbnailWidget(
|
||||
file,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
BackdropFilter(
|
||||
filter: new ImageFilter.blur(sigmaX: 64.0, sigmaY: 64.0),
|
||||
child: new Container(
|
||||
decoration: new BoxDecoration(color: Colors.white.withOpacity(0.0)),
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import 'package:flutter_swiper/flutter_swiper.dart';
|
|||
import 'package:photos/memories_service.dart';
|
||||
import 'package:photos/models/file_type.dart';
|
||||
import 'package:photos/models/memory.dart';
|
||||
import 'package:photos/ui/blurred_file_backdrop.dart';
|
||||
import 'package:photos/ui/thumbnail_widget.dart';
|
||||
import 'package:photos/ui/video_widget.dart';
|
||||
import 'package:photos/ui/zoomable_image.dart';
|
||||
|
@ -255,16 +256,23 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
|
|||
return Swiper(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final file = widget.memories[index].file;
|
||||
return file.fileType == FileType.image
|
||||
final view = file.fileType == FileType.image
|
||||
? ZoomableImage(
|
||||
file,
|
||||
tagPrefix: "memories",
|
||||
backgroundDecoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
)
|
||||
: VideoWidget(
|
||||
file,
|
||||
tagPrefix: "memories",
|
||||
autoPlay: true,
|
||||
);
|
||||
return Stack(children: [
|
||||
BlurredFileBackdrop(file),
|
||||
view,
|
||||
]);
|
||||
},
|
||||
itemCount: widget.memories.length,
|
||||
pagination: SwiperPagination(
|
||||
|
|
Loading…
Add table
Reference in a new issue