forked from eatvio/eatvio_app
refactor(app): Assemble release
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:image_picker/image_picker.dart';
|
||||
import 'package:eatvio_app/presentation/diary/diary_edit_screen/models/diary_edit_model.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'dart:convert';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
part 'diary_edit_event.dart';
|
||||
@@ -44,9 +45,10 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
Emitter<DiaryEditState> emit,
|
||||
) async {
|
||||
try {
|
||||
final token =
|
||||
"9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a";
|
||||
|
||||
// final token =
|
||||
// "9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a";
|
||||
final box = await Hive.openBox('token');
|
||||
final token = box.get('token');
|
||||
//print(await fetchDiaryId(token));
|
||||
final int diaryId = await fetchDiaryId(token);
|
||||
try {
|
||||
@@ -215,9 +217,10 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
) async {
|
||||
print("Reloading...");
|
||||
try {
|
||||
final token =
|
||||
"9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a";
|
||||
|
||||
//final token =
|
||||
// "9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a"; final box = await Hive.openBox('token');
|
||||
final box = await Hive.openBox('token');
|
||||
final token = box.get('token');
|
||||
final response = await http.get(
|
||||
Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/index'),
|
||||
headers: {
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:eatvio_app/widgets/custom_edit_drop_down.dart';
|
||||
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
|
||||
import 'package:eatvio_app/widgets/custom_scale_element.dart';
|
||||
import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class DiaryEditScreen extends StatelessWidget {
|
||||
@@ -401,13 +402,14 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
.map((portion) => _buildProduct(context, portion))
|
||||
.toList(),
|
||||
SizedBox(height: 30.v),
|
||||
...state.photos != null
|
||||
/*...state.photos != null
|
||||
? state.photos!.isEmpty
|
||||
? [Text('Фото пока нет')]
|
||||
: state.photos!
|
||||
.map((photo) => _buildPhoto(context, photo))
|
||||
.toList()
|
||||
: [Text('Фото нет')],
|
||||
: [Text('Фото нет')],*/
|
||||
_buildCarousel(context, state),
|
||||
SizedBox(height: 20.v),
|
||||
_buildAddPhoto(context),
|
||||
SizedBox(height: 30.v),
|
||||
@@ -601,6 +603,20 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
};
|
||||
}
|
||||
|
||||
_buildCarousel(BuildContext context, DiaryEditLoadedState state) {
|
||||
if (state.photos!.isEmpty) {
|
||||
return Text("Фото нет");
|
||||
} else {
|
||||
return CarouselSlider(
|
||||
options: CarouselOptions(height: 340.0),
|
||||
items: state.photos!.map<Widget>((photo) {
|
||||
return _buildPhoto(
|
||||
context, photo); // Assuming photos are stored as strings
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
_buildProduct(BuildContext context, Map<String, dynamic> portion) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 10.h),
|
||||
|
||||
Reference in New Issue
Block a user