Skip to content

Commit

Permalink
Polish menu page
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodepapaya committed Jul 19, 2023
1 parent 584e4ed commit 35e9221
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 82 deletions.
22 changes: 0 additions & 22 deletions lib/app/common/add_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,5 @@ class AddButton extends StatelessWidget {
),
),
);

// return ElevatedButton(
// onPressed: onPressed,
// style: OutlinedButton.styleFrom(
// elevation: 0,
// fixedSize: Size(119.toAutoScaledWidthWithContext(context), 42.toAutoScaledHeightWithContext(context)),
// padding: EdgeInsets.zero,
// side: const BorderSide(
// color: Color(0xFF3D54FF),
// ),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(4),
// ),
// ),
// child: Text(
// 'Add',
// style: TextStyle(
// fontSize: 12.toAutoScaledWidthWithContext(context),
// color: const Color(0xFF3D54FF),
// ),
// ),
// );
}
}
121 changes: 62 additions & 59 deletions lib/presentation/menu/widgets/category_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,80 +30,83 @@ class _CategoryCardState extends State<CategoryCard> {
right: 16.toAutoScaledWidthWithContext(context),
bottom: 16.toAutoScaledWidthWithContext(context),
),
child: Theme(
data: Theme.of(context).copyWith(dividerColor: Colors.transparent),
child: ExpansionTile(
key: ValueKey(isInitiallyExpanded),
initiallyExpanded: isInitiallyExpanded,
tilePadding: EdgeInsets.symmetric(
vertical: 8.toAutoScaledWidthWithContext(context),
horizontal: 16.toAutoScaledWidthWithContext(context),
),
trailing: trailingWidget(isExpanded),
onExpansionChanged: (bool expanded) {
setState(() {
isExpanded = expanded;
});
},
backgroundColor: Colors.white,
collapsedBackgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.toAutoScaledWidthWithContext(context)),
),
collapsedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.toAutoScaledWidthWithContext(context)),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
widget.categoryName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.toAutoScaledWidthWithContext(context),
fontWeight: FontWeight.w600,
),
child: ExpansionTile(
key: ValueKey(isInitiallyExpanded),
initiallyExpanded: isInitiallyExpanded,
childrenPadding: EdgeInsets.zero,
tilePadding: EdgeInsets.symmetric(
vertical: 8.toAutoScaledHeightWithContext(context),
horizontal: 16.toAutoScaledWidthWithContext(context),
),
trailing: trailingWidget(isExpanded),
onExpansionChanged: (bool expanded) {
setState(() {
isExpanded = expanded;
});
},
backgroundColor: Colors.white,
collapsedBackgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
collapsedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 3,
child: Text(
widget.categoryName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.toAutoScaledWidthWithContext(context),
fontWeight: FontWeight.w600,
),
),
Text(
),
Expanded(
flex: 1,
child: Text(
'${widget.entries.length} items',
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 12.toAutoScaledWidthWithContext(context),
color: const Color(0xFFA9AAAE),
),
),
],
),
children: <Widget>[
const Divider(
height: 2,
color: Color(0xFFE5E6EF),
),
...widget.entries.asMap().entries.map((e) {
final selectedMeatPref = controller.selectedMeatStatus.value;
final isMeatPrefEmpty = selectedMeatPref == null;
],
),
children: <Widget>[
const Divider(
height: 2,
color: Color(0xFFE5E6EF),
),
...widget.entries.asMap().entries.map((e) {
final selectedMeatPref = controller.selectedMeatStatus.value;
final isMeatPrefEmpty = selectedMeatPref == null;

if (isMeatPrefEmpty) {
if (isMeatPrefEmpty) {
return DishCard(
isFirst: e.key == 0,
entry: e.value,
);
} else {
final isMeatPrefMatch = e.value.dish.meatStatus == selectedMeatPref;
if (isMeatPrefMatch) {
return DishCard(
isFirst: e.key == 0,
entry: e.value,
);
} else {
final isMeatPrefMatch = e.value.dish.meatStatus == selectedMeatPref;
if (isMeatPrefMatch) {
return DishCard(
isFirst: e.key == 0,
entry: e.value,
);
} else {
return SizedBox.shrink();
}
return SizedBox.shrink();
}
}).toList(),
],
),
}
}).toList(),
],
),
);
});
Expand All @@ -114,7 +117,7 @@ class _CategoryCardState extends State<CategoryCard> {
height: 20.toAutoScaledHeightWithContext(context),
width: 20.toAutoScaledWidthWithContext(context),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.toAutoScaledWidthWithContext(context)),
borderRadius: BorderRadius.circular(4),
color: const Color(0xFFE5E6EF),
),
child: Center(
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/menu/widgets/preference_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class PreferenceButton extends StatelessWidget {
border: Border.all(
width: 0.5,
),
borderRadius: BorderRadius.circular(4.toAutoScaledWidthWithContext(context)),
borderRadius: BorderRadius.circular(4),
),
child: Row(
children: [
Expand Down

0 comments on commit 35e9221

Please sign in to comment.