Added widgets
This commit is contained in:
parent
8d382ad937
commit
e38801dcf6
3 changed files with 56 additions and 10 deletions
|
|
@ -5,20 +5,30 @@ class ImageWidget extends StatelessWidget {
|
|||
final double size;
|
||||
final bool measureByHeight;
|
||||
final bool? network;
|
||||
const ImageWidget(
|
||||
{super.key, required this.imagePath, required this.size, required this.measureByHeight, this.network});
|
||||
const ImageWidget({
|
||||
super.key,
|
||||
required this.imagePath,
|
||||
required this.size,
|
||||
required this.measureByHeight,
|
||||
this.network,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return (network == true)
|
||||
? (measureByHeight)
|
||||
? Image.network(imagePath,
|
||||
height: size, cacheHeight: (size * MediaQuery.of(context).devicePixelRatio).round())
|
||||
: Image.network(imagePath,
|
||||
width: size, cacheWidth: (size * MediaQuery.of(context).devicePixelRatio).round())
|
||||
? Image.network(
|
||||
imagePath,
|
||||
height: size,
|
||||
cacheHeight: (size * MediaQuery.of(context).devicePixelRatio).round(),
|
||||
)
|
||||
: Image.network(
|
||||
imagePath,
|
||||
width: size,
|
||||
cacheWidth: (size * MediaQuery.of(context).devicePixelRatio).round(),
|
||||
)
|
||||
: (measureByHeight)
|
||||
? Image.asset(imagePath,
|
||||
height: size, cacheHeight: (size * MediaQuery.of(context).devicePixelRatio).round())
|
||||
: Image.asset(imagePath, width: size, cacheWidth: (size * MediaQuery.of(context).devicePixelRatio).round());
|
||||
? Image.asset(imagePath, height: size, cacheHeight: (size * MediaQuery.of(context).devicePixelRatio).round())
|
||||
: Image.asset(imagePath, width: size, cacheWidth: (size * MediaQuery.of(context).devicePixelRatio).round());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue