forked from eatvio/eatvio_app
fix(recipe): tags error
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// String baseUrl = 'https://eatvio.ru';
|
String baseUrl = 'https://eatvio.ru';
|
||||||
String baseUrl = 'https://dev2.eatvio.com';
|
// String baseUrl = 'https://dev2.eatvio.com';
|
||||||
|
|
||||||
const List<int> durationValues = [7, 14, 21];
|
const List<int> durationValues = [7, 14, 21];
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||||
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
|
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
|
||||||
import 'package:eatvio_app/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart';
|
import 'package:eatvio_app/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart';
|
||||||
|
import 'package:eatvio_app/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
@@ -14,79 +15,73 @@ class TagsWidget extends StatefulWidget {
|
|||||||
class _TagsWidgetState extends State<TagsWidget> {
|
class _TagsWidgetState extends State<TagsWidget> {
|
||||||
late final CreateRecipeCubit createRecipeCubit;
|
late final CreateRecipeCubit createRecipeCubit;
|
||||||
final tagController = TextEditingController();
|
final tagController = TextEditingController();
|
||||||
late final List<String> tags;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
createRecipeCubit = context.read<CreateRecipeCubit>();
|
|
||||||
tags = createRecipeCubit.state.entity.tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
builder: (BuildContext context, CreateRecipeState state) {
|
||||||
children: [
|
return Column(
|
||||||
const Text('Теги'),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
const SizedBox(height: 4),
|
|
||||||
CustomTextFormField(
|
|
||||||
hintText: 'Например: без майонеза',
|
|
||||||
controller: tagController,
|
|
||||||
suffix: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (tagController.text.isNotEmpty) {
|
|
||||||
setState(() {
|
|
||||||
tags.add(tagController.text);
|
|
||||||
tagController.clear();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.done,
|
|
||||||
color: appTheme.blueA400,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
Wrap(
|
|
||||||
spacing: 8,
|
|
||||||
runSpacing: 8,
|
|
||||||
children: [
|
children: [
|
||||||
for (int i = 0; i < tags.length; i++) ...[
|
const Text('Теги'),
|
||||||
InkWell(
|
const SizedBox(height: 4),
|
||||||
onTap: () {
|
CustomTextFormField(
|
||||||
setState(() {
|
hintText: 'Например: без майонеза',
|
||||||
tags.remove(tags[i]);
|
controller: tagController,
|
||||||
});
|
suffix: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (tagController.text.isNotEmpty) {
|
||||||
|
context.read<CreateRecipeCubit>().addTag(tagController.text);
|
||||||
|
setState(() {
|
||||||
|
tagController.clear();
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
borderRadius: BorderRadius.circular(16),
|
icon: Icon(
|
||||||
child: Ink(
|
Icons.done,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
|
color: appTheme.blueA400,
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(16),
|
|
||||||
color: Colors.grey.shade200,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
tags[i],
|
|
||||||
),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Icon(
|
|
||||||
Icons.delete_outline_rounded,
|
|
||||||
color: Colors.grey.shade600,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Wrap(
|
||||||
|
spacing: 8,
|
||||||
|
runSpacing: 8,
|
||||||
|
children: [
|
||||||
|
for (int i = 0; i < state.entity.tags.length; i++) ...[
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
context.read<CreateRecipeCubit>().removeTag(state.entity.tags[i]);
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
child: Ink(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
color: Colors.grey.shade200,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
state.entity.tags[i],
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Icon(
|
||||||
|
Icons.delete_outline_rounded,
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -756,6 +756,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
)
|
)
|
||||||
: Tooltip(
|
: Tooltip(
|
||||||
message: state.profile.badges[i].description,
|
message: state.profile.badges[i].description,
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 32),
|
||||||
triggerMode: TooltipTriggerMode.tap,
|
triggerMode: TooltipTriggerMode.tap,
|
||||||
textStyle: const TextStyle(
|
textStyle: const TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
|
|||||||
Reference in New Issue
Block a user