From 9d4ec78b230fe50ba23d5f53c13c3bd6e0b826af Mon Sep 17 00:00:00 2001 From: MohammadTaha Basiri Date: Wed, 9 Mar 2022 18:08:18 +0330 Subject: [PATCH] image captions now work with new api --- lib/views/widgets/didvan/page_view.dart | 71 +++++++++++++------------ 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/lib/views/widgets/didvan/page_view.dart b/lib/views/widgets/didvan/page_view.dart index 799c62e..f0a83d3 100644 --- a/lib/views/widgets/didvan/page_view.dart +++ b/lib/views/widgets/didvan/page_view.dart @@ -193,44 +193,49 @@ class _DidvanPageViewState extends State { }, ); } - if (content.caption != null) { - return Center( - child: DidvanText( - content.caption, - style: Theme.of(context).textTheme.caption, - ), - ); - } + if (content.image != null) { - return GestureDetector( - onTap: () { - showDialog( - context: context, - builder: (context) => Stack( - children: [ - Positioned.fill( - child: InteractiveViewer( - child: Center( - child: SkeletonImage( - width: MediaQuery.of(context).size.width, - imageUrl: content.largeImage ?? content.image, + return Column( + children: [ + GestureDetector( + onTap: () { + showDialog( + context: context, + builder: (context) => Stack( + children: [ + Positioned.fill( + child: InteractiveViewer( + child: Center( + child: SkeletonImage( + width: MediaQuery.of(context).size.width, + imageUrl: content.largeImage ?? content.image, + ), + ), ), ), - ), + const Positioned( + right: 24, + top: 24, + child: _BackButton(), + ), + ], ), - const Positioned( - right: 24, - top: 24, - child: _BackButton(), - ), - ], + ); + }, + child: SkeletonImage( + imageUrl: content.image!, + width: double.infinity, ), - ); - }, - child: SkeletonImage( - imageUrl: content.image!, - width: double.infinity, - ), + ), + if (content.caption != null) + Center( + child: DidvanText( + content.caption, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.caption, + ), + ), + ], ); } return const SizedBox();