131 lines
4.4 KiB
Dart
131 lines
4.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
class CollectionContainer extends StatelessWidget {
|
|
final String? label;
|
|
final String? imagesrc;
|
|
final String? imageSvg;
|
|
final double? width;
|
|
final double? height;
|
|
final VoidCallback onTapAc;
|
|
final Color? textColor;
|
|
final double? iconw;
|
|
final double? iconh;
|
|
final double? lblSize;
|
|
final bool? circle;
|
|
final Color? colorContiner;
|
|
final bool? small;
|
|
|
|
const CollectionContainer({
|
|
super.key,
|
|
this.label,
|
|
this.imagesrc,
|
|
this.imageSvg,
|
|
this.width,
|
|
this.height,
|
|
required this.onTapAc,
|
|
this.textColor,
|
|
this.iconh,
|
|
this.iconw,
|
|
this.lblSize,
|
|
this.circle,
|
|
this.colorContiner,
|
|
this.small,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: onTapAc,
|
|
child: Container(
|
|
// padding: EdgeInsets.only(top: 20),
|
|
width: width ?? 130,
|
|
height: height ?? 170,
|
|
decoration: BoxDecoration(
|
|
color: const Color.fromARGB(0, 83, 246, 8),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Card(
|
|
// shape: RoundedRectangleBorder(
|
|
// borderRadius: BorderRadius.circular(10.0),
|
|
// ),
|
|
elevation: 5,
|
|
color: colorContiner ?? Color.fromRGBO(76, 77, 164, 1.0),
|
|
child: Stack(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Center(
|
|
child: Padding(
|
|
padding:
|
|
(small ?? false)
|
|
? const EdgeInsets.only(bottom: 5.0)
|
|
: const EdgeInsets.only(bottom: 30.0),
|
|
child:
|
|
imageSvg != null && imageSvg!.isNotEmpty
|
|
? Container(
|
|
decoration:
|
|
(circle ?? false)
|
|
? BoxDecoration(
|
|
color: const Color.fromARGB(
|
|
224,
|
|
0,
|
|
0,
|
|
0,
|
|
),
|
|
borderRadius: BorderRadius.circular(50),
|
|
)
|
|
: null,
|
|
child: Padding(
|
|
padding:
|
|
(small ?? false)
|
|
? const EdgeInsets.all(1.0)
|
|
: const EdgeInsets.all(8.0),
|
|
child: SvgPicture.asset(
|
|
imageSvg!,
|
|
width: iconw ?? 40,
|
|
height: iconh ?? 40,
|
|
colorFilter: const ColorFilter.mode(
|
|
Color.fromARGB(255, 242, 242, 242),
|
|
BlendMode.srcIn,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
: imagesrc != null && imagesrc!.isNotEmpty
|
|
? Image.asset(imagesrc!, fit: BoxFit.cover)
|
|
: const SizedBox(
|
|
// width: 60,
|
|
// height: 60,
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.image_not_supported,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
bottom: (small ?? false) ? 0 : 10,
|
|
left: 0,
|
|
right: 0,
|
|
child: Text(
|
|
label ?? '',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: lblSize ?? 14,
|
|
fontWeight: FontWeight.bold,
|
|
color: textColor ?? Colors.black,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|