text stringlengths 1 474 |
|---|
title: Text( |
'Order Food', |
style: Theme.of(context).textTheme.headlineMedium?.copyWith( |
fontSize: 36, |
color: const Color(0xFFF64209), |
fontWeight: FontWeight.bold, |
), |
), |
backgroundColor: const Color(0xFFF7F7F7), |
elevation: 0, |
); |
} |
Widget _buildContent() { |
return Stack( |
children: [ |
SafeArea( |
child: Column( |
children: [ |
Expanded( |
child: _buildMenuList(), |
), |
_buildPeopleRow(), |
], |
), |
), |
], |
); |
} |
Widget _buildMenuList() { |
return ListView.separated( |
padding: const EdgeInsets.all(16), |
itemCount: _items.length, |
separatorBuilder: (context, index) { |
return const SizedBox( |
height: 12, |
); |
}, |
itemBuilder: (context, index) { |
final item = _items[index]; |
return _buildMenuItem( |
item: item, |
); |
}, |
); |
} |
Widget _buildMenuItem({ |
required Item item, |
}) { |
return LongPressDraggable<Item>( |
data: item, |
dragAnchorStrategy: pointerDragAnchorStrategy, |
feedback: DraggingListItem( |
dragKey: _draggableKey, |
photoProvider: item.imageProvider, |
), |
child: MenuListItem( |
name: item.name, |
price: item.formattedTotalItemPrice, |
photoProvider: item.imageProvider, |
), |
); |
} |
Widget _buildPeopleRow() { |
return Container( |
padding: const EdgeInsets.symmetric( |
horizontal: 8, |
vertical: 20, |
), |
child: Row( |
children: _people.map(_buildPersonWithDropZone).toList(), |
), |
); |
} |
Widget _buildPersonWithDropZone(Customer customer) { |
return Expanded( |
child: Padding( |
padding: const EdgeInsets.symmetric( |
horizontal: 6, |
), |
child: DragTarget<Item>( |
builder: (context, candidateItems, rejectedItems) { |
return CustomerCart( |
hasItems: customer.items.isNotEmpty, |
highlighted: candidateItems.isNotEmpty, |
customer: customer, |
); |
}, |
onAcceptWithDetails: (details) { |
_itemDroppedOnCustomerCart( |
item: details.data, |
customer: customer, |
); |
}, |
), |
), |
); |
} |
} |
class CustomerCart extends StatelessWidget { |
const CustomerCart({ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.