FreekakeApp/lib/components/collection_container copy.dart
2025-04-09 16:28:42 +07:00

146 lines
5.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class CollectionContainer extends StatelessWidget {
final String? label;
final String? imagesrc;
final String? imageSvg;
final double? width;
final double? height;
final double? iconw;
final double? iconh;
final VoidCallback onTapAc;
final Color? textColor;
final double? lblSize;
final bool? circle;
const CollectionContainer({
super.key,
this.label,
this.imagesrc,
this.width,
this.height,
required this.onTapAc,
this.textColor,
this.imageSvg,
this.iconh,
this.iconw,
this.lblSize,
this.circle,
});
@override
Widget build(BuildContext context) {
return Container(
width: width ?? 130,
height: height ?? 150,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(10)),
child: GestureDetector(
onTap: onTapAc,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
color: const Color.fromARGB(255, 255, 255, 255).withOpacity(0.5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(12),
child:
imageSvg != null && imageSvg!.isNotEmpty
? Container(
decoration:
(circle ?? false)
? BoxDecoration(
color: const Color.fromARGB(
225,
79,
76,
182,
),
borderRadius: BorderRadius.circular(50),
)
: null,
child: Container(
decoration:
(circle ?? false)
? BoxDecoration(
color: const Color.fromARGB(
225,
79,
76,
182,
),
borderRadius: BorderRadius.circular(50),
shape: BoxShape.circle,
)
: null,
child: Container(
decoration:
(circle ?? false)
? BoxDecoration(
color: const Color.fromARGB(
225,
79,
76,
182,
),
borderRadius: BorderRadius.circular(50),
shape: BoxShape.circle,
)
: null,
child: SvgPicture.asset(
imageSvg!,
width: 20,
height: 20,
colorFilter: const ColorFilter.mode(
Color.fromARGB(255, 118, 3, 3),
BlendMode.srcIn,
),
),
),
),
)
: imagesrc != null && imagesrc!.isNotEmpty
? Image.asset(
imagesrc!,
width: iconw ?? 60,
height: iconh ?? 60,
fit: BoxFit.cover,
)
: const SizedBox(
width: 60,
height: 60,
child: Center(
child: Icon(
Icons.image_not_supported,
color: Colors.white,
),
),
),
),
SizedBox(height: 8),
Positioned(
bottom: 0,
child: Container(
// color: Colors.amber,
child: Text(
label ?? '',
style: TextStyle(
fontSize: lblSize ?? 14,
fontWeight: FontWeight.bold,
color: textColor,
),
),
),
),
],
),
),
),
);
}
}