forked from eatvio/eatvio_app
676 lines
33 KiB
Dart
676 lines
33 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:eatvio_app/core/app_config.dart';
|
|
import 'package:eatvio_app/core/enums/complained_content.dart';
|
|
import 'package:eatvio_app/core/enums/product_type.dart';
|
|
import 'package:eatvio_app/core/utils/localization_utils.dart';
|
|
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
|
|
import 'package:eatvio_app/core/widgets/custom_divider.dart';
|
|
import 'package:eatvio_app/core/widgets/custom_popup.dart';
|
|
import 'package:eatvio_app/core/widgets/data_error_widget.dart';
|
|
import 'package:eatvio_app/core/widgets/info_row.dart';
|
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
|
import 'package:eatvio_app/features/diets/presentation/cubit/about_diet_cubit.dart';
|
|
import 'package:eatvio_app/features/diets/presentation/cubit/about_diet_state.dart';
|
|
import 'package:eatvio_app/features/diets/presentation/widgets/author_card.dart';
|
|
import 'package:eatvio_app/core/widgets/cpfc_container.dart';
|
|
import 'package:eatvio_app/features/diets/presentation/widgets/cancel_diet_bottom_sheet.dart';
|
|
import 'package:eatvio_app/features/diets/presentation/widgets/expandable_text.dart';
|
|
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
|
|
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
|
|
import 'package:eatvio_app/features/diets/presentation/widgets/start_diet_bottom_sheet.dart';
|
|
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
|
import 'package:eatvio_app/core/comments/comments_cubit/comments_cubit.dart';
|
|
import 'package:eatvio_app/core/comments/comments_cubit/comments_state.dart';
|
|
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
|
|
import 'package:eatvio_app/features/feed/presentation/widgets/comments_widget.dart';
|
|
import 'package:eatvio_app/generated/l10n.dart';
|
|
import 'package:eatvio_app/core/locator_service.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';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
class AboutDietScreen extends StatefulWidget {
|
|
final String slug;
|
|
final int? index;
|
|
final bool navigateToComments;
|
|
|
|
const AboutDietScreen({super.key, required this.index, required this.navigateToComments, required this.slug});
|
|
|
|
@override
|
|
State<AboutDietScreen> createState() => _AboutDietScreenState();
|
|
}
|
|
|
|
class _AboutDietScreenState extends State<AboutDietScreen> {
|
|
final CommentsCubit commentsCubit = sl<CommentsCubit>();
|
|
final AboutDietCubit dietsCubit = sl<AboutDietCubit>();
|
|
int? replyId;
|
|
final ScrollController scrollController = ScrollController();
|
|
final textEditingController = TextEditingController();
|
|
bool isMoreOptionsVisible = false;
|
|
bool _jumped = false;
|
|
bool _isFirstLaunch = true;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
scrollController.addListener(() {
|
|
if (isMoreOptionsVisible) {
|
|
setState(() {
|
|
isMoreOptionsVisible = false;
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
void _scrollToBottom() {
|
|
_jumped = true;
|
|
scrollController.jumpTo(
|
|
scrollController.position.maxScrollExtent,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final s = S.of(context);
|
|
|
|
return BlocProvider(
|
|
create: (context) => dietsCubit..initDietPage(widget.slug),
|
|
child: BlocProvider<CommentsCubit>(
|
|
create: (BuildContext context) => commentsCubit,
|
|
child: BlocConsumer<CommentsCubit, CommentsState>(
|
|
listener: (BuildContext context, CommentsState commentsState) {
|
|
if (commentsState is CommentsStateLoaded) {
|
|
setState(() {
|
|
replyId = commentsState.replyId;
|
|
});
|
|
}
|
|
},
|
|
builder: (BuildContext context, CommentsState state) {
|
|
return BlocBuilder<AboutDietCubit, AboutDietState>(
|
|
builder: (context, dietState) {
|
|
if (dietState is DietStateLoaded) {
|
|
if (_isFirstLaunch) {
|
|
context.read<FeedCubit>().viewDiet(dietState.diet.id);
|
|
context.read<CommentsCubit>().getComments(
|
|
dietState.diet.id.toString(),
|
|
CommentSourceType.diet,
|
|
true,
|
|
);
|
|
_isFirstLaunch = false;
|
|
}
|
|
Future.delayed(const Duration(milliseconds: 500), () {
|
|
if (widget.navigateToComments && !_jumped) {
|
|
_scrollToBottom();
|
|
}
|
|
});
|
|
return Scaffold(
|
|
backgroundColor: appTheme.gray100,
|
|
resizeToAvoidBottomInset: true,
|
|
bottomSheet: Container(
|
|
padding: const EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
border: Border(
|
|
top: BorderSide(
|
|
color: Colors.black.withValues(alpha: 0.1),
|
|
),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: SizedBox(
|
|
child: FloatingActionButton.extended(
|
|
heroTag: 'nextButtonRegistration',
|
|
highlightElevation: 0,
|
|
elevation: 0,
|
|
focusElevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
backgroundColor: dietState.isStarted ? appTheme.transparentRed : appTheme.greenA700,
|
|
onPressed: () {
|
|
final cubit = context.read<AboutDietCubit>();
|
|
|
|
if (dietState.isStarted) {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
builder: (context) => CancelDietBottomSheet(
|
|
aboutDietCubit: cubit,
|
|
dietName: dietState.diet.name,
|
|
),
|
|
);
|
|
} else if (dietState.hasStartedDiet) {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
builder: (context) => CancelDietBottomSheet(
|
|
aboutDietCubit: cubit,
|
|
title: 'Вы собираетесь начать диету ${dietState.diet.name}, завершить диету ${cubit.userStartedDietName}?',
|
|
),
|
|
);
|
|
} else {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
builder: (context) => StartDietBottomSheet(
|
|
aboutDietCubit: cubit,
|
|
),
|
|
);
|
|
}
|
|
},
|
|
label: Text(
|
|
dietState.isStarted ? 'Отменить диету' : s.startDiet,
|
|
style: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
BookmarkButton(
|
|
isFavorite: dietState.diet.isFavorite,
|
|
onTap: () {
|
|
if (dietState.diet.isFavorite) {
|
|
dietsCubit.removeFromFavorite(dietState.diet.id, widget.index);
|
|
} else {
|
|
dietsCubit.addToFavorite(dietState.diet.id, widget.index);
|
|
}
|
|
},
|
|
width: 52,
|
|
height: 52,
|
|
size: 24,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(20),
|
|
color: appTheme.gray50,
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
if (replyId != null)
|
|
GestureDetector(
|
|
onTap: () {
|
|
context.read<CommentsCubit>().setReplyId(null);
|
|
setState(() {
|
|
replyId = null;
|
|
textEditingController.clear();
|
|
});
|
|
FocusManager.instance.primaryFocus?.unfocus();
|
|
},
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: appTheme.blueA400,
|
|
shape: BoxShape.circle,
|
|
),
|
|
height: 32,
|
|
width: 32,
|
|
child: const Icon(
|
|
Icons.close_rounded,
|
|
size: 18,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
if (replyId != null) const SizedBox(width: 8),
|
|
Expanded(
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(minHeight: 52),
|
|
child: TextFormField(
|
|
textCapitalization: TextCapitalization.sentences,
|
|
onChanged: (_) {
|
|
setState(() {});
|
|
},
|
|
controller: textEditingController,
|
|
maxLines: 5,
|
|
minLines: 1,
|
|
keyboardType: TextInputType.multiline,
|
|
style: const TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w400,
|
|
color: Colors.black,
|
|
height: 1.2,
|
|
),
|
|
decoration: InputDecoration(
|
|
isDense: false, // убираем true, чтобы padding учитывался корректно
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен
|
|
hintText: 'Комментарий',
|
|
hintStyle: const TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w400,
|
|
height: 1.2,
|
|
color: Color(0xFFAEAEB2),
|
|
),
|
|
filled: true,
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
borderSide: const BorderSide(color: Color(0xFFD1D1D6), width: 1),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
GestureDetector(
|
|
onTap: () {
|
|
if (textEditingController.text.length > 2) {
|
|
commentsCubit.sendComment(
|
|
id: dietState.diet.id.toString(),
|
|
commentText: textEditingController.text,
|
|
parentCommentId: replyId,
|
|
commentSourceType: CommentSourceType.diet,
|
|
);
|
|
context.read<CommentsCubit>().setReplyId(null);
|
|
setState(() {
|
|
textEditingController.clear();
|
|
replyId = null;
|
|
});
|
|
Future.delayed(const Duration(milliseconds: 500), () {
|
|
dietsCubit.getDiet(dietState.diet.slug, index: widget.index);
|
|
});
|
|
FocusManager.instance.primaryFocus?.unfocus();
|
|
}
|
|
},
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: textEditingController.text.length > 2 ? appTheme.blueA400 : appTheme.gray50,
|
|
shape: BoxShape.circle,
|
|
),
|
|
height: 32,
|
|
width: 32,
|
|
child: Icon(
|
|
Icons.send_rounded,
|
|
size: 18,
|
|
color: textEditingController.text.length > 2 ? appTheme.whiteA700 : appTheme.black,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
appBar: AppBar(
|
|
centerTitle: true,
|
|
leading: BackButton(
|
|
onPressed: () {
|
|
if (context.canPop()) {
|
|
GoRouter.of(context).pop();
|
|
return;
|
|
}
|
|
GoRouter.of(context).go('/feed-screen');
|
|
},
|
|
),
|
|
title: Text(
|
|
dietState.diet.name,
|
|
maxLines: 2,
|
|
textAlign: TextAlign.center,
|
|
overflow: TextOverflow.ellipsis,
|
|
softWrap: true,
|
|
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
|
),
|
|
actions: [
|
|
CustomPopup(
|
|
isAuthor: dietState.diet.author.authorIsMe,
|
|
path: 'diet/${dietState.diet.slug}',
|
|
complainedContentType: ComplainedContent.diet,
|
|
id: dietState.diet.id,
|
|
diet: dietState.diet,
|
|
userSlug: dietState.diet.author.authorSlug,
|
|
),
|
|
const SizedBox(width: 16),
|
|
],
|
|
),
|
|
body: SingleChildScrollView(
|
|
controller: scrollController,
|
|
padding: const EdgeInsets.only(bottom: 160),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SizedBox(height: 8),
|
|
MainBackgroundBouble(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Stack(
|
|
children: [
|
|
CachedNetworkImage(
|
|
imageUrl: '${sl<AppConfig>().baseUrl}/storage/${dietState.diet.image}',
|
|
height: 300,
|
|
width: MediaQuery.sizeOf(context).width,
|
|
fit: BoxFit.fill,
|
|
),
|
|
Positioned(
|
|
bottom: 16,
|
|
left: 0,
|
|
right: 0,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
InfoBouble(
|
|
backgroundColor: appTheme.whiteA700,
|
|
children: [
|
|
SvgPicture.asset('assets/icons/eye.svg', width: 18, height: 12),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
dietState.diet.totalViews.toString(),
|
|
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(width: 12),
|
|
GestureDetector(
|
|
onTap: () {
|
|
dietsCubit.likeDiet(dietState.diet.id, widget.index);
|
|
},
|
|
child: InfoBouble(
|
|
backgroundColor: appTheme.whiteA700,
|
|
children: [
|
|
SvgPicture.asset(
|
|
'assets/icons/heart.svg',
|
|
width: 14,
|
|
height: 12,
|
|
colorFilter: dietState.diet.wasLikedByMe ? ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn) : null,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
dietState.diet.totalLikes.toString(),
|
|
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
InfoBouble(
|
|
backgroundColor: appTheme.whiteA700,
|
|
children: [
|
|
SvgPicture.asset('assets/icons/comment2.svg', width: 13, height: 12),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
dietState.diet.totalComments.toString(),
|
|
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 16),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: Text(
|
|
s.about_diet,
|
|
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
InfoRow(
|
|
diet: dietState.diet,
|
|
type: ProductType.diet,
|
|
),
|
|
ExpandableText(
|
|
text: dietState.diet.details,
|
|
),
|
|
const SizedBox(height: 20),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: AuthorCard(
|
|
author: dietState.diet.author,
|
|
title: s.diet_author,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
MainBackgroundBouble(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
|
child: Center(
|
|
child: Text(
|
|
'${s.diet_plan}(${dietState.diet.duration.toString()} ${getDayForm(dietState.diet.duration, s)})',
|
|
style: TextStyles.headingXLSemibold.copyWith(
|
|
color: appTheme.black,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
ListView.builder(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemBuilder: (context, index) {
|
|
return _dayOfPlan(
|
|
dietState.diet.dailySchedule[index + 1] ?? {},
|
|
index,
|
|
s,
|
|
dietState.selectedIndexes,
|
|
dietState.diet,
|
|
);
|
|
},
|
|
itemCount: dietState.diet.dailySchedule.length,
|
|
),
|
|
MainBackgroundBouble(
|
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
'${dietState.diet.totalComments} ${getCommentForm(dietState.diet.totalComments, s)}',
|
|
style: TextStyles.textMMedium.copyWith(
|
|
color: appTheme.gray500,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
if (state is CommentsStateLoading) const Loader(),
|
|
if (state is CommentsStateLoaded)
|
|
CommentsWidget(
|
|
id: dietState.diet.id.toString(),
|
|
commentSourceType: CommentSourceType.diet,
|
|
comment: state.comment,
|
|
replyId: replyId,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
if (dietState is DietStateError) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
centerTitle: true,
|
|
leading: BackButton(
|
|
onPressed: () {
|
|
if (context.canPop()) {
|
|
GoRouter.of(context).pop();
|
|
return;
|
|
}
|
|
GoRouter.of(context).go('/feed-screen');
|
|
},
|
|
),
|
|
title: Text(
|
|
'',
|
|
maxLines: 2,
|
|
textAlign: TextAlign.center,
|
|
overflow: TextOverflow.ellipsis,
|
|
softWrap: true,
|
|
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
|
),
|
|
),
|
|
body: DataErrorWidget(
|
|
onReload: () => context.read<AboutDietCubit>().getDiet(widget.slug, index: widget.index),
|
|
),
|
|
);
|
|
}
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
centerTitle: true,
|
|
leading: BackButton(
|
|
onPressed: () {
|
|
if (context.canPop()) {
|
|
GoRouter.of(context).pop();
|
|
return;
|
|
}
|
|
GoRouter.of(context).go('/feed-screen');
|
|
},
|
|
),
|
|
title: Text(
|
|
'',
|
|
maxLines: 2,
|
|
textAlign: TextAlign.center,
|
|
overflow: TextOverflow.ellipsis,
|
|
softWrap: true,
|
|
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
|
),
|
|
),
|
|
body: const Loader(),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Padding _dayOfPlan(Map<int, Map<int, DailySchedule>> day, int dayNumber, S s, List<int> selectedIndexes, Diet diet) {
|
|
choiceChipWidget(int index) {
|
|
return ChoiceChip(
|
|
selectedColor: appTheme.blueA400,
|
|
pressElevation: 0,
|
|
showCheckmark: false,
|
|
side: BorderSide.none,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
label: Text((index + 1).toString()),
|
|
labelStyle: TextStyles.textXSSemibold.copyWith(
|
|
color: index == selectedIndexes[dayNumber] ? Colors.white : appTheme.gray600,
|
|
),
|
|
selected: selectedIndexes[dayNumber] == index,
|
|
backgroundColor: appTheme.gray100,
|
|
onSelected: (bool selected) {
|
|
dietsCubit.setSelectedIndex(dayNumber: dayNumber, index: index);
|
|
},
|
|
);
|
|
}
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
child: MainBackgroundBouble(
|
|
padding: const EdgeInsets.only(
|
|
top: 16,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'${s.day} ${dayNumber + 1}',
|
|
style: TextStyles.headingXLSemibold.copyWith(
|
|
color: appTheme.black,
|
|
),
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(vertical: 12),
|
|
child: CustomDivider(),
|
|
),
|
|
Text(
|
|
s.meal,
|
|
style: TextStyles.textMMedium.copyWith(
|
|
color: appTheme.black,
|
|
),
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
choiceChipWidget(0),
|
|
choiceChipWidget(1),
|
|
choiceChipWidget(2),
|
|
choiceChipWidget(3),
|
|
choiceChipWidget(4),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
ListView.builder(
|
|
shrinkWrap: true,
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemBuilder: (context, index) => _daily(day[selectedIndexes[dayNumber] + 1]?[index + 1], s),
|
|
itemCount: day[selectedIndexes[dayNumber] + 1]?.length ?? 0,
|
|
),
|
|
const SizedBox(height: 8),
|
|
],
|
|
),
|
|
),
|
|
CpfcContainer(
|
|
calories: diet.dailyNutrition[dayNumber].energy,
|
|
proteins: diet.dailyNutrition[dayNumber].proteins,
|
|
fats: diet.dailyNutrition[dayNumber].fats,
|
|
carbohydrates: diet.dailyNutrition[dayNumber].carbohydrates,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
SingleChildRenderObjectWidget _daily(DailySchedule? daily, S s) {
|
|
if (daily == null) return const SizedBox();
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 12),
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
width: MediaQuery.sizeOf(context).width * 0.6,
|
|
child: Text(
|
|
daily.name,
|
|
style: TextStyles.textMMedium.copyWith(
|
|
color: appTheme.black,
|
|
),
|
|
),
|
|
),
|
|
const Spacer(),
|
|
Text(
|
|
'${daily.quantity} ${getLocalizedMeasurementUnits(s, daily.portion)}',
|
|
style: TextStyles.textMSemibold.copyWith(
|
|
color: appTheme.black,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|