new content types applied

This commit is contained in:
MohammadTaha Basiri 2022-03-06 18:15:39 +03:30
parent 3c8a9fea22
commit 0d889c7a20
2 changed files with 17 additions and 5 deletions

View File

@ -4,6 +4,8 @@ class Content {
final String? audio;
final String? video;
final String? image;
final String? largeImage;
final String? caption;
const Content({
required this.order,
@ -11,6 +13,8 @@ class Content {
required this.audio,
required this.video,
required this.image,
required this.largeImage,
required this.caption,
});
factory Content.fromJson(Map<String, dynamic> json) => Content(
@ -19,6 +23,8 @@ class Content {
audio: json['audio'],
video: json['video'],
image: json['image'],
largeImage: json['largeImage'],
caption: json['caption'],
);
Map<String, dynamic> toJson() => {
@ -27,5 +33,7 @@ class Content {
'audio': audio,
'video': video,
'image': image,
'largeImage': largeImage,
'caption': caption,
};
}

View File

@ -190,13 +190,17 @@ class _DidvanPageViewState extends State<DidvanPageView> {
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
),
'span': Style(
textAlign: TextAlign.center,
fontSize: FontSize.small,
),
},
);
}
if (content.caption != null) {
return Center(
child: DidvanText(
content.caption,
style: Theme.of(context).textTheme.caption,
),
);
}
if (content.image != null) {
return GestureDetector(
onTap: () {
@ -209,7 +213,7 @@ class _DidvanPageViewState extends State<DidvanPageView> {
child: Center(
child: SkeletonImage(
width: MediaQuery.of(context).size.width,
imageUrl: content.image,
imageUrl: content.largeImage ?? content.image,
),
),
),