mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +00:00
84 lines
2.6 KiB
Dart
84 lines
2.6 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: index == 0 && active
|
|
? ColorsManager.blue1.withOpacity(0.9)
|
|
: index == 1 && active
|
|
? ColorsManager.blue2.withOpacity(0.9)
|
|
: index == 2 && active
|
|
? ColorsManager.blue3
|
|
: index == 4 && active == false
|
|
? ColorsManager.blue4.withOpacity(0.2)
|
|
: index == 7 && active == false
|
|
? ColorsManager.blue4.withOpacity(0.2)
|
|
: ColorsManager.blueColor.withOpacity(0.2),
|
|
// (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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|