Files
syncrow-web/lib/pages/home/view/home_card.dart
2024-08-24 16:37:10 +03:00

76 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/utils/color_manager.dart';
class HomeCard extends StatelessWidget {
final bool active;
final String img;
final int index;
final String name;
final Function()? onTap;
const HomeCard({
super.key,
required this.name,
required this.index,
this.active = false,
required this.img,
required this.onTap,
});
@override
Widget build(BuildContext context) {
bool evenNumbers = index % 2 == 0;
return InkWell(
onTap: active ? onTap : null,
child: Container(
padding: const EdgeInsets.only(left: 10, right: 10, bottom: 10),
decoration: BoxDecoration(
color: evenNumbers && active
? ColorsManager.blueColor.withOpacity(0.8)
: (active
? ColorsManager.blueColor
: ColorsManager.blueColor.withOpacity(0.2)),
borderRadius: BorderRadius.circular(30),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Flexible(
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text(
name,
style: const TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
const SizedBox(height: 10),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
child: SvgPicture.asset(
img,
),
),
],
),
),
],
),
),
);
}
}