This commit is contained in:
mso7nueh
2024-06-05 17:39:53 +03:00
parent b7101c72ec
commit c9f825c374
11 changed files with 166 additions and 122 deletions

View File

@@ -55,38 +55,40 @@ class DiaryEditScreen extends StatelessWidget {
alignment: Alignment.bottomCenter,
children: [
FormBuilder(
child: SafeArea(
child: Scaffold(
backgroundColor: Color.fromARGB(255, 240, 242, 245),
resizeToAvoidBottomInset: true,
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 5.v),
child: Column(
children: [
_buildHeaderRow(context, state),
SizedBox(height: 30.v),
_buildWakupRetire(context, state),
SizedBox(height: 30.v),
_buildMeal(context, state),
SizedBox(height: 20.v),
_buildMood(context, state),
SizedBox(height: 30.v),
_buildNutritionChart(context, state),
SizedBox(height: 30.v),
_buildComment(context, state),
],
),
child: Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
backgroundColor: Color.fromARGB(255, 240, 242, 245),
resizeToAvoidBottomInset: true,
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 5.v),
child: Column(
children: [
_buildHeaderRow(context, state),
SizedBox(height: 30.v),
_buildWakupRetire(context, state),
SizedBox(height: 30.v),
_buildMeal(context, state),
SizedBox(height: 20.v),
_buildMood(context, state),
SizedBox(height: 30.v),
_buildNutritionChart(context, state),
SizedBox(height: 30.v),
_buildComment(context, state),
],
),
),
),
],
),
),
],
),
),
),
@@ -142,12 +144,8 @@ class DiaryEditScreen extends StatelessWidget {
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(
imagePath: ImageConstant.imgArrowLeft,
onTap: () => GoRouter.of(context).pop(),
),
Padding(
padding: EdgeInsets.only(top: 1.v),
child: Column(

View File

@@ -24,6 +24,11 @@ class DietSelectScreen extends StatelessWidget {
builder: (context, state) {
if (state is DietSelectInitialState) {
// Это начальное состояние, данные ещё не загружены.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
return CircularProgressIndicator(
color: Colors.white,
backgroundColor: Colors.white,
@@ -33,7 +38,11 @@ class DietSelectScreen extends StatelessWidget {
return _buildSetingsScreen(context, state);
} else {
// Другие состояния, если они есть.
return Container(); // Пустой контейнер для необработанных состояний.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
},
);
@@ -41,6 +50,10 @@ class DietSelectScreen extends StatelessWidget {
_buildSetingsScreen(BuildContext context, DietSelectLoadedState state) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
backgroundColor: Colors.grey[200],
resizeToAvoidBottomInset: true,
body: SingleChildScrollView(

View File

@@ -22,8 +22,10 @@ class GlossaryScreen extends StatelessWidget {
builder: (context, state) {
if (state is GlossaryInitialState) {
// Это начальное состояние, данные ещё не загружены.
return Container(
color: Colors.white,
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
} else if (state is GlossaryLoadedState) {
// Данные загружены, можно строить экран.
@@ -33,7 +35,11 @@ class GlossaryScreen extends StatelessWidget {
return Center(child: Text(state.errorMessage));
} else {
// Другие состояния, если они есть.
return Container(); // Пустой контейнер для необработанных состояний.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
},
);
@@ -41,6 +47,10 @@ class GlossaryScreen extends StatelessWidget {
_buildGlossary(BuildContext context, GlossaryLoadedState state) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
backgroundColor: Colors.grey[200],
resizeToAvoidBottomInset: true,
body: SingleChildScrollView(

View File

@@ -24,16 +24,21 @@ class PlanSelectScreen extends StatelessWidget {
builder: (context, state) {
if (state is PlanSelectInitialState) {
// Это начальное состояние, данные ещё не загружены.
return CircularProgressIndicator(
color: Colors.white,
backgroundColor: Colors.white,
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
} else if (state is PlanSelectLoadedState) {
// Данные загружены, можно строить экран.
return _buildSetingsScreen(context, state);
} else {
// Другие состояния, если они есть.
return Container(); // Пустой контейнер для необработанных состояний.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
},
);
@@ -41,6 +46,10 @@ class PlanSelectScreen extends StatelessWidget {
_buildSetingsScreen(BuildContext context, PlanSelectLoadedState state) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
backgroundColor: Colors.grey[200],
resizeToAvoidBottomInset: true,
body: SingleChildScrollView(

View File

@@ -41,6 +41,10 @@ class MySettingsScreen extends StatelessWidget {
_buildSetingsScreen(BuildContext context, MyProfileLoadedState state) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
backgroundColor: Colors.grey[200],
resizeToAvoidBottomInset: true,
body: SingleChildScrollView(

View File

@@ -10,12 +10,12 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart';
class RecipeCreateScreen extends StatelessWidget {
const RecipeCreateScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final recipeID = ModalRoute.of(context)!.settings.arguments;
return BlocProvider<RecipeCreateBloc>(
create: (context) => RecipeCreateBloc(RecipeCreateState(
recipeModelObj: RecipeCreateModel(recipeID: recipeID.toString())))
..add(RecipeCreateInitialEvent()),
create: (context) =>
RecipeCreateBloc(RecipeCreateState(recipeModelObj: RecipeCreateModel(recipeID: recipeID.toString())))..add(RecipeCreateInitialEvent()),
child: RecipeCreateScreen());
}
@@ -52,25 +52,28 @@ class RecipeCreateScreen extends StatelessWidget {
return RefreshIndicator(
onRefresh: refreshPage(context),
child: SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
decoration: BoxDecoration(color: Colors.grey[200]),
child: ListView(children: [
_buldAppBar(context),
SizedBox(height: 20.v),
_buildRecipeInfo(state, context),
SizedBox(height: 20.v),
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: steps,
),
SizedBox(height: 20.v),
_buildAdditional(context, state)
]),
))));
child: Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
decoration: BoxDecoration(color: Colors.grey[200]),
child: ListView(children: [
_buldAppBar(context),
SizedBox(height: 20.v),
_buildRecipeInfo(state, context),
SizedBox(height: 20.v),
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: steps,
),
SizedBox(height: 20.v),
_buildAdditional(context, state)
]),
)));
}
_buldAppBar(BuildContext context) {
@@ -280,8 +283,7 @@ class RecipeCreateScreen extends StatelessWidget {
text: "Добавить шаг",
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
),
if (isLastStep &&
!isFirstStep) // Добавляем кнопку "Добавить шаг" только для последнего шага
if (isLastStep && !isFirstStep) // Добавляем кнопку "Добавить шаг" только для последнего шага
Column(
children: [
SizedBox(height: 16.0),
@@ -290,8 +292,7 @@ class RecipeCreateScreen extends StatelessWidget {
Flexible(
flex: 5,
child: CustomOutlinedButton(
onPressed: () =>
context.read<RecipeCreateBloc>().add(AddStep()),
onPressed: () => context.read<RecipeCreateBloc>().add(AddStep()),
text: "Добавить шаг",
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
),
@@ -301,8 +302,7 @@ class RecipeCreateScreen extends StatelessWidget {
flex: 1,
child: CustomOutlinedButton(
text: "х",
onPressed: () =>
context.read<RecipeCreateBloc>().add(RemoveStep(i)),
onPressed: () => context.read<RecipeCreateBloc>().add(RemoveStep(i)),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
),
),
@@ -312,8 +312,7 @@ class RecipeCreateScreen extends StatelessWidget {
),
if (!isLastStep && !isFirstStep)
CustomOutlinedButton(
onPressed: () =>
context.read<RecipeCreateBloc>().add(RemoveStep(i)),
onPressed: () => context.read<RecipeCreateBloc>().add(RemoveStep(i)),
text: "x",
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
),
@@ -356,9 +355,7 @@ class RecipeCreateScreen extends StatelessWidget {
),
),
SizedBox(height: 8.0),
Align(
alignment: Alignment.centerLeft,
child: Text("Ссылка на видео (необязательно)")),
Align(alignment: Alignment.centerLeft, child: Text("Ссылка на видео (необязательно)")),
CustomTextFormField(
controller: state.video_url,
hintText: "YouTube",
@@ -380,7 +377,6 @@ class RecipeCreateScreen extends StatelessWidget {
);
}
Function onTapBack(BuildContext context) {
return () {
onTapArrowLeft(context);

View File

@@ -54,25 +54,28 @@ class RecipeEditScreen extends StatelessWidget {
return RefreshIndicator(
onRefresh: refreshPage(context),
child: SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
decoration: BoxDecoration(color: Colors.grey[200]),
child: ListView(children: [
_buldAppBar(context),
SizedBox(height: 20.v),
_buildRecipeInfo(state, context),
SizedBox(height: 20.v),
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: steps,
),
SizedBox(height: 20.v),
_buildAdditional(context, state)
]),
))));
child: Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
decoration: BoxDecoration(color: Colors.grey[200]),
child: ListView(children: [
_buldAppBar(context),
SizedBox(height: 20.v),
_buildRecipeInfo(state, context),
SizedBox(height: 20.v),
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: steps,
),
SizedBox(height: 20.v),
_buildAdditional(context, state)
]),
)));
}
_buldAppBar(BuildContext context) {

View File

@@ -41,6 +41,10 @@ class RecipeSelectScreen extends StatelessWidget {
_buildRecipeScreen(BuildContext context, RecipeSelectLoadedState state) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
backgroundColor: Colors.grey[200],
resizeToAvoidBottomInset: true,
body: SingleChildScrollView(

View File

@@ -50,30 +50,33 @@ class RecipeScreen extends StatelessWidget {
steps.add(_buildStep(context, state, i));
}
}
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
decoration: AppDecoration.fillGray,
child: ListView(
children: [
SizedBox(height: 15.v),
_buildHeaderRow(context, state),
SizedBox(height: 15.v),
_buildRecipeData(context, state),
SizedBox(height: 15.v),
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: steps,
),
SizedBox(height: 15.v),
_buildTextField(context, state),
SizedBox(height: 15.v),
_buildCommentSection(context, state),
],
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
automaticallyImplyLeading: false,
),
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
decoration: AppDecoration.fillGray,
child: ListView(
children: [
SizedBox(height: 15.v),
_buildHeaderRow(context, state),
SizedBox(height: 15.v),
_buildRecipeData(context, state),
SizedBox(height: 15.v),
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: steps,
),
)));
SizedBox(height: 15.v),
_buildTextField(context, state),
SizedBox(height: 15.v),
_buildCommentSection(context, state),
],
),
));
}
_buildHeaderRow(BuildContext context, RecipeLoadedState state) {

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../core/app_export.dart';
/// Helper class for managing themes and colors.
@@ -50,6 +51,13 @@ class ThemeHelper {
colorScheme: colorScheme,
textTheme: TextThemes.textTheme(colorScheme),
scaffoldBackgroundColor: colorScheme.onPrimary,
appBarTheme: AppBarTheme(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light,
systemNavigationBarColor: Colors.white,
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
backgroundColor: Colors.transparent,

View File

@@ -31,10 +31,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
@override
Widget build(BuildContext context) {
return AppBar(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light,
),
toolbarHeight: height ?? 56.v,
automaticallyImplyLeading: false,
backgroundColor: Colors.transparent,