ImageWidget constructor

const ImageWidget({
  1. Key? key,
  2. required String? imageUrl,
  3. double? width,
  4. double? height,
  5. BoxFit fit = BoxFit.cover,
  6. double radius = 0,
  7. Widget errorWidget(
    1. BuildContext,
    2. dynamic,
    3. dynamic
    )?,
  8. Widget placeholder(
    1. BuildContext
    )?,
  9. Color? color,
  10. bool circle = false,
})

Trả về hình ảnh tương ứng với imageUrl có thể là một URL hoặc một đường dẫn tới file ảnh trong thư mục assets, hoặc là đường dẫn trỏ tới file trong máy.

Nếu imageUrl không phải 3 loại phía trên, thì sẽ trả về errorWidget, trong trường hợp không có errorWidget thì sẽ trả về defaultError.

Implementation

const ImageWidget({
  Key? key,
  required this.imageUrl,
  this.width,
  this.height,
  this.fit = BoxFit.cover,
  this.radius = 0,
  this.errorWidget,
  this.placeholder,
  this.color,
  this.circle = false,
}) : super(key: key);