import 'package:agrilink_vocpro/core/constant/app_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class DataDisplayerWidget extends StatelessWidget { const DataDisplayerWidget({ super.key, required this.title, required this.subtitle, required this.value, required this.icon, required this.color, this.iconColor = Colors.teal, this.textColor = Colors.black, required this.unit, this.censorIdentifier, this.onTap, }); final String title; final String subtitle; final String value; final IconData icon; final Color color; final Color iconColor; final Color textColor; final String unit; final String? censorIdentifier; final VoidCallback? onTap; @override Widget build(BuildContext context) { return ElevatedButton( onPressed: () { onTap != null ? onTap!() : null; }, style: ElevatedButton.styleFrom( backgroundColor: color, padding: EdgeInsets.all(12.r), // Padding di dalam button shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16.r), // Bentuk sudut yang bundar ), elevation: 20, // Efek bayangan shadowColor: Colors.grey.withValues(alpha: 0.2), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, // Tidak perlu menggunakan mainAxisSize: MainAxisSize.min di sini children: [ Align( alignment: Alignment.centerRight, child: Text( censorIdentifier ?? '', style: AppTheme.labelSmall .copyWith(color: textColor.withValues(alpha: 0.5)), ), ), Icon(icon, color: iconColor, size: 32.r), SizedBox(height: 8.h), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: AppTheme.labelMedium.copyWith(color: textColor), ), Text( subtitle, style: AppTheme.labelSmall .copyWith(color: textColor.withValues(alpha: 0.5)), ), ], ), const Spacer(), Row( children: [ Text( value, style: AppTheme.headline1.copyWith(color: textColor), ), SizedBox(width: 4.w), Text(unit, style: AppTheme.titleMedium.copyWith(color: textColor)), ], ), ], ), ); } }