full app done
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
/// Visual tiles for a [ValueCard] in hero, sort, and list contexts.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../models/value_card.dart';
|
||||
|
||||
/// Elevated paper card used during sorting and as list detail rows.
|
||||
class ValueCardTile extends StatelessWidget {
|
||||
const ValueCardTile({
|
||||
super.key,
|
||||
required this.card,
|
||||
this.compact = false,
|
||||
this.trailing,
|
||||
this.onTap,
|
||||
this.elevation = 0,
|
||||
});
|
||||
|
||||
final ValueCard card;
|
||||
final bool compact;
|
||||
final Widget? trailing;
|
||||
final VoidCallback? onTap;
|
||||
final double elevation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final text = Theme.of(context).textTheme;
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return Material(
|
||||
color: colors.surfaceContainerLow,
|
||||
elevation: elevation,
|
||||
shadowColor: colors.shadow.withValues(alpha: 0.12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
side: BorderSide(color: colors.outlineVariant),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(compact ? 14 : 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
card.title,
|
||||
style: (compact ? text.titleLarge : text.headlineMedium)
|
||||
?.copyWith(color: colors.onSurface),
|
||||
),
|
||||
),
|
||||
if (trailing != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
trailing!,
|
||||
],
|
||||
],
|
||||
),
|
||||
if (card.description.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
card.description,
|
||||
style: text.bodyMedium?.copyWith(
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
maxLines: compact ? 3 : 5,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Small chip used in overview grids.
|
||||
class ValueChip extends StatelessWidget {
|
||||
const ValueChip({
|
||||
super.key,
|
||||
required this.title,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ActionChip(
|
||||
label: Text(title),
|
||||
onPressed: onTap,
|
||||
visualDensity: VisualDensity.compact,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user