forked from eatvio/eatvio_app
feat(diary): Image upload and display works properly
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart';
|
||||
import 'package:eatvio_app/widgets/custom_edit_drop_down.dart';
|
||||
@@ -394,9 +395,12 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
SizedBox(height: 30.v),
|
||||
_buildAddPhoto(context),
|
||||
SizedBox(height: 30.v),
|
||||
...state.photos!
|
||||
.map((photo) => _buildPhoto(context, photo))
|
||||
.toList(),
|
||||
...state.photos != null
|
||||
? state.photos!
|
||||
.map((photo) => _buildPhoto(context, photo))
|
||||
.toList()
|
||||
: [],
|
||||
SizedBox(height: 30.v),
|
||||
Text(
|
||||
"Ваша сытость после приёма пищи",
|
||||
style: CustomTextStyles.bodyMediumBlack900,
|
||||
@@ -631,54 +635,14 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
_buildP(BuildContext context, Map<String, dynamic> portion) {
|
||||
_buildPhoto(BuildContext context, Map<String, dynamic> photo) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 10.h),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 8.h,
|
||||
vertical: 6.v,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 10.h, vertical: 10.h),
|
||||
decoration: AppDecoration.fillGray.copyWith(
|
||||
borderRadius: BorderRadiusStyle.roundedBorder5,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 7.h,
|
||||
top: 5.v,
|
||||
),
|
||||
child: Text(
|
||||
portion['product_name'].length > 8
|
||||
? portion['product_name'].substring(0, 8)
|
||||
: portion['product_name'],
|
||||
style: CustomTextStyles.titleMedium16,
|
||||
)),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.h,
|
||||
top: 3.v,
|
||||
bottom: 3.v,
|
||||
),
|
||||
child: Text(
|
||||
portion['quantity'].toString() +
|
||||
' ' +
|
||||
portion['portion'].toString(),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: removePortion(context, portion),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 10),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color: appTheme.blueGray300,
|
||||
),
|
||||
)),
|
||||
],
|
||||
child: Image.network(
|
||||
dotenv.env['STORAGE_URL']! + photo['path'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user