forked from eatvio/eatvio_app
refactor(fix): bottomBar
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// ignore_for_file: unused_local_variable
|
||||
|
||||
|
||||
import 'bloc/diary_edit_bloc.dart';
|
||||
import 'models/diary_edit_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -90,7 +89,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: _buildBottomBar(context) ),
|
||||
),
|
||||
),
|
||||
_buildEndDay(context),
|
||||
],
|
||||
|
||||
@@ -108,7 +108,6 @@ class DietSelectScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: _buildBottomBar(context),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ class PlanSelectScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: _buildBottomBar(context),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,6 @@ class MySettingsScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: _buildBottomBar(context),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,11 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart';
|
||||
|
||||
class RecipeEditScreen extends StatelessWidget {
|
||||
const RecipeEditScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final recipeID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<RecipeEditBloc>(
|
||||
create: (context) => RecipeEditBloc(RecipeEditState(
|
||||
recipeModelObj: RecipeEditModel(recipeID: recipeID.toString())))
|
||||
..add(RecipeEditInitialEvent()),
|
||||
create: (context) => RecipeEditBloc(RecipeEditState(recipeModelObj: RecipeEditModel(recipeID: recipeID.toString())))..add(RecipeEditInitialEvent()),
|
||||
child: RecipeEditScreen());
|
||||
}
|
||||
|
||||
@@ -55,18 +54,19 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: refreshPage(context),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: SafeArea(
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
decoration: BoxDecoration(color: Colors.grey[200]),
|
||||
child: ListView(children: [
|
||||
onRefresh: refreshPage(context),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: SafeArea(
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
decoration: BoxDecoration(color: Colors.grey[200]),
|
||||
child: ListView(
|
||||
children: [
|
||||
_buldAppBar(context),
|
||||
SizedBox(height: 20.v),
|
||||
_buildRecipeInfo(state, context),
|
||||
@@ -77,8 +77,12 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 20.v),
|
||||
_buildAdditional(context, state)
|
||||
]),
|
||||
)));
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buldAppBar(BuildContext context) {
|
||||
@@ -139,8 +143,8 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
if (state.recipe?['image'] != null)
|
||||
CachedNetworkImage(
|
||||
imageUrl: dotenv.env['STORAGE_URL']! + (state.recipe?['image']),
|
||||
width: double
|
||||
.infinity, // Установите ширину равной ширине родительского элемента
|
||||
width: double.infinity,
|
||||
// Установите ширину равной ширине родительского элемента
|
||||
height: 200.0,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => CircularProgressIndicator(),
|
||||
@@ -294,9 +298,10 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
if (state.steps?[i]['image'] != null)
|
||||
CachedNetworkImage(
|
||||
imageUrl: dotenv.env['STORAGE_URL']! + (state.steps?[i]['image']),
|
||||
width: double
|
||||
.infinity, // Установите ширину равной ширине родительского элемента
|
||||
height: 200.0, // Задайте постоянную высоту элемента
|
||||
width: double.infinity,
|
||||
// Установите ширину равной ширине родительского элемента
|
||||
height: 200.0,
|
||||
// Задайте постоянную высоту элемента
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => CircularProgressIndicator(),
|
||||
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
@@ -310,8 +315,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
text: "Добавить шаг",
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
),
|
||||
if (isLastStep &&
|
||||
!isFirstStep) // Добавляем кнопку "Добавить шаг" только для последнего шага
|
||||
if (isLastStep && !isFirstStep) // Добавляем кнопку "Добавить шаг" только для последнего шага
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(height: 16.0),
|
||||
@@ -320,8 +324,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
Flexible(
|
||||
flex: 5,
|
||||
child: CustomOutlinedButton(
|
||||
onPressed: () =>
|
||||
context.read<RecipeEditBloc>().add(AddStep()),
|
||||
onPressed: () => context.read<RecipeEditBloc>().add(AddStep()),
|
||||
text: "Добавить шаг",
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
),
|
||||
@@ -331,8 +334,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
flex: 1,
|
||||
child: CustomOutlinedButton(
|
||||
text: "х",
|
||||
onPressed: () =>
|
||||
context.read<RecipeEditBloc>().add(RemoveStep(i)),
|
||||
onPressed: () => context.read<RecipeEditBloc>().add(RemoveStep(i)),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
),
|
||||
),
|
||||
@@ -374,9 +376,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
Align(alignment: Alignment.centerLeft, child: Text("Теги")),
|
||||
_buildEditableTags(state.tags),
|
||||
SizedBox(height: 8.0),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text("Ссылка на видео (необязательно)")),
|
||||
Align(alignment: Alignment.centerLeft, child: Text("Ссылка на видео (необязательно)")),
|
||||
CustomTextFormField(
|
||||
controller: state.video_url,
|
||||
hintText: "YouTube",
|
||||
@@ -416,12 +416,10 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _trimTags(newValue) {
|
||||
List<String> newTagNames =
|
||||
newValue!.split(',').map((tag) => tag.trim()).toList();
|
||||
List<Map<String, dynamic>> newTags =
|
||||
newTagNames.map((tagName) => {'name': tagName}).toList();
|
||||
print(newTags);
|
||||
}
|
||||
List<String> newTagNames = newValue!.split(',').map((tag) => tag.trim()).toList();
|
||||
List<Map<String, dynamic>> newTags = newTagNames.map((tagName) => {'name': tagName}).toList();
|
||||
print(newTags);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
return () {
|
||||
|
||||
@@ -107,7 +107,6 @@ class RecipeSelectScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: _buildBottomBar(context),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user