forked from eatvio/eatvio_app
feat(profile): subscribers and subscriptions
This commit is contained in:
@@ -264,10 +264,10 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
||||
onTap: () {
|
||||
widget.diaryCubit.sendProductToModeration(
|
||||
name: productNameController.text,
|
||||
energy: int.parse(energyController.text),
|
||||
proteins: int.parse(proteinsController.text),
|
||||
fats: int.parse(fatsController.text),
|
||||
carbohydrates: int.parse(carbohydratesController.text),
|
||||
energy: double.parse(energyController.text),
|
||||
proteins: double.parse(proteinsController.text),
|
||||
fats: double.parse(fatsController.text),
|
||||
carbohydrates: double.parse(carbohydratesController.text),
|
||||
);
|
||||
setState(() {
|
||||
glossaryState = GlossaryState.success;
|
||||
|
||||
@@ -5,11 +5,15 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class SatietyRatingWidget extends StatefulWidget {
|
||||
final double currentSelectedSatietyRating;
|
||||
final List<int> currentSelectedSatietyRating;
|
||||
final int diaryId;
|
||||
final int meal;
|
||||
|
||||
const SatietyRatingWidget({
|
||||
super.key,
|
||||
required this.currentSelectedSatietyRating,
|
||||
required this.diaryId,
|
||||
required this.meal,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -39,7 +43,7 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
width: 32,
|
||||
),
|
||||
RatingBar.builder(
|
||||
initialRating: 3,
|
||||
initialRating: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1,
|
||||
itemCount: 6,
|
||||
itemSize: MediaQuery.of(context).size.width / 6 - (124 / 6),
|
||||
updateOnDrag: true,
|
||||
@@ -49,17 +53,17 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: widget.currentSelectedSatietyRating == 1 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 1 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFC82222),
|
||||
border: widget.currentSelectedSatietyRating == 1
|
||||
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 1
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFAA3333),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: widget.currentSelectedSatietyRating == 1
|
||||
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 1
|
||||
? BorderRadius.horizontal(
|
||||
left: Radius.circular(8),
|
||||
right: Radius.circular(2),
|
||||
@@ -73,85 +77,85 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: widget.currentSelectedSatietyRating == 2 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 2 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFF3E3E),
|
||||
border: widget.currentSelectedSatietyRating == 2
|
||||
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 2
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF550000),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: widget.currentSelectedSatietyRating == 2 ? BorderRadius.circular(2) : null,
|
||||
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 2 ? BorderRadius.circular(2) : null,
|
||||
),
|
||||
);
|
||||
case 2:
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: widget.currentSelectedSatietyRating == 3 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 3 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF8C926),
|
||||
border: widget.currentSelectedSatietyRating == 3
|
||||
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 3
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF8C5D00),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: widget.currentSelectedSatietyRating == 3 ? BorderRadius.circular(2) : null,
|
||||
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 3 ? BorderRadius.circular(2) : null,
|
||||
),
|
||||
);
|
||||
case 3:
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: widget.currentSelectedSatietyRating == 4 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 4 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFFF3BF),
|
||||
border: widget.currentSelectedSatietyRating == 4
|
||||
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 4
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFB5911B),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: widget.currentSelectedSatietyRating == 4 ? BorderRadius.circular(2) : null,
|
||||
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 4 ? BorderRadius.circular(2) : null,
|
||||
),
|
||||
);
|
||||
case 4:
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: widget.currentSelectedSatietyRating == 5 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 5 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF62E833),
|
||||
border: widget.currentSelectedSatietyRating == 5
|
||||
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 5
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF276918),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: widget.currentSelectedSatietyRating == 5 ? BorderRadius.circular(2) : null,
|
||||
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 5 ? BorderRadius.circular(2) : null,
|
||||
),
|
||||
);
|
||||
default:
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 6,
|
||||
height: 24,
|
||||
margin: widget.currentSelectedSatietyRating == 6 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 6 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF4DCE20),
|
||||
border: widget.currentSelectedSatietyRating == 6
|
||||
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 6
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFF184D12),
|
||||
strokeAlign: BorderSide.strokeAlignOutside,
|
||||
)
|
||||
: null,
|
||||
borderRadius: widget.currentSelectedSatietyRating == 6
|
||||
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 6
|
||||
? BorderRadius.horizontal(
|
||||
left: Radius.circular(2),
|
||||
right: Radius.circular(8),
|
||||
@@ -163,7 +167,11 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
||||
);
|
||||
}
|
||||
},
|
||||
onRatingUpdate: (value) => context.read<DiaryCubit>().updateCurrentSelectedSatietyRating(value),
|
||||
onRatingUpdate: (value) => context.read<DiaryCubit>().updateCurrentSelectedSatietyRating(
|
||||
diaryId: widget.diaryId,
|
||||
meal: widget.meal,
|
||||
value: value.toInt(),
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/icons/satiety_emoji_right.svg',
|
||||
|
||||
Reference in New Issue
Block a user