67 lines
1.8 KiB
Dart
67 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class KanjiCard extends StatelessWidget {
|
|
final String characters;
|
|
final Widget? characterWidget;
|
|
final String subtitle;
|
|
final Color? backgroundColor;
|
|
final Color? textColor;
|
|
|
|
const KanjiCard({
|
|
super.key,
|
|
this.characters = '',
|
|
this.characterWidget,
|
|
this.subtitle = '',
|
|
this.backgroundColor,
|
|
this.textColor,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final bgColor =
|
|
backgroundColor ?? theme.cardTheme.color ?? theme.colorScheme.surface;
|
|
final fgColor =
|
|
textColor ??
|
|
theme.textTheme.bodyMedium?.color ??
|
|
theme.colorScheme.onSurface;
|
|
|
|
return Card(
|
|
elevation: theme.cardTheme.elevation ?? 12,
|
|
color: bgColor,
|
|
shape:
|
|
theme.cardTheme.shape ??
|
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
|
child: SizedBox(
|
|
width: 360,
|
|
height: 240,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
characterWidget ??
|
|
Text(
|
|
characters,
|
|
style: theme.textTheme.headlineMedium?.copyWith(
|
|
fontSize: 56,
|
|
color: fgColor,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
subtitle,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: fgColor.withAlpha((255 * 0.7).round()),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|