diff --git a/lib/core/widget/ad_widget.dart b/lib/core/widget/ad_widget.dart index 6539529..4ebc3bd 100644 --- a/lib/core/widget/ad_widget.dart +++ b/lib/core/widget/ad_widget.dart @@ -13,89 +13,87 @@ class AdWidget extends StatelessWidget { final themeData = Theme.of(context); return Container( padding: const EdgeInsets.all(16), - child: Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - AdvertiserRowWidget( - advertiserId: amityAd.advertiserId ?? '', - companyName: amityAd.advertiser?.companyName, - advertiserAvatar: amityAd.advertiser?.avatar), - Text( - 'Ad id - ${amityAd.adId}', - style: themeData.textTheme.bodySmall, - ), - Text( - 'Target - ${amityAd.adTarget}', - style: themeData.textTheme.bodySmall, - ), - Text( - 'Placements - ${amityAd.placements}', - style: themeData.textTheme.bodySmall, - ), - Text( - 'Start at - ${amityAd.startAt ?? 'N/A'}', - style: themeData.textTheme.bodySmall, - ), - Text( - 'End at - ${amityAd.endAt ?? 'forever'}', - style: themeData.textTheme.bodySmall, - ), - Text( - 'Name - ${amityAd.name}', - style: themeData.textTheme.titleMedium, - ), - Text( - 'Headline - ${amityAd.headline ?? 'N/A - Headline is not available'}', - style: themeData.textTheme.titleLarge, - ), - Text( - 'Description - ${amityAd.description ?? 'N/A - Description is not available'}', - style: themeData.textTheme.bodyMedium, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + AdvertiserRowWidget( + advertiserId: amityAd.advertiserId ?? '', + companyName: amityAd.advertiser?.companyName, + advertiserAvatar: amityAd.advertiser?.avatar), + Text( + 'Ad id - ${amityAd.adId}', + style: themeData.textTheme.bodySmall, + ), + Text( + 'Target - ${amityAd.adTarget}', + style: themeData.textTheme.bodySmall, + ), + Text( + 'Placements - ${amityAd.placements}', + style: themeData.textTheme.bodySmall, + ), + Text( + 'Start at - ${amityAd.startAt ?? 'N/A'}', + style: themeData.textTheme.bodySmall, + ), + Text( + 'End at - ${amityAd.endAt ?? 'forever'}', + style: themeData.textTheme.bodySmall, + ), + Text( + 'Name - ${amityAd.name}', + style: themeData.textTheme.titleMedium, + ), + Text( + 'Headline - ${amityAd.headline ?? 'N/A - Headline is not available'}', + style: themeData.textTheme.titleLarge, + ), + Text( + 'Description - ${amityAd.description ?? 'N/A - Description is not available'}', + style: themeData.textTheme.bodyMedium, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + margin: const EdgeInsets.all(4), + color: Colors.blueGrey.withOpacity(.25), + width: 130, + height: 130, + child: (amityAd.image1_1 != null) + ? Image.network( + amityAd.image1_1!.getUrl(AmityImageSize.MEDIUM), + fit: BoxFit.cover, + ) + : const Align( + alignment: Alignment.center, + child: Text( + "1:1 Ad image is not available", + textAlign: TextAlign.center, + ), + ), + ), + Container( margin: const EdgeInsets.all(4), color: Colors.blueGrey.withOpacity(.25), width: 130, height: 130, - child: (amityAd.image1_1 != null) + child: (amityAd.image9_16 != null) ? Image.network( - amityAd.image1_1!.getUrl(AmityImageSize.MEDIUM), - fit: BoxFit.cover, + amityAd.image9_16!.getUrl(AmityImageSize.MEDIUM), + fit: BoxFit.fitWidth, ) : const Align( alignment: Alignment.center, child: Text( - "1:1 Ad image is not available", + "9:16 Ad image is not available", textAlign: TextAlign.center, ), - ), - ), - Container( - margin: const EdgeInsets.all(4), - color: Colors.blueGrey.withOpacity(.25), - width: 130, - height: 130, - child: (amityAd.image9_16 != null) - ? Image.network( - amityAd.image9_16!.getUrl(AmityImageSize.MEDIUM), - fit: BoxFit.fitWidth, - ) - : const Align( - alignment: Alignment.center, - child: Text( - "9:16 Ad image is not available", - textAlign: TextAlign.center, - ), - )) - ]), - ], - ), + )) + ]), + ], ), ); }