forked from eatvio/eatvio_app
92 lines
2.7 KiB
Dart
92 lines
2.7 KiB
Dart
// ignore_for_file: unused_local_variable
|
|
|
|
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
|
|
import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
|
|
import 'package:eatvio_app/core/app_export.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
|
|
|
// ignore: must_be_immutable
|
|
class DiaryRecommendationsScreen extends StatelessWidget {
|
|
final String? diary_recommendationsID;
|
|
|
|
const DiaryRecommendationsScreen({
|
|
this.diary_recommendationsID,
|
|
super.key,
|
|
});
|
|
|
|
Widget build(BuildContext context) {
|
|
if (diary_recommendationsID != "0") {
|
|
context.read<DiaryBloc>().add(LoadDiaryById(diary_recommendationsID));
|
|
}
|
|
return BlocBuilder<DiaryBloc, DiaryState>(
|
|
builder: (context, state) {
|
|
if (state is DiaryStateLoaded) {
|
|
return _buildDiaryRecommendations(context, state);
|
|
} else if (state is DiaryStateLoading) {
|
|
return Scaffold(
|
|
body: Center(
|
|
child: CupertinoActivityIndicator(),
|
|
),
|
|
);
|
|
} else if (state is DiaryStateError) {
|
|
return Scaffold(
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Center(
|
|
child: Text(state.errorMessage),
|
|
),
|
|
),
|
|
);
|
|
} else
|
|
return Scaffold(
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Center(
|
|
child: Text("Неопределенная ошибка"),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _buildDiaryRecommendations(
|
|
BuildContext context, DiaryStateLoaded state) {
|
|
return Stack(
|
|
alignment: Alignment.bottomCenter,
|
|
children: [
|
|
FormBuilder(
|
|
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: [],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|