forked from eatvio/eatvio_app
179 lines
7.0 KiB
Dart
179 lines
7.0 KiB
Dart
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
|
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:eatvio_app/core/widgets/custom_divider.dart';
|
|
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
|
|
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
|
|
import 'package:eatvio_app/features/create_diet/presentation/cubit/create_diet_cubit.dart';
|
|
import 'package:eatvio_app/features/create_diet/presentation/cubit/create_diet_state.dart';
|
|
import 'package:eatvio_app/features/feed/presentation/widgets/choice_chip_widget.dart';
|
|
import 'package:eatvio_app/generated/l10n.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
class DayWidget extends StatefulWidget {
|
|
const DayWidget({
|
|
super.key,
|
|
required this.index,
|
|
});
|
|
final int index;
|
|
@override
|
|
State<DayWidget> createState() => _DayWidgetState();
|
|
}
|
|
|
|
class _DayWidgetState extends State<DayWidget> {
|
|
int _selectedDayIndex = 0;
|
|
final chipsLabelList = ['1', '2', '3', '4', '5'];
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final s = S.of(context);
|
|
return BlocBuilder<CreateDietCubit, CreateDietState>(
|
|
builder: (context, state) {
|
|
return MainBackgroundBouble(
|
|
child: Padding(
|
|
padding: EdgeInsets.only(
|
|
left: 16,
|
|
right: 16,
|
|
top: 16,
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text(
|
|
s.day + ' ${widget.index + 1}',
|
|
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
|
),
|
|
Spacer(),
|
|
SvgPicture.asset(
|
|
'assets/icons/copy2.svg',
|
|
width: 20,
|
|
height: 24,
|
|
colorFilter: ColorFilter.mode(appTheme.black, BlendMode.srcIn),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
CustomDivider(),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
Text(
|
|
s.meal,
|
|
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
|
|
),
|
|
SizedBox(height: 16),
|
|
Row(
|
|
children: [
|
|
ChoiceChipWidget(
|
|
chipsLabelList: chipsLabelList,
|
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
|
fontSize: TextStyles.textMMedium.fontSize,
|
|
fontWeight: TextStyles.textMMedium.fontWeight,
|
|
index: 0,
|
|
selectedChipIndex: _selectedDayIndex,
|
|
onSelected: (selectedValue) {
|
|
setState(() {
|
|
_selectedDayIndex = 0;
|
|
});
|
|
},
|
|
),
|
|
Spacer(),
|
|
ChoiceChipWidget(
|
|
chipsLabelList: chipsLabelList,
|
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
|
fontSize: TextStyles.textMMedium.fontSize,
|
|
fontWeight: TextStyles.textMMedium.fontWeight,
|
|
index: 1,
|
|
selectedChipIndex: _selectedDayIndex,
|
|
onSelected: (selectedValue) {
|
|
setState(() {
|
|
_selectedDayIndex = 1;
|
|
});
|
|
},
|
|
),
|
|
Spacer(),
|
|
ChoiceChipWidget(
|
|
chipsLabelList: chipsLabelList,
|
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
|
fontSize: TextStyles.textMMedium.fontSize,
|
|
fontWeight: TextStyles.textMMedium.fontWeight,
|
|
index: 2,
|
|
selectedChipIndex: _selectedDayIndex,
|
|
onSelected: (selectedValue) {
|
|
setState(() {
|
|
_selectedDayIndex = 2;
|
|
});
|
|
},
|
|
),
|
|
Spacer(),
|
|
ChoiceChipWidget(
|
|
chipsLabelList: chipsLabelList,
|
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
|
fontSize: TextStyles.textMMedium.fontSize,
|
|
fontWeight: TextStyles.textMMedium.fontWeight,
|
|
index: 3,
|
|
selectedChipIndex: _selectedDayIndex,
|
|
onSelected: (selectedValue) {
|
|
setState(() {
|
|
_selectedDayIndex = 3;
|
|
});
|
|
},
|
|
),
|
|
Spacer(),
|
|
ChoiceChipWidget(
|
|
chipsLabelList: chipsLabelList,
|
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
|
fontSize: TextStyles.textMMedium.fontSize,
|
|
fontWeight: TextStyles.textMMedium.fontWeight,
|
|
index: 4,
|
|
selectedChipIndex: _selectedDayIndex,
|
|
onSelected: (selectedValue) {
|
|
setState(() {
|
|
_selectedDayIndex = 4;
|
|
});
|
|
},
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 16),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
|
decoration: BoxDecoration(color: appTheme.gray50, borderRadius: BorderRadius.all(Radius.circular(12))),
|
|
child: SvgPicture.asset(
|
|
'assets/icons/paste2.svg',
|
|
width: 28,
|
|
height: 24,
|
|
),
|
|
),
|
|
SizedBox(width: 8),
|
|
Expanded(
|
|
child: CustomOutlinedButton(
|
|
text: s.add,
|
|
height: 52,
|
|
buttonTextStyle: TextStyles.textMSemibold.copyWith(
|
|
color: appTheme.whiteA700,
|
|
),
|
|
buttonStyle: ButtonStyle(
|
|
side: WidgetStatePropertyAll(BorderSide.none),
|
|
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 20),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|