update
This commit is contained in:
parent
bda39a56d0
commit
37a855cc6c
21 changed files with 176 additions and 226 deletions
|
|
@ -4,12 +4,21 @@ class ImageWidget extends StatelessWidget {
|
|||
final String imagePath;
|
||||
final double size;
|
||||
final bool measureByHeight;
|
||||
const ImageWidget({super.key, required this.imagePath, required this.size, required this.measureByHeight});
|
||||
final bool? network;
|
||||
const ImageWidget(
|
||||
{super.key, required this.imagePath, required this.size, required this.measureByHeight, this.network});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return (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());
|
||||
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())
|
||||
: (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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue