- WhiteCard usa Theme.cardColor en lugar de Colors.white fijo - Dropdown ciudad: normaliza valor guardado vs lista (evita mismatch) - Muestra spinner mientras cargan las ciudades - Texto de items adapta color segun el tema (isDark) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
1.3 KiB
Dart
51 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class WhiteCard extends StatelessWidget {
|
|
final String? title;
|
|
final Widget child;
|
|
final double? width;
|
|
|
|
const WhiteCard({super.key, this.title, required this.child, this.width});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: width, // width == null ? null : width,
|
|
margin: const EdgeInsets.all(8),
|
|
padding: const EdgeInsets.all(10),
|
|
decoration: buildBoxDecoration(context),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (title != null) ...[
|
|
FittedBox(
|
|
fit: BoxFit.contain,
|
|
child: Text(
|
|
title!,
|
|
style: GoogleFonts.roboto(
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
const Divider()
|
|
],
|
|
child
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
BoxDecoration buildBoxDecoration(BuildContext context) {
|
|
final cardColor = Theme.of(context).cardColor;
|
|
return BoxDecoration(
|
|
color: cardColor,
|
|
borderRadius: BorderRadius.circular(5),
|
|
boxShadow: [
|
|
BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 5)
|
|
],
|
|
);
|
|
}
|
|
}
|