73 lines
2.1 KiB
Dart
73 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../core/constants/app_text_styles.dart';
|
|
|
|
class DashboardCard extends StatefulWidget {
|
|
final String title;
|
|
final Widget content;
|
|
final Widget iconOrAction;
|
|
final Color borderColor;
|
|
|
|
const DashboardCard({
|
|
super.key,
|
|
required this.title,
|
|
required this.content,
|
|
required this.iconOrAction,
|
|
required this.borderColor,
|
|
});
|
|
|
|
@override
|
|
State<DashboardCard> createState() => _DashboardCardState();
|
|
}
|
|
|
|
class _DashboardCardState extends State<DashboardCard>
|
|
with SingleTickerProviderStateMixin {
|
|
bool _isHovered = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MouseRegion(
|
|
onEnter: (_) => setState(() => _isHovered = true),
|
|
onExit: (_) => setState(() => _isHovered = false),
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
curve: Curves.easeInOut,
|
|
transform: Matrix4.identity()..scale(_isHovered ? 1.02 : 1.0),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(
|
|
color: widget.borderColor.withOpacity(_isHovered ? 0.8 : 0.5),
|
|
width: _isHovered ? 2.0 : 1.5,
|
|
),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: _isHovered
|
|
? widget.borderColor.withOpacity(0.3)
|
|
: Colors.black.withOpacity(0.05),
|
|
blurRadius: _isHovered ? 20 : 10,
|
|
spreadRadius: _isHovered ? 2 : 0,
|
|
offset: Offset(0, _isHovered ? 8 : 4),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
widget.content,
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(widget.title, style: AppTextStyles.bodyMedium),
|
|
const SizedBox(height: 8),
|
|
widget.iconOrAction,
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|