fix: remove sizer

This commit is contained in:
mso7nueh
2024-09-11 13:56:33 +03:00
parent 220e13d525
commit 3aa9e8cba8
38 changed files with 359 additions and 413 deletions

View File

@@ -73,7 +73,7 @@ class DiaryRecommendationsScreen extends StatelessWidget {
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 5.v),
padding: EdgeInsets.only(bottom: 9),
child: Column(
children: [
Scaffold(

View File

@@ -84,19 +84,19 @@ class DiaryScreen extends StatelessWidget {
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 5.v),
padding: EdgeInsets.only(bottom: 8),
child: Column(
children: [
_buildHeaderRow(context, state),
SizedBox(height: 8.v),
SizedBox(height: 8),
_buildWakupRetire(context, state),
SizedBox(height: 8.v),
SizedBox(height: 8),
_buildMeal(context, state),
SizedBox(height: 8.v),
SizedBox(height: 8),
_buildMood(context, state),
SizedBox(height: 8.v),
SizedBox(height: 8),
_buildNutritionChart(context, state),
SizedBox(height: 8.v),
SizedBox(height: 8),
// _buildComment(context, state),
// SizedBox(height: 8.v),
_buildEndDay(context),
@@ -118,8 +118,8 @@ class DiaryScreen extends StatelessWidget {
_buildNutritionChart(BuildContext context, DiaryStateLoaded state) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: 24.h,
vertical: 12.v,
horizontal: 24,
vertical: 12,
),
decoration: BoxDecoration(
color: Colors.white,
@@ -176,13 +176,13 @@ class DiaryScreen extends StatelessWidget {
children: [
Text(
'${state.chartData['dailyNutritionIntake']['carbohydrates'].toStringAsFixed(1)} из ${state.chartData['dailyNutritionRecommendation']['carbohydrates'].toStringAsFixed(1)} грамм'),
SizedBox(height: 8.v),
SizedBox(height: 8),
Text(
'${state.chartData['dailyNutritionIntake']['fats'].toStringAsFixed(1)} из ${state.chartData['dailyNutritionRecommendation']['fats'].toStringAsFixed(1)} грамм'),
SizedBox(height: 8.v),
SizedBox(height: 8),
Text(
'${state.chartData['dailyNutritionIntake']['proteins'].toStringAsFixed(1)} из ${state.chartData['dailyNutritionRecommendation']['proteins'].toStringAsFixed(1)} грамм'),
SizedBox(height: 8.v),
SizedBox(height: 8),
Text(
'${state.chartData['dailyNutritionIntake']['energy'].toStringAsFixed(1)} из ${state.chartData['dailyNutritionRecommendation']['energy'].toStringAsFixed(1)} Ккал'),
],
@@ -228,8 +228,8 @@ class DiaryScreen extends StatelessWidget {
final day = state.diary.id;
return Container(
padding: EdgeInsets.symmetric(
horizontal: 24.h,
vertical: 12.v,
horizontal: 24,
vertical: 12,
),
decoration: BoxDecoration(
color: Colors.white,
@@ -239,7 +239,7 @@ class DiaryScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(top: 1.v),
padding: EdgeInsets.only(top: 4),
child: Column(
children: [
Align(
@@ -295,10 +295,10 @@ class DiaryScreen extends StatelessWidget {
children: [
if (!isLoading)
Container(
margin: EdgeInsets.symmetric(horizontal: 10.h),
margin: EdgeInsets.symmetric(horizontal: 12),
padding: EdgeInsets.symmetric(
horizontal: 40.h,
vertical: 80.v,
horizontal: 32,
vertical: 64,
),
decoration: AppDecoration.fillGray.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder5,
@@ -309,8 +309,8 @@ class DiaryScreen extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.only(
left: 7.h,
top: 5.v,
left: 8,
top: 8,
),
child: Text(
"Добавить фото",
@@ -327,10 +327,10 @@ class DiaryScreen extends StatelessWidget {
),
if (isLoading)
Container(
margin: EdgeInsets.symmetric(horizontal: 10.h),
margin: EdgeInsets.symmetric(horizontal: 12),
padding: EdgeInsets.symmetric(
horizontal: 40.h,
vertical: 80.v,
horizontal: 32,
vertical: 64,
),
decoration: AppDecoration.fillGray.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder5,
@@ -366,8 +366,8 @@ class DiaryScreen extends StatelessWidget {
FocusNode focusNodeName = FocusNode();
return Container(
padding: EdgeInsets.symmetric(
horizontal: 24.h,
vertical: 12.v,
horizontal: 24,
vertical: 12,
),
decoration: BoxDecoration(
color: Colors.white,
@@ -377,7 +377,7 @@ class DiaryScreen extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.h),
padding: EdgeInsets.symmetric(horizontal: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -388,7 +388,7 @@ class DiaryScreen extends StatelessWidget {
Expanded(
// Adding Expanded widget
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.h),
padding: EdgeInsets.symmetric(horizontal: 12),
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width - 260,
@@ -408,9 +408,9 @@ class DiaryScreen extends StatelessWidget {
],
),
),
SizedBox(height: 20.v),
SizedBox(height: 24),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.h),
padding: EdgeInsets.symmetric(horizontal: 12),
child: BlocSelector<DiaryBloc, DiaryState, DiaryModel?>(
selector: (state) {
if (state is DiaryStateLoaded)
@@ -422,8 +422,8 @@ class DiaryScreen extends StatelessWidget {
return CustomDropDown(
items: state.mealList,
contentPadding: EdgeInsets.symmetric(
horizontal: 10.h,
vertical: 9.v,
horizontal: 12,
vertical: 12,
),
defaultValue: state.mealList[0],
onChanged: changeMeal(context, state),
@@ -431,9 +431,9 @@ class DiaryScreen extends StatelessWidget {
},
),
),
SizedBox(height: 20.v),
SizedBox(height: 24),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.h),
padding: EdgeInsets.symmetric(horizontal: 12),
child: RawAutocomplete<String>(
optionsBuilder: buildOptions(_options),
fieldViewBuilder: (
@@ -482,25 +482,25 @@ class DiaryScreen extends StatelessWidget {
},
),
),
SizedBox(height: 20.v),
SizedBox(height: 24),
if (state.moderationExpanded)
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.h),
padding: EdgeInsets.symmetric(horizontal: 12),
child: GestureDetector(
onTap: () => openCaloriesDialog(context, state),
child: Text("Отправить на модерацию"),
),
),
SizedBox(height: 20.v),
SizedBox(height: 24),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.h),
padding: EdgeInsets.symmetric(horizontal: 12),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CustomTextFormField(
width: 150.h,
width: 128,
hintText: "Кол-во",
textInputAction: TextInputAction.done,
// focusNode: focusNodeQuantity,
@@ -509,7 +509,7 @@ class DiaryScreen extends StatelessWidget {
inputFormatters: <TextInputFormatter>[digitsOnly],
),
Padding(
padding: EdgeInsets.only(left: 30.h),
padding: EdgeInsets.only(left: 32),
child: BlocSelector<DiaryBloc, DiaryState, DiaryModel?>(
selector: (state) {
if (state is DiaryStateLoaded) {
@@ -530,21 +530,21 @@ class DiaryScreen extends StatelessWidget {
),
),
),
SizedBox(height: 24.v),
SizedBox(height: 24),
_buildAddProduct(context, state),
SizedBox(height: 24.v),
SizedBox(height: 24),
if (!state.diary.state.has_chosen_diet) ...state.portions.map((portion) => _buildProduct(context, portion)).toList(),
if (state.diary.state.has_chosen_diet) ...state.portions.map((portion) => _buildProductDiet(context, portion)).toList(),
SizedBox(height: 24.v),
SizedBox(height: 24),
_buildCarousel(context, state),
SizedBox(height: 24.v),
SizedBox(height: 24),
_buildAddPhoto(context, state),
SizedBox(height: 24.v),
SizedBox(height: 24),
Text(
"Ваша сытость после приёма пищи",
style: CustomTextStyles.bodyMediumBlack900,
),
SizedBox(height: 15.v),
SizedBox(height: 16),
BlocBuilder<DiaryBloc, DiaryState>(
builder: (context, state) {
if (state is DiaryStateLoaded) {
@@ -609,25 +609,25 @@ class DiaryScreen extends StatelessWidget {
hintText: "Название",
controller: state.product_nameController,
),
SizedBox(height: 10.v),
SizedBox(height: 12),
CustomTextFormField(
hintText: "Энергетическая ценность на 100",
keyboardType: TextInputType.number,
controller: state.caloriesController,
),
SizedBox(height: 10.v),
SizedBox(height: 12),
CustomTextFormField(
hintText: "Белки на 100г",
keyboardType: TextInputType.number,
controller: state.proteinsController,
),
SizedBox(height: 10.v),
SizedBox(height: 12),
CustomTextFormField(
hintText: "Жиры на 100г",
keyboardType: TextInputType.number,
controller: state.fatsController,
),
SizedBox(height: 10.v),
SizedBox(height: 12),
CustomTextFormField(
hintText: "Углеводы на 100г",
keyboardType: TextInputType.number,
@@ -743,10 +743,10 @@ class DiaryScreen extends StatelessWidget {
_buildProduct(BuildContext context, Portion portion) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 10.h),
margin: EdgeInsets.symmetric(horizontal: 12),
padding: EdgeInsets.symmetric(
horizontal: 8.h,
vertical: 6.v,
horizontal: 8,
vertical: 8,
),
decoration: AppDecoration.fillGray.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder5,
@@ -757,8 +757,8 @@ class DiaryScreen extends StatelessWidget {
children: [
Padding(
padding: EdgeInsets.only(
left: 7.h,
top: 5.v,
left: 8,
top: 8,
),
child: Text(
portion.product_name.length > 8 ? portion.product_name.substring(0, 8) : portion.product_name,
@@ -767,9 +767,9 @@ class DiaryScreen extends StatelessWidget {
),
Padding(
padding: EdgeInsets.only(
left: 20.h,
top: 3.v,
bottom: 3.v,
left: 24,
top: 4,
bottom: 4,
),
child: Text(
portion.quantity.toString() + ' ' + portion.portion.toString().tr,
@@ -794,12 +794,12 @@ class DiaryScreen extends StatelessWidget {
_buildProductDiet(BuildContext context, Portion portion) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10.h,
vertical: 4.h,
horizontal: 12,
vertical: 4,
),
padding: EdgeInsets.symmetric(
horizontal: 8.h,
vertical: 6.v,
horizontal: 8,
vertical: 8,
),
decoration: AppDecoration.fillGray.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder5,
@@ -814,8 +814,8 @@ class DiaryScreen extends StatelessWidget {
),
Padding(
padding: EdgeInsets.only(
left: 7.h,
top: 5.v,
left: 8,
top: 8,
),
child: Text(
portion.product_name.length > 18 ? portion.product_name.substring(0, 18) : portion.product_name,
@@ -825,9 +825,9 @@ class DiaryScreen extends StatelessWidget {
Spacer(),
Padding(
padding: EdgeInsets.only(
left: 20.h,
top: 3.v,
bottom: 3.v,
left: 24,
top: 4,
bottom: 4,
),
child: Text(
portion.quantity.toString() + ' ' + portion.portion.toString().tr,
@@ -842,7 +842,7 @@ class DiaryScreen extends StatelessWidget {
return Stack(
children: [
Container(
margin: EdgeInsets.symmetric(horizontal: 10.h, vertical: 10.h),
margin: EdgeInsets.symmetric(horizontal: 12, vertical: 12),
decoration: AppDecoration.fillGray.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder5,
),
@@ -856,7 +856,7 @@ class DiaryScreen extends StatelessWidget {
left: 0,
right: 0,
child: Container(
height: 50.h, // Высота затемненной области
height: 64, // Высота затемненной области
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
@@ -938,8 +938,8 @@ class DiaryScreen extends StatelessWidget {
_buildWakupRetire(BuildContext context, DiaryStateLoaded state) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: 24.h,
vertical: 12.v,
horizontal: 24,
vertical: 12,
),
decoration: BoxDecoration(
color: Colors.white,
@@ -965,7 +965,7 @@ class DiaryScreen extends StatelessWidget {
padding: const EdgeInsets.only(left: 16.0),
child: Column(
children: [
SizedBox(height: 20.v),
SizedBox(height: 24),
GestureDetector(
onTap: () => _selectWakeupTime(context, state),
child: AbsorbPointer(
@@ -976,7 +976,7 @@ class DiaryScreen extends StatelessWidget {
),
),
),
SizedBox(height: 20.v),
SizedBox(height: 24),
GestureDetector(
onTap: () => _selectRetireTime(context, state),
child: AbsorbPointer(
@@ -987,7 +987,7 @@ class DiaryScreen extends StatelessWidget {
),
),
),
SizedBox(height: 20.v),
SizedBox(height: 24),
],
),
),
@@ -1044,8 +1044,8 @@ class DiaryScreen extends StatelessWidget {
_buildMood(BuildContext context, DiaryStateLoaded state) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: 24.h,
vertical: 12.v,
horizontal: 24,
vertical: 12,
),
decoration: BoxDecoration(
color: Colors.white,