image captions now work with new api

This commit is contained in:
MohammadTaha Basiri 2022-03-09 18:08:18 +03:30
parent 71a5bda8c9
commit 9d4ec78b23
1 changed files with 38 additions and 33 deletions

View File

@ -193,44 +193,49 @@ class _DidvanPageViewState extends State<DidvanPageView> {
}, },
); );
} }
if (content.caption != null) {
return Center(
child: DidvanText(
content.caption,
style: Theme.of(context).textTheme.caption,
),
);
}
if (content.image != null) { if (content.image != null) {
return GestureDetector( return Column(
onTap: () { children: [
showDialog( GestureDetector(
context: context, onTap: () {
builder: (context) => Stack( showDialog(
children: [ context: context,
Positioned.fill( builder: (context) => Stack(
child: InteractiveViewer( children: [
child: Center( Positioned.fill(
child: SkeletonImage( child: InteractiveViewer(
width: MediaQuery.of(context).size.width, child: Center(
imageUrl: content.largeImage ?? content.image, 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: SkeletonImage(
child: _BackButton(), imageUrl: content.image!,
), width: double.infinity,
],
), ),
); ),
}, if (content.caption != null)
child: SkeletonImage( Center(
imageUrl: content.image!, child: DidvanText(
width: double.infinity, content.caption,
), textAlign: TextAlign.center,
style: Theme.of(context).textTheme.caption,
),
),
],
); );
} }
return const SizedBox(); return const SizedBox();