forked from eatvio/eatvio_app
diet creation scrren is done
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -8,11 +7,12 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class AuthorCard extends StatelessWidget {
|
||||
const AuthorCard({super.key, required this.author});
|
||||
const AuthorCard({super.key, required this.author, required this.title});
|
||||
final Author author;
|
||||
final String title;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
// final s = S.of(context);
|
||||
return Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.cardBackground),
|
||||
@@ -42,7 +42,7 @@ class AuthorCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
s.diet_author,
|
||||
title,
|
||||
style: TextStyles.textSSemibold.copyWith(
|
||||
color: appTheme.gray,
|
||||
),
|
||||
@@ -57,18 +57,19 @@ class AuthorCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
InfoBouble(
|
||||
radius: 12,
|
||||
backgroundColor: appTheme.whiteA700,
|
||||
children: [
|
||||
Text(
|
||||
'128-й в рейтинге',
|
||||
style: TextStyles.textMMediumAuto.copyWith(
|
||||
color: appTheme.blueA400,
|
||||
if (author.authorPlaceInRating != null)
|
||||
InfoBouble(
|
||||
radius: 12,
|
||||
backgroundColor: appTheme.whiteA700,
|
||||
children: [
|
||||
Text(
|
||||
'${author.authorPlaceInRating}-й в рейтинге',
|
||||
style: TextStyles.textMMediumAuto.copyWith(
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
@@ -8,9 +9,10 @@ import 'package:flutter_portal/flutter_portal.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
class TypeBadges extends StatefulWidget {
|
||||
const TypeBadges({super.key, required this.type, required this.disableDescriptionOfTypes});
|
||||
const TypeBadges({super.key, this.type, required this.disableDescriptionOfTypes, this.planType});
|
||||
|
||||
final DietType type;
|
||||
final DietType? type;
|
||||
final PlanType? planType;
|
||||
final bool disableDescriptionOfTypes;
|
||||
@override
|
||||
State<TypeBadges> createState() => _TypeBadgesState();
|
||||
@@ -18,12 +20,11 @@ class TypeBadges extends StatefulWidget {
|
||||
|
||||
class _TypeBadgesState extends State<TypeBadges> {
|
||||
final List<bool> overlaysVisibilityState = [false, false, false, false];
|
||||
final List<(String, Widget)> badgeSource = [];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
final List<(String, Widget)> badgeSource = [];
|
||||
if (widget.type.light == true) {
|
||||
void fillBadges(S s) {
|
||||
badgeSource.clear();
|
||||
if (widget.type?.light == true) {
|
||||
badgeSource.add(
|
||||
(
|
||||
'assets/icons/cocktail.svg',
|
||||
@@ -36,7 +37,7 @@ class _TypeBadgesState extends State<TypeBadges> {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (widget.type.veg == true) {
|
||||
if (widget.type?.veg == true) {
|
||||
badgeSource.add(
|
||||
(
|
||||
'assets/icons/broccoli.svg',
|
||||
@@ -49,7 +50,7 @@ class _TypeBadgesState extends State<TypeBadges> {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (widget.type.carb == true) {
|
||||
if (widget.type?.carb == true) {
|
||||
badgeSource.add(
|
||||
(
|
||||
'assets/icons/bread.svg',
|
||||
@@ -62,7 +63,7 @@ class _TypeBadgesState extends State<TypeBadges> {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (widget.type.meat == true) {
|
||||
if (widget.type?.meat == true) {
|
||||
badgeSource.add(
|
||||
(
|
||||
'assets/icons/meat2.svg',
|
||||
@@ -75,6 +76,66 @@ class _TypeBadgesState extends State<TypeBadges> {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (widget.planType?.slim == true) {
|
||||
badgeSource.add(
|
||||
(
|
||||
'assets/icons/slim.png',
|
||||
_InfoOverlayEntry(
|
||||
onClose: closeOverlay,
|
||||
assetPath: 'assets/icons/slim.png',
|
||||
title: s.slim_type,
|
||||
description: s.slim_type_desc,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
if (widget.planType?.fit == true) {
|
||||
badgeSource.add(
|
||||
(
|
||||
'assets/icons/fitness.png',
|
||||
_InfoOverlayEntry(
|
||||
onClose: closeOverlay,
|
||||
assetPath: 'assets/icons/fitness.png',
|
||||
title: s.fit_type,
|
||||
description: s.fit_type_desc,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
if (widget.planType?.wellness == true) {
|
||||
badgeSource.add(
|
||||
(
|
||||
'assets/icons/yoga-pose.png',
|
||||
_InfoOverlayEntry(
|
||||
onClose: closeOverlay,
|
||||
assetPath: 'assets/icons/yoga-pose.png',
|
||||
title: s.wellness_type,
|
||||
description: s.wellness_type_desc,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
if (widget.planType?.behavior == true) {
|
||||
badgeSource.add(
|
||||
(
|
||||
'assets/icons/diet.png',
|
||||
_InfoOverlayEntry(
|
||||
onClose: closeOverlay,
|
||||
assetPath: 'assets/icons/diet.png',
|
||||
title: s.eating_behavior_type,
|
||||
description: s.eating_behavior_type_desc,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
|
||||
fillBadges(s);
|
||||
|
||||
return Row(
|
||||
children: List.generate(
|
||||
badgeSource.length,
|
||||
@@ -107,11 +168,13 @@ class _TypeBadgesState extends State<TypeBadges> {
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(right: index != badgeSource.length - 1 ? 8.0 : 0),
|
||||
child: SvgPicture.asset(
|
||||
badgeSource[index].$1,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
child: badgeSource[index].$1.endsWith('.png')
|
||||
? Image.asset(badgeSource[index].$1, width: 20, height: 20)
|
||||
: SvgPicture.asset(
|
||||
badgeSource[index].$1,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -150,11 +213,13 @@ class _InfoOverlayEntry extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
assetPath,
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
assetPath.endsWith('.png')
|
||||
? Image.asset(assetPath, width: 20, height: 20)
|
||||
: SvgPicture.asset(
|
||||
assetPath,
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -175,7 +240,6 @@ class _InfoOverlayEntry extends StatelessWidget {
|
||||
style: TextStyles.textXSSemibold.copyWith(
|
||||
decoration: TextDecoration.none,
|
||||
color: appTheme.black,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user