Improve item customization sheet UI

- Add item image (100x100) with shadow in header
- Green price badge for base price
- Styled modifier options as cards with blue highlight when selected
- Green price badges for modifier add-on prices
- Large blue "Add to Cart" button with cart icon and price badge
- Centered drag handle at top
- Better visual hierarchy throughout

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-01-05 12:23:23 -08:00
parent 46992bc844
commit 26a8d73b2f

View file

@ -1046,63 +1046,127 @@ class _ItemCustomizationSheetState extends State<_ItemCustomizationSheet> {
builder: (context, scrollController) { builder: (context, scrollController) {
return Column( return Column(
children: [ children: [
// Header // Header with item image
Container( Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface, color: Colors.white,
border: Border( boxShadow: [
bottom: BorderSide( BoxShadow(
color: Theme.of(context).colorScheme.outlineVariant, color: Colors.black.withOpacity(0.05),
width: 1, blurRadius: 10,
offset: const Offset(0, 2),
), ),
), ],
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( // Drag handle
children: [ Center(
Container( child: Container(
width: 12, width: 40,
height: 4, height: 4,
margin: const EdgeInsets.only(right: 8), margin: const EdgeInsets.only(top: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onSurfaceVariant, color: Colors.grey.shade300,
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
),
), ),
], ),
), ),
const SizedBox(height: 16), Padding(
Text( padding: const EdgeInsets.all(20),
widget.item.name, child: Row(
style: Theme.of(context).textTheme.headlineSmall?.copyWith( crossAxisAlignment: CrossAxisAlignment.start,
fontWeight: FontWeight.bold, children: [
// Item image
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Image.network(
"https://biz.payfrit.com/uploads/items/${widget.item.itemId}.png",
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Image.network(
"https://biz.payfrit.com/uploads/items/${widget.item.itemId}.jpg",
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Colors.blue.shade100, Colors.blue.shade200],
),
),
child: Center(
child: Icon(
Icons.restaurant_menu,
color: Colors.blue.shade400,
size: 40,
),
),
);
},
);
},
),
),
), ),
), const SizedBox(width: 16),
if (widget.item.description.isNotEmpty) ...[ // Item details
const SizedBox(height: 8), Expanded(
Text( child: Column(
widget.item.description, crossAxisAlignment: CrossAxisAlignment.start,
style: Theme.of(context).textTheme.bodyMedium?.copyWith( children: [
color: Theme.of(context).colorScheme.onSurfaceVariant, Text(
), widget.item.name,
), style: Theme.of(context).textTheme.titleLarge?.copyWith(
], fontWeight: FontWeight.bold,
const SizedBox(height: 12), ),
Container( ),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), if (widget.item.description.isNotEmpty) ...[
decoration: BoxDecoration( const SizedBox(height: 8),
color: Theme.of(context).colorScheme.primaryContainer, Text(
borderRadius: BorderRadius.circular(20), widget.item.description,
), style: Theme.of(context).textTheme.bodyMedium?.copyWith(
child: Text( color: Colors.grey.shade600,
"Base: \$${widget.item.price.toStringAsFixed(2)}", ),
style: Theme.of(context).textTheme.labelLarge?.copyWith( maxLines: 2,
color: Theme.of(context).colorScheme.onPrimaryContainer, overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w600, ),
],
const SizedBox(height: 12),
Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6),
decoration: BoxDecoration(
color: Colors.green.shade50,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Colors.green.shade200),
),
child: Text(
"\$${widget.item.price.toStringAsFixed(2)}",
style: TextStyle(
color: Colors.green.shade700,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
],
), ),
),
],
), ),
), ),
], ],
@ -1120,14 +1184,14 @@ class _ItemCustomizationSheetState extends State<_ItemCustomizationSheet> {
// Footer with validation error and add button // Footer with validation error and add button
Container( Container(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.fromLTRB(20, 16, 20, 20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface, color: Colors.white,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withAlpha(25), color: Colors.black.withOpacity(0.1),
blurRadius: 4, blurRadius: 10,
offset: const Offset(0, -2), offset: const Offset(0, -4),
), ),
], ],
), ),
@ -1141,17 +1205,20 @@ class _ItemCustomizationSheetState extends State<_ItemCustomizationSheet> {
margin: const EdgeInsets.only(bottom: 12), margin: const EdgeInsets.only(bottom: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.red.shade50, color: Colors.red.shade50,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.red.shade300), border: Border.all(color: Colors.red.shade200),
), ),
child: Row( child: Row(
children: [ children: [
Icon(Icons.error_outline, color: Colors.red.shade700), Icon(Icons.error_outline, color: Colors.red.shade600, size: 20),
const SizedBox(width: 12), const SizedBox(width: 10),
Expanded( Expanded(
child: Text( child: Text(
_validationError!, _validationError!,
style: TextStyle(color: Colors.red.shade900), style: TextStyle(
color: Colors.red.shade800,
fontSize: 13,
),
), ),
), ),
], ],
@ -1160,9 +1227,47 @@ class _ItemCustomizationSheetState extends State<_ItemCustomizationSheet> {
], ],
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: FilledButton( height: 56,
child: ElevatedButton(
onPressed: _handleAdd, onPressed: _handleAdd,
child: Text("Add to Cart - \$${_calculateTotal().toStringAsFixed(2)}"), style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue.shade600,
foregroundColor: Colors.white,
elevation: 2,
shadowColor: Colors.blue.shade200,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.add_shopping_cart, size: 22),
const SizedBox(width: 10),
Text(
"Add to Cart",
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
const SizedBox(width: 8),
Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(12),
),
child: Text(
"\$${_calculateTotal().toStringAsFixed(2)}",
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
),
],
),
), ),
), ),
], ],
@ -1223,15 +1328,58 @@ class _ItemCustomizationSheetState extends State<_ItemCustomizationSheet> {
} }
Widget _buildSelectableItem(MenuItem item, MenuItem parent, int depth) { Widget _buildSelectableItem(MenuItem item, MenuItem parent, int depth) {
final isSelected = _selectedItemIds.contains(item.itemId);
return Padding( return Padding(
padding: EdgeInsets.only(left: depth * 16.0), padding: EdgeInsets.only(left: depth * 16.0, bottom: 8),
child: ListTile( child: Material(
leading: _buildSelectionWidget(item, parent), color: isSelected ? Colors.blue.shade50 : Colors.grey.shade50,
title: Text(item.name), borderRadius: BorderRadius.circular(12),
subtitle: item.price > 0 child: InkWell(
? Text("+\$${item.price.toStringAsFixed(2)}") borderRadius: BorderRadius.circular(12),
: null, onTap: () => _toggleSelection(item, parent),
onTap: () => _toggleSelection(item, parent), child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: isSelected ? Colors.blue.shade300 : Colors.grey.shade200,
width: isSelected ? 2 : 1,
),
),
child: Row(
children: [
_buildSelectionWidget(item, parent),
const SizedBox(width: 12),
Expanded(
child: Text(
item.name,
style: TextStyle(
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
color: isSelected ? Colors.blue.shade800 : Colors.black87,
),
),
),
if (item.price > 0)
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: Colors.green.shade50,
borderRadius: BorderRadius.circular(8),
),
child: Text(
"+\$${item.price.toStringAsFixed(2)}",
style: TextStyle(
color: Colors.green.shade700,
fontWeight: FontWeight.w600,
fontSize: 13,
),
),
),
],
),
),
),
), ),
); );
} }