first commit

This commit is contained in:
2026-02-07 15:57:09 +07:00
commit 157096f164
1153 changed files with 415766 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
import 'dart:io';
import 'package:flutter/material.dart';
class UniversalImage extends StatelessWidget {
final String? imagePath;
final double? height;
final double? width;
final BoxFit fit;
final Widget? placeholder;
const UniversalImage({
super.key,
required this.imagePath,
this.height,
this.width,
this.fit = BoxFit.contain,
this.placeholder,
});
@override
Widget build(BuildContext context) {
if (imagePath == null || imagePath!.isEmpty) {
return _placeholder();
}
/// Network Image
if (imagePath!.startsWith('http')) {
return Image.network(
imagePath!,
height: height,
width: width,
fit: fit,
errorBuilder: (_, __, ___) => _placeholder(),
);
}
/// Local File Image
if (imagePath!.startsWith('/')) {
return Image.file(
File(imagePath!),
height: height,
width: width,
fit: fit,
errorBuilder: (_, __, ___) => _placeholder(),
);
}
/// Asset Image
return Image.asset(
imagePath!,
height: height,
width: width,
fit: fit,
errorBuilder: (_, __, ___) => _placeholder(),
);
}
Widget _placeholder() {
return placeholder ??
SizedBox(
height: height,
width: width,
child: const Icon(Icons.image_not_supported, size: 40),
);
}
}