mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Home page UI
This commit is contained in:
73
lib/pages/home/view/home_card.dart
Normal file
73
lib/pages/home/view/home_card.dart
Normal file
@ -0,0 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../../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, 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: [
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user