text stringlengths 1 372 |
|---|
customer.items.add(item); |
}); |
} |
@override |
widget build(BuildContext context) { |
return scaffold( |
backgroundColor: const Color(0xFFF7F7F7), |
appBar: _buildAppBar(), |
body: _buildContent(), |
); |
} |
PreferredSizeWidget _buildAppBar() { |
return AppBar( |
iconTheme: const IconThemeData(color: Color(0xFFF64209)), |
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, |
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.