fix: analyzer

This commit is contained in:
mso7nueh
2025-10-21 14:07:12 +03:00
parent 4c5532ff32
commit 1841199291
8 changed files with 333 additions and 363 deletions

View File

@@ -26,85 +26,89 @@ class _StepsWidgetState extends State<StepsWidget> {
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Пошаговая инструкция',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xFF323F4B)),
),
const SizedBox(height: 12),
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(color: appTheme.blueA400, borderRadius: BorderRadius.circular(8)),
child: Text(
'Шаг ${index + 1}',
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.w600),
),
),
GestureDetector(
onTap: () {
context.read<CreateRecipeCubit>().removeStep(state.entity.steps[index]);
},
child: const Icon(Icons.delete_outline_rounded),
),
],
),
const SizedBox(height: 12),
const Text('Описание'),
const SizedBox(height: 4),
CustomTextFormField(
key: Key('${AppKeys.recipeCreateScreenStepDescriptionField}_$index'),
hintText: 'Например: подготовьте ингредиенты',
initialValue: widget.createRecipeCubit.state.entity.steps[index].description,
maxLines: 5,
minLines: 3,
onChanged: (value) {
widget.createRecipeCubit.replaceDescriptionInStep(value, index);
},
),
const SizedBox(height: 12),
const Text('Фото шага'),
const SizedBox(height: 4),
StepImageWidget(
key: Key('${AppKeys.recipeCreateScreenStepImageWidget}_$index'),
index: index,
createRecipeCubit: widget.createRecipeCubit,
),
],
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Пошаговая инструкция',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xFF323F4B)),
),
itemCount: state.entity.steps.length,
separatorBuilder: (BuildContext context, int index) => const SizedBox(height: 24),
),
InkWell(
key: AppKeys.recipeCreateScreenAddStepButton,
onTap: () {
context.read<CreateRecipeCubit>().addStep();
},
borderRadius: BorderRadius.circular(20),
child: Ink(
width: MediaQuery.of(context).size.width - 32,
decoration: BoxDecoration(color: appTheme.blueA400, borderRadius: BorderRadius.circular(20)),
child: Container(
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: const Text(
'Добавить шаг',
style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w600),
const SizedBox(height: 12),
InkWell(
key: AppKeys.recipeCreateScreenAddStepButton,
onTap: () {
context.read<CreateRecipeCubit>().addStep();
},
borderRadius: BorderRadius.circular(20),
child: Ink(
width: MediaQuery.of(context).size.width - 32,
decoration: BoxDecoration(color: appTheme.blueA400, borderRadius: BorderRadius.circular(20)),
child: Container(
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: const Text(
'Добавить шаг',
style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w600),
),
),
),
),
),
],
const SizedBox(height: 12),
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(color: appTheme.blueA400, borderRadius: BorderRadius.circular(8)),
child: Text(
'Шаг ${index + 1}',
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.w600),
),
),
GestureDetector(
onTap: () {
context.read<CreateRecipeCubit>().removeStep(state.entity.steps[index]);
},
child: const Icon(Icons.delete_outline_rounded),
),
],
),
const SizedBox(height: 12),
const Text('Описание'),
const SizedBox(height: 4),
CustomTextFormField(
key: AppKeys.recipeCreateScreenStepDescriptionField,
hintText: 'Например: подготовьте ингредиенты',
initialValue: widget.createRecipeCubit.state.entity.steps[index].description,
maxLines: 5,
minLines: 3,
onChanged: (value) {
widget.createRecipeCubit.replaceDescriptionInStep(value, index);
},
),
const SizedBox(height: 12),
const Text('Фото шага'),
const SizedBox(height: 4),
StepImageWidget(
key: Key('${AppKeys.recipeCreateScreenStepImageWidget}_$index'),
index: index,
createRecipeCubit: widget.createRecipeCubit,
),
],
),
itemCount: state.entity.steps.length,
separatorBuilder: (BuildContext context, int index) => const SizedBox(height: 24),
),
],
),
),
),
);