92 lines
2.8 KiB
Dart
92 lines
2.8 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;
|
|
|
|
const CollectionContainer({
|
|
Key? key,
|
|
this.label,
|
|
this.imagesrc,
|
|
this.imageSvg,
|
|
this.width,
|
|
this.height,
|
|
required this.onTapAc,
|
|
this.textColor,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: onTapAc,
|
|
child: Container(
|
|
width: width ?? 130,
|
|
height: height ?? 150,
|
|
decoration: BoxDecoration(
|
|
color: Colors.transparent,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Card(
|
|
// shape: RoundedRectangleBorder(
|
|
// borderRadius: BorderRadius.circular(10.0),
|
|
// ),
|
|
elevation: 5,
|
|
color: const Color.fromARGB(255, 255, 255, 255).withOpacity(0.5),
|
|
child: Stack(
|
|
children: [
|
|
Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(bottom: 30.0),
|
|
child:
|
|
imageSvg != null && imageSvg!.isNotEmpty
|
|
? SvgPicture.asset(
|
|
imageSvg!,
|
|
width: 60,
|
|
height: 60,
|
|
colorFilter: const ColorFilter.mode(
|
|
Colors.white,
|
|
BlendMode.srcIn,
|
|
),
|
|
)
|
|
: imagesrc != null && imagesrc!.isNotEmpty
|
|
? Image.asset(imagesrc!, width: 60, fit: BoxFit.cover)
|
|
: const SizedBox(
|
|
width: 60,
|
|
height: 60,
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.image_not_supported,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
bottom: 10,
|
|
left: 0,
|
|
right: 0,
|
|
child: Text(
|
|
label ?? '',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
color: textColor ?? Colors.black,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|