fixed layout of diets feed and added text styles

This commit is contained in:
Username1548
2024-11-14 17:29:19 +07:00
parent cfffc1bfe3
commit 937d7cded5
37 changed files with 1451 additions and 982 deletions

View File

@@ -1,6 +1,7 @@
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/theme/custom_text_style.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
@@ -36,18 +37,14 @@ class AuthorCard extends StatelessWidget {
),
subtitle: Text(
author.authorName,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: appTheme.blueGray800,
style: TextStyles.textLSemibold.copyWith(
color: appTheme.black,
),
),
title: Text(
s.diet_author,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xFF6D6F71),
style: TextStyles.textSSemibold.copyWith(
color: appTheme.gray,
),
),
),
@@ -55,23 +52,23 @@ class AuthorCard extends StatelessWidget {
children: [
Text(
'Конслуьтант',
style: TextStyle(
color: appTheme.blueGray800,
fontSize: 16,
fontWeight: FontWeight.w500,
style: TextStyles.textMMedium.copyWith(
color: appTheme.black,
),
),
SizedBox(width: 10),
InfoBouble(radius: 12, backgroundColor: appTheme.whiteA700, children: [
Text(
'128-й в рейтинге',
style: TextStyle(
color: appTheme.blueA400,
fontSize: 16,
fontWeight: FontWeight.w500,
InfoBouble(
radius: 12,
backgroundColor: appTheme.whiteA700,
children: [
Text(
'128-й в рейтинге',
style: TextStyles.textMMediumAuto.copyWith(
color: appTheme.blueA400,
),
),
),
],),
],
),
],
),
],

View File

@@ -1,5 +1,7 @@
import 'package:eatvio_app/core/utils/string_extentions.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:table_calendar/table_calendar.dart';
class CalendarWidget extends StatefulWidget {
@@ -10,7 +12,7 @@ class CalendarWidget extends StatefulWidget {
}
class _CalendarWidgetState extends State<CalendarWidget> {
CalendarFormat _calendarFormat = CalendarFormat.month;
CalendarFormat _calendarFormat = CalendarFormat.week;
DateTime _focusedDay = DateTime.now();
DateTime? _selectedDay = DateTime.now();
@override
@@ -26,16 +28,25 @@ class _CalendarWidgetState extends State<CalendarWidget> {
locale: 'ru_RU',
startingDayOfWeek: StartingDayOfWeek.monday,
focusedDay: _focusedDay,
rangeStartDay: _selectedDay,
rangeEndDay: _selectedDay?.add(const Duration(days: 6)),
calendarFormat: _calendarFormat,
calendarBuilders: CalendarBuilders(
headerTitleBuilder: (context, day) {
final dateFormatter = DateFormat('MMMM', 'ru_RU');
return Center(
child: Text(
'${dateFormatter.format(day).capitalize()}',
style: TextStyle(color: appTheme.black, fontSize: 16, fontWeight: FontWeight.w400),
),
);
},
),
headerStyle: HeaderStyle(
titleCentered: true,
formatButtonVisible: false,
leftChevronVisible: false,
rightChevronVisible: false,
),
rowHeight: 40,
rowHeight: 64,
selectedDayPredicate: (day) {
return isSameDay(_selectedDay, day);
},
@@ -58,27 +69,36 @@ class _CalendarWidgetState extends State<CalendarWidget> {
_focusedDay = focusedDay;
},
calendarStyle: CalendarStyle(
weekendTextStyle: TextStyle(
color: appTheme.gray,
),
defaultTextStyle: TextStyle(
color: appTheme.gray,
),
weekendDecoration: BoxDecoration(
color: Colors.white,
color: appTheme.dividerColor,
shape: BoxShape.circle,
),
defaultDecoration: BoxDecoration(
color: Colors.white,
color: appTheme.dividerColor,
shape: BoxShape.circle,
),
selectedTextStyle: TextStyle(
color: appTheme.whiteA700,
),
selectedDecoration: BoxDecoration(
color: appTheme.blueA400,
shape: BoxShape.circle,
),
todayTextStyle: TextStyle(
color: Colors.black,
color: appTheme.gray,
),
todayDecoration: BoxDecoration(
border: Border.all(
color: appTheme.blueA400,
width: 2,
),
color: Colors.white,
color: appTheme.dividerColor,
shape: BoxShape.circle,
),
),

View File

@@ -1,4 +1,5 @@
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';
@@ -15,32 +16,35 @@ class CpfcContainer extends StatelessWidget {
return Container(
color: appTheme.cardBackground,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Column(
children: [
Text('$calories', style: TextStyle(color: appTheme.blueGray800, fontSize: 16, fontWeight: FontWeight.w600)),
Text(s.calories, style: TextStyle(color: appTheme.blueGray800, fontSize: 12, fontWeight: FontWeight.w500)),
],
),
Column(
children: [
Text('$protein', style: TextStyle(color: appTheme.blueGray800, fontSize: 16, fontWeight: FontWeight.w600)),
Text(s.proteins, style: TextStyle(color: appTheme.blueGray800, fontSize: 12, fontWeight: FontWeight.w500)),
],
),
Column(
children: [
Text('$fat', style: TextStyle(color: appTheme.blueGray800, fontSize: 16, fontWeight: FontWeight.w600)),
Text(s.fats, style: TextStyle(color: appTheme.blueGray800, fontSize: 12, fontWeight: FontWeight.w500)),
],
),
Column(
children: [
Text('$carbohydrates', style: TextStyle(color: appTheme.blueGray800, fontSize: 16, fontWeight: FontWeight.w600)),
Text(s.carbohydrates, style: TextStyle(color: appTheme.blueGray800, fontSize: 12, fontWeight: FontWeight.w500)),
],
),
],),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Text('$calories', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(s.calories, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
),
Column(
children: [
Text('$protein', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(s.proteins, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
),
Column(
children: [
Text('$fat', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(s.fats, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
),
Column(
children: [
Text('$carbohydrates', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(s.carbohydrates, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
),
],
),
);
}
}

View File

@@ -1,6 +1,7 @@
import 'dart:math' as math;
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';
import 'package:flutter_html/flutter_html.dart';
@@ -74,7 +75,7 @@ class _ExpandableTextState extends State<ExpandableText> {
children: [
Text(
isExpanded ? s.hide : s.expand,
style: TextStyle(color: appTheme.blueA400, fontSize: 16, fontWeight: FontWeight.w500),
style: TextStyles.textMMedium.copyWith(color: appTheme.blueA400),
),
Transform.rotate(angle: isExpanded ? math.pi : 0, child: SvgPicture.asset('assets/icons/arrow_down.svg', width: 12, height: 12)),
],

View File

@@ -3,6 +3,7 @@ import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/core/widgets/custom_divider.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/main_background_bouble.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';
import 'package:flutter/services.dart';
@@ -17,83 +18,80 @@ class MoreOptions extends StatelessWidget {
Widget build(BuildContext context) {
final s = S.of(context);
return MainBackgroundBouble(
enableShadow: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: baseUrl + '/ru/diet/' + id.toString()));
showInfoToast(s.link_was_copied);
},
child: Row(
children: [
Text(
s.copy_link,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: appTheme.blueGray800,
),
enableShadow: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: baseUrl + '/ru/diet/' + id.toString()));
showInfoToast(s.link_was_copied);
},
child: Row(
children: [
Text(
s.copy_link,
style: TextStyles.textMMedium.copyWith(
color: appTheme.black,
),
Spacer(),
SvgPicture.asset('assets/icons/copy2.svg', width: 16, height: 20),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: CustomDivider(),
),
GestureDetector(
onTap: () => Share.shareUri(
Uri.parse(
baseUrl + '/ru/diet/' + id.toString(),
),
Spacer(),
SvgPicture.asset('assets/icons/copy2.svg', width: 16, height: 20),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: CustomDivider(),
),
GestureDetector(
onTap: () => Share.shareUri(
Uri.parse(
baseUrl + '/ru/diet/' + id.toString(),
),
child: Row(
children: [
Text(
s.share,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: appTheme.blueGray800,
),
),
child: Row(
children: [
Text(
s.share,
style: TextStyles.textMMedium.copyWith(
color: appTheme.black,
),
Spacer(),
SvgPicture.asset('assets/icons/share2.svg', width: 16, height: 20),
],
),
),
Spacer(),
SvgPicture.asset('assets/icons/share2.svg', width: 16, height: 20),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: CustomDivider(),
),
GestureDetector(
onTap: () {
context.push('complainingScreen');
},
child: Row(
children: [
Text(
s.complain,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: appTheme.blueGray800,
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: CustomDivider(),
),
GestureDetector(
onTap: () {
context.push('complainingScreen');
},
child: Row(
children: [
Text(
s.complain,
style: TextStyles.textMMedium.copyWith(
color: appTheme.black,
),
Spacer(),
SvgPicture.asset('assets/icons/complain.svg', width: 16, height: 20),
],
),
),
Spacer(),
SvgPicture.asset('assets/icons/complain.svg', width: 16, height: 20),
],
),
],
),
),
],
),
width: 272,);
),
width: 272,
);
}
}

View File

@@ -1,5 +1,7 @@
import 'package:eatvio_app/core/widgets/custom_divider.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/calendar_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:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
@@ -13,38 +15,45 @@ class StartDietBottomSheet extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 5),
SizedBox(height: 4),
Container(
height: 4,
width: 40,
decoration: BoxDecoration(color: appTheme.lightGrey, borderRadius: BorderRadius.circular(20)),
decoration: BoxDecoration(color: appTheme.lightGray, borderRadius: BorderRadius.circular(20)),
),
SizedBox(height: 12),
Text(
s.startDiet,
style: TextStyles.headingXLSemibold.copyWith(
color: appTheme.black,
),
),
SizedBox(height: 22),
Text(s.startDiet,
style: TextStyle(
color: appTheme.blueGray800,
fontSize: 20,
fontWeight: FontWeight.w600,
),),
SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(s.choose_start_diet_date,
textAlign: TextAlign.center,
style: TextStyle(
color: appTheme.blueGray800,
fontSize: 16,
fontWeight: FontWeight.w500,
),),
child: Text(
s.choose_start_diet_date,
textAlign: TextAlign.center,
style: TextStyles.textMMedium.copyWith(
color: appTheme.black,
),
),
),
SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: CustomDivider(),
),
CalendarWidget(),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 20, bottom: 25),
padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28),
child: CustomOutlinedButton(
height: 52,
text: s.continue_,
height: 60,
text: s.startDiet,
buttonTextStyle: TextStyles.textLSemibold.copyWith(
color: appTheme.whiteA700,
),
buttonStyle: ButtonStyle(
textStyle: WidgetStatePropertyAll(TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600)),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
side: WidgetStatePropertyAll(BorderSide.none),
),

View File

@@ -1,16 +1,17 @@
import 'package:eatvio_app/features/diets/presentation/widgets/main_background_bouble.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.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';
import 'package:flutter_portal/flutter_portal.dart';
import 'package:flutter_svg/svg.dart';
class TypeBadges extends StatefulWidget {
const TypeBadges({super.key, required this.type});
const TypeBadges({super.key, required this.type, required this.disableDescriptionOfTypes});
final DietType type;
final bool disableDescriptionOfTypes;
@override
State<TypeBadges> createState() => _TypeBadgesState();
}
@@ -23,48 +24,56 @@ class _TypeBadgesState extends State<TypeBadges> {
final s = S.of(context);
final List<(String, Widget)> badgeSource = [];
if (widget.type.alko == true) {
badgeSource.add((
'assets/icons/cocktail.svg',
_InfoOverlayEntry(
onClose: closeOverlay,
assetPath: 'assets/icons/cocktail.svg',
title: s.alko_type,
description: s.alko_type_desc,
)
),);
badgeSource.add(
(
'assets/icons/cocktail.svg',
_InfoOverlayEntry(
onClose: closeOverlay,
assetPath: 'assets/icons/cocktail.svg',
title: s.alko_type,
description: s.alko_type_desc,
)
),
);
}
if (widget.type.veg == true) {
badgeSource.add((
'assets/icons/broccoli.svg',
_InfoOverlayEntry(
onClose: closeOverlay,
assetPath: 'assets/icons/broccoli.svg',
title: s.vegan_type,
description: s.vegan_type_desc,
)
),);
badgeSource.add(
(
'assets/icons/broccoli.svg',
_InfoOverlayEntry(
onClose: closeOverlay,
assetPath: 'assets/icons/broccoli.svg',
title: s.vegan_type,
description: s.vegan_type_desc,
)
),
);
}
if (widget.type.corb == true) {
badgeSource.add((
'assets/icons/bread.svg',
_InfoOverlayEntry(
onClose: closeOverlay,
assetPath: 'assets/icons/bread.svg',
title: s.corb_type,
description: s.corb_type_desc,
)
),);
badgeSource.add(
(
'assets/icons/bread.svg',
_InfoOverlayEntry(
onClose: closeOverlay,
assetPath: 'assets/icons/bread.svg',
title: s.corb_type,
description: s.corb_type_desc,
)
),
);
}
if (widget.type.meat == true) {
badgeSource.add((
'assets/icons/meat2.svg',
_InfoOverlayEntry(
onClose: closeOverlay,
assetPath: 'assets/icons/meat2.svg',
title: s.meat_type,
description: s.meat_type_desc,
)
),);
badgeSource.add(
(
'assets/icons/meat2.svg',
_InfoOverlayEntry(
onClose: closeOverlay,
assetPath: 'assets/icons/meat2.svg',
title: s.meat_type,
description: s.meat_type_desc,
)
),
);
}
return Row(
children: List.generate(
@@ -81,19 +90,21 @@ class _TypeBadgesState extends State<TypeBadges> {
),
portalFollower: badgeSource[index].$2,
child: GestureDetector(
onTap: () {
for (int stateIndex = 0; stateIndex < overlaysVisibilityState.length; stateIndex++) {
if (index != stateIndex) {
setState(() {
overlaysVisibilityState[stateIndex] = false;
});
} else {
setState(() {
overlaysVisibilityState[stateIndex] = true;
});
}
}
},
onTap: widget.disableDescriptionOfTypes
? null
: () {
for (int stateIndex = 0; stateIndex < overlaysVisibilityState.length; stateIndex++) {
if (index != stateIndex) {
setState(() {
overlaysVisibilityState[stateIndex] = false;
});
} else {
setState(() {
overlaysVisibilityState[stateIndex] = true;
});
}
}
},
child: Padding(
padding: EdgeInsets.only(right: index != badgeSource.length - 1 ? 8.0 : 0),
child: SvgPicture.asset(
@@ -152,22 +163,19 @@ class _InfoOverlayEntry extends StatelessWidget {
children: [
Text(
title,
style: TextStyle(
style: TextStyles.textMMedium.copyWith(
decoration: TextDecoration.none,
color: appTheme.blueGray800,
fontSize: 16,
fontWeight: FontWeight.w500,
color: appTheme.black,
),
),
SizedBox(height: 4),
Text(
description,
softWrap: true,
style: TextStyle(
style: TextStyles.textXSSemibold.copyWith(
decoration: TextDecoration.none,
color: appTheme.blueGray800,
fontSize: 12,
fontWeight: FontWeight.w500,
color: appTheme.black,
),
),
],