forked from eatvio/eatvio_app
feat(calendar): Diet days marked in calendar, diet preview page added
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
// 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: [],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -250,11 +250,6 @@ class DiaryScreen extends StatelessWidget {
|
||||
style: CustomTextStyles.titleMediumBlack,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 2.v),
|
||||
Text(
|
||||
state.diary.date.toString(),
|
||||
style: CustomTextStyles.bodyMediumBluegray800,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user