AmazonImage constructor

AmazonImage(
  1. String asin, {
  2. Key? key,
  3. ImageSize imageSize = ImageSize.Middle,
  4. Function? onTap,
  5. Function? onDoubleTap,
  6. Function? onLongTap,
  7. FunctionBeforeLaunch? functionBeforeLaunch,
  8. FunctionAfterLaunch? functionAfterLaunch,
  9. BoxFit? boxFit,
  10. BuildContext? context,
  11. String? linkUrl,
  12. FractionalOffset offset = FractionalOffset.center,
  13. bool isLaunchAfterTap = false,
  14. bool isLaunchAfterDoubleTap = true,
  15. bool isLaunchAfterLongTap = false,
  16. AmazonImageHolder? holder,
})

AmazonImage is a widget to display an image from amazon.

asin is a amazon's key to specify product. Let's go to amazon's product page and check the url. (Example) https://www.amazon.com/gp/product/B003O2SHKG?pf_rd_r .................. asin must be "B003O2SHKG"

Implementation

AmazonImage(
  this.asin, {
  Key? key,
  this.imageSize = ImageSize.Middle,
  this.onTap,
  this.onDoubleTap,
  this.onLongTap,
  this.functionBeforeLaunch,
  this.functionAfterLaunch,
  this.boxFit,
  this.context,
  String? linkUrl,
  this.offset = FractionalOffset.center,
  this.isLaunchAfterTap = false,
  this.isLaunchAfterDoubleTap = true,
  this.isLaunchAfterLongTap = false,
  this.holder,
}) : super(key: key) {
  assert(onTap == null || !isLaunchAfterTap,
      'onTap must be null when isLaunchAfterTap is true');
  assert(onDoubleTap == null || !isLaunchAfterDoubleTap,
      'onDoubleTap must be null when isLaunchAfterDoubleTap is true');
  assert(onLongTap == null || !isLaunchAfterLongTap,
      'onLongTap must be null when isLaunchAfterLongTap is true');

  setting.CountryKey countryKey =
      setting.countryLocale[setting.AmazonImageSetting().defaultCountry] ??
          setting.CountryKey.USA;
  countryCode = setting.codes[countryKey]!;
  domain = setting.domains[countryKey]!;

  if (linkUrl == null) {
    _linkUrl = getLinkUrl();
  } else {
    _linkUrl = linkUrl;
  }
}