feat: merchant
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../sample/sample_data.dart';
|
||||
import '../../../components/image/image.dart';
|
||||
import '../merchant_page.dart';
|
||||
|
||||
class MerchantCard extends StatelessWidget {
|
||||
final MerchantModel merchant;
|
||||
@@ -44,35 +44,44 @@ class MerchantCard extends StatelessWidget {
|
||||
topLeft: Radius.circular(8),
|
||||
topRight: Radius.circular(8),
|
||||
),
|
||||
child: Image.network(
|
||||
merchant.imageUrl,
|
||||
width: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: AppColor.primary,
|
||||
value: loadingProgress.expectedTotalBytes != null
|
||||
? loadingProgress.cumulativeBytesLoaded /
|
||||
loadingProgress.expectedTotalBytes!
|
||||
: null,
|
||||
),
|
||||
child: merchant.imageUrl.startsWith('assets')
|
||||
? Image.asset(
|
||||
merchant.imageUrl,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return ImagePlaceholder(width: 60, height: 60);
|
||||
},
|
||||
)
|
||||
: Image.network(
|
||||
merchant.imageUrl,
|
||||
width: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: AppColor.primary,
|
||||
value:
|
||||
loadingProgress.expectedTotalBytes != null
|
||||
? loadingProgress.cumulativeBytesLoaded /
|
||||
loadingProgress.expectedTotalBytes!
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return ImagePlaceholder(
|
||||
width: double.infinity,
|
||||
height: 100,
|
||||
showBorderRadius: false,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return ImagePlaceholder(
|
||||
width: double.infinity,
|
||||
height: 100,
|
||||
showBorderRadius: false,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
Reference in New Issue
Block a user