Commit 6fcbfba8 authored by DatHV's avatar DatHV
Browse files

update voucher tab

parent d86c3328
import 'package:flutter/material.dart';
Widget loadNetworkImage({
required String? url,
BoxFit fit = BoxFit.cover,
double? width,
double? height,
String placeholderAsset = 'assets/images/sample.png',
}) {
if (url == null || url.isEmpty) {
return Image.asset(
placeholderAsset,
fit: fit,
width: width,
height: height,
);
}
return Image.network(
url,
fit: fit,
width: width,
height: height,
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) return child;
return Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
strokeWidth: 2,
value: loadingProgress.expectedTotalBytes != null
? loadingProgress.cumulativeBytesLoaded /
loadingProgress.expectedTotalBytes!
: null,
),
),
);
},
errorBuilder: (context, error, stackTrace) {
return Image.asset(
placeholderAsset,
fit: fit,
width: width,
height: height,
);
},
);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment