forked from eatvio/eatvio_app
fixed likes and favourite sync and adeded filter leayoutfor diets
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChoiceChipWidget extends StatelessWidget {
|
||||
const ChoiceChipWidget({super.key, required this.chipsLabelList, required this.index, required this.selectedChipIndex, required this.onSelected});
|
||||
final List<String> chipsLabelList;
|
||||
final int index;
|
||||
final int selectedChipIndex;
|
||||
final void Function(bool) onSelected;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChoiceChip(
|
||||
selectedColor: appTheme.blueA400,
|
||||
pressElevation: 0,
|
||||
showCheckmark: false,
|
||||
side: BorderSide.none,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
label: Text(chipsLabelList[index]),
|
||||
labelStyle: TextStyle(
|
||||
color: index == selectedChipIndex ? Colors.white : appTheme.gray600,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
),
|
||||
selected: selectedChipIndex == index,
|
||||
backgroundColor: appTheme.gray100,
|
||||
onSelected: onSelected,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import 'package:eatvio_app/core/widgets/bottom_sheet_handler_bar.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_divider.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/type_choice_filter_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:eatvio_app/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DietFilterBottomSheet extends StatelessWidget {
|
||||
const DietFilterBottomSheet({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SizedBox(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(height: 12),
|
||||
Center(child: BottomSheetHandlerBar()),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
s.order,
|
||||
style: TextStyles.textMSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
DropdownButtonFormField(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
dropdownColor: appTheme.qwe,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
fillColor: appTheme.qwe,
|
||||
filled: true,
|
||||
),
|
||||
value: 'qwe',
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
child: Text('qwe'),
|
||||
value: 'qwe',
|
||||
),
|
||||
DropdownMenuItem(
|
||||
child: Text('qwe2'),
|
||||
value: 'qwe2',
|
||||
),
|
||||
DropdownMenuItem(
|
||||
child: Text('qwe3'),
|
||||
value: 'qwe3',
|
||||
),
|
||||
],
|
||||
onChanged: (value) {},
|
||||
),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
CustomDivider(),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Text(
|
||||
s.diet_time,
|
||||
style: TextStyles.textMSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
TypeChoiceFilterWidget(),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
CustomDivider(),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Text(
|
||||
s.diet_type,
|
||||
style: TextStyles.textMSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
TypeChoiceFilterWidget(),
|
||||
SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,6 @@ class _DietsWidgetState extends State<DietsWidget> {
|
||||
),
|
||||
FeedIconButton(
|
||||
svgIcon: SvgPicture.asset('assets/icons/repost.svg'),
|
||||
text: '0',
|
||||
onTap: () async {
|
||||
final result = await Share.shareUri(
|
||||
Uri.parse(
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import 'package:eatvio_app/core/utils/localization_utils.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/choice_chip_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class DurationChoiceFilterWidget extends StatefulWidget {
|
||||
const DurationChoiceFilterWidget({super.key});
|
||||
|
||||
@override
|
||||
State<DurationChoiceFilterWidget> createState() => _DurationChoiceFilterWidgetState();
|
||||
}
|
||||
|
||||
class _DurationChoiceFilterWidgetState extends State<DurationChoiceFilterWidget> {
|
||||
final List<String> chipsLabelList = [];
|
||||
int selectedChipIndex = 0;
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
final s = S.of(context);
|
||||
super.didChangeDependencies();
|
||||
if (chipsLabelList.isEmpty) {
|
||||
chipsLabelList.add(s.all);
|
||||
chipsLabelList.add('7 ${getDayForm(7, s)}');
|
||||
chipsLabelList.add('14 ${getDayForm(14, s)}');
|
||||
chipsLabelList.add('21 ${getDayForm(21, s)}');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Wrap(
|
||||
children: [
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 0,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 0;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 1,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 2,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 2;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 3,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 3;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
34
lib/features/feed/presentation/widgets/filter_badge.dart
Normal file
34
lib/features/feed/presentation/widgets/filter_badge.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class FilterBadge extends StatelessWidget {
|
||||
const FilterBadge({super.key, required this.filterBottomSheet});
|
||||
final Widget filterBottomSheet;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => filterBottomSheet,
|
||||
useRootNavigator: true,
|
||||
barrierColor: Colors.transparent,
|
||||
backgroundColor: appTheme.whiteA700);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 20, top: 12, bottom: 12, right: 24),
|
||||
width: 70,
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: BorderRadius.horizontal(left: Radius.circular(100)),
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
'assets/icons/filter2.svg',
|
||||
width: 24,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class FilterWidget extends StatelessWidget {
|
||||
const FilterWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 20, top: 12, bottom: 12, right: 24),
|
||||
width: 70,
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: BorderRadius.horizontal(left: Radius.circular(100)),
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
'assets/icons/filter2.svg',
|
||||
width: 24,
|
||||
height: 16,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/choice_chip_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class TypeChoiceFilterWidget extends StatefulWidget {
|
||||
const TypeChoiceFilterWidget({super.key});
|
||||
|
||||
@override
|
||||
State<TypeChoiceFilterWidget> createState() => _TypeChoiceFilterWidgetState();
|
||||
}
|
||||
|
||||
class _TypeChoiceFilterWidgetState extends State<TypeChoiceFilterWidget> {
|
||||
final List<String> chipsLabelList = [];
|
||||
int selectedChipIndex = 0;
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
final s = S.of(context);
|
||||
super.didChangeDependencies();
|
||||
if (chipsLabelList.isEmpty) {
|
||||
chipsLabelList.add(s.all);
|
||||
chipsLabelList.add(s.vegan_type);
|
||||
chipsLabelList.add(s.alko_type);
|
||||
chipsLabelList.add(s.corb_type);
|
||||
chipsLabelList.add(s.meat_type);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Wrap(
|
||||
children: [
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 0,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 0;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 1,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 2,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 2;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 3,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 3;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ChoiceChipWidget(
|
||||
chipsLabelList: chipsLabelList,
|
||||
index: 4,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
onSelected: (selectedValue) {
|
||||
setState(() {
|
||||
selectedChipIndex = 4;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user