feat: Added pageview animation when picture modal clicked

This commit is contained in:
Deven Joshi
2020-12-02 20:09:17 +05:30
parent 8acdd0939a
commit c99d908e69
2 changed files with 33 additions and 13 deletions
+8
View File
@@ -169,6 +169,14 @@ class _FullScreenMediaState extends State<FullScreenMedia>
mediaAttachments: widget.mediaAttachments,
message: widget.message,
videoPackages: videoPackages,
mediaSelectedCallBack: (val) {
setState(() {
_currentPage = val;
_pageController.animateToPage(val,
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut);
});
},
),
],
),
+25 -13
View File
@@ -36,6 +36,7 @@ class ImageFooter extends StatefulWidget {
final Message message;
final List<VideoPackage> videoPackages;
final ValueChanged<int> mediaSelectedCallBack;
/// Creates a channel header
ImageFooter({
@@ -48,6 +49,7 @@ class ImageFooter extends StatefulWidget {
this.mediaAttachments,
this.message,
this.videoPackages,
this.mediaSelectedCallBack,
}) : preferredSize = Size.fromHeight(kToolbarHeight),
super(key: key);
@@ -213,23 +215,33 @@ class _ImageFooterState extends State<ImageFooter> {
videoAttachments
.indexOf(widget.mediaAttachments[position])];
return FittedBox(
child: Chewie(
controller: controllerPackage.chewieController,
return InkWell(
onTap: () {
widget.mediaSelectedCallBack(position);
},
child: FittedBox(
child: Chewie(
controller: controllerPackage.chewieController,
),
),
);
} else {
return Padding(
padding: const EdgeInsets.all(1.0),
child: AspectRatio(
child: CachedNetworkImage(
imageUrl:
widget.mediaAttachments[position].imageUrl ??
widget.mediaAttachments[position].assetUrl ??
widget.mediaAttachments[position].thumbUrl,
fit: BoxFit.cover,
return InkWell(
onTap: () {
widget.mediaSelectedCallBack(position);
},
child: Padding(
padding: const EdgeInsets.all(1.0),
child: AspectRatio(
child: CachedNetworkImage(
imageUrl: widget
.mediaAttachments[position].imageUrl ??
widget.mediaAttachments[position].assetUrl ??
widget.mediaAttachments[position].thumbUrl,
fit: BoxFit.cover,
),
aspectRatio: 1.0,
),
aspectRatio: 1.0,
),
);
}