feat: settings

This commit is contained in:
mso7nueh
2024-09-30 17:44:25 +03:00
parent c7f1af7c6f
commit 5442a3f2e2
42 changed files with 600 additions and 166 deletions

Binary file not shown.

View File

@@ -172,10 +172,11 @@ class AppRouter {
builder: (context, state) => SettingsScreen(),
routes: [
GoRoute(
path: 'general-info-screen',
path: 'general-info-screen/:isPublicProfile',
name: 'generalInfoScreen',
builder: (context, state) => GeneralInfoScreen(
profileDetailsModel: state.extra as ProfileDetailsModel,
isPublicProfile: bool.parse(state.pathParameters['isPublicProfile']!),
),
),
GoRoute(

View File

@@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'package:share_plus/share_plus.dart';
class BlogPostScreen extends StatefulWidget {
@@ -320,7 +321,13 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
if (state is CommentsStateLoading)
Padding(
padding: const EdgeInsets.all(32),
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
if (state is CommentsStateLoaded)
CommentsWidget(

View File

@@ -9,6 +9,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
import 'package:rive/rive.dart';
class CalendarScreen extends StatelessWidget {
CalendarScreen({Key? key}) : super(key: key);
@@ -23,7 +24,13 @@ class CalendarScreen extends StatelessWidget {
} else if (state is CalendarStateLoading) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is CalendarStateError) {

View File

@@ -10,6 +10,7 @@ import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/intl.dart';
import 'package:rive/rive.dart';
class ChatScreen extends StatefulWidget {
final String chatId;
@@ -62,7 +63,13 @@ class _ChatScreenState extends State<ChatScreen> {
} else {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -165,7 +172,15 @@ class _ChatScreenState extends State<ChatScreen> {
} else {
return Padding(
padding: const EdgeInsets.all(8),
child: Center(child: CircularProgressIndicator()),
child: Center(
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
},

View File

@@ -6,6 +6,7 @@ import 'package:eatvio_app/features/chat/presentation/widgets/chat_search_bar_wi
import 'package:eatvio_app/locator_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:rive/rive.dart';
class ChatSelectScreen extends StatefulWidget {
const ChatSelectScreen({Key? key}) : super(key: key);
@@ -78,7 +79,13 @@ class _ChatSelectScreenState extends State<ChatSelectScreen> {
if (state is ChatSelectStateLoading) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is ChatSelectStateLoaded) {
@@ -91,7 +98,13 @@ class _ChatSelectScreenState extends State<ChatSelectScreen> {
} else {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}

View File

@@ -6,6 +6,7 @@ import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:rive/rive.dart';
// ignore: must_be_immutable
class DiaryRecommendationsScreen extends StatelessWidget {
@@ -27,7 +28,13 @@ class DiaryRecommendationsScreen extends StatelessWidget {
} else if (state is DiaryStateLoading) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is DiaryStateError) {

View File

@@ -20,6 +20,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:image_picker/image_picker.dart';
import 'package:rive/rive.dart' as rive;
import 'package:syncfusion_flutter_charts/charts.dart';
class DiaryScreen extends StatelessWidget {
@@ -43,7 +44,13 @@ class DiaryScreen extends StatelessWidget {
} else if (state is DiaryStateLoading) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: rive.RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is DiaryStateError) {
@@ -342,7 +349,13 @@ class DiaryScreen extends StatelessWidget {
borderRadius: BorderRadiusStyle.roundedBorder5,
),
child: Center(
child: CircularProgressIndicator(color: appTheme.blueGray300), // Замените на свой прелоадер при необходимости
child: SizedBox(
height: 32,
width: 32,
child: rive.RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
),
],

View File

@@ -12,6 +12,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
class AboutDietScreen extends StatefulWidget {
final Diet diet;
@@ -329,7 +330,13 @@ class _AboutDietScreenState extends State<AboutDietScreen> {
if (state is CommentsStateLoading)
Padding(
padding: const EdgeInsets.all(32),
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
if (state is CommentsStateLoaded)
CommentsWidget(

View File

@@ -17,6 +17,7 @@ import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
final bucket = PageStorageBucket();
@@ -164,7 +165,13 @@ class _FeedScreenState extends State<FeedScreen> {
if (index == state.feedBlogPostList.length) {
return Container(
alignment: Alignment.center,
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
);
}
return BlogPostWidget(feedBlogPostModel: state.feedBlogPostList[index]);
@@ -188,7 +195,13 @@ class _FeedScreenState extends State<FeedScreen> {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -232,7 +245,13 @@ class _FeedScreenState extends State<FeedScreen> {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -276,7 +295,13 @@ class _FeedScreenState extends State<FeedScreen> {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -320,7 +345,13 @@ class _FeedScreenState extends State<FeedScreen> {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}

View File

@@ -29,7 +29,6 @@ class ProfileCubit extends Cubit<ProfileState> {
_currentPeriod = period;
try {
final profile = await profileRepository.getMyProfile();
await Future.delayed(Duration(seconds: 2));
emit(ProfileState.loaded(
profile: profile,
profileDetails: await profileRepository.getMyProfileDetails(),

View File

@@ -288,18 +288,13 @@ class _ProfileScreenState extends State<ProfileScreen> {
return Scaffold(
appBar: AppBar(),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
],
)
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}

View File

@@ -246,9 +246,9 @@ class _CircumferenceChartWidgetState extends State<CircumferenceChartWidget> {
InkWell(
onTap: () {
widget.profileCubit.addCircumference(
chestCircumference: chest,
waistCircumference: waist,
hipCircumference: hip,
chestCircumference: chest + 20,
waistCircumference: waist + 20,
hipCircumference: hip + 20,
);
Navigator.of(context).pop();
},
@@ -275,7 +275,7 @@ class _CircumferenceChartWidgetState extends State<CircumferenceChartWidget> {
},
);
},
backgroundColor: Colors.red,
backgroundColor: appTheme.blueA400,
shape: CircleBorder(),
child: Icon(
Icons.add,

View File

@@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
class AboutRecipesScreen extends StatefulWidget {
final Recipes recipes;
@@ -347,7 +348,13 @@ class _AboutRecipesScreenState extends State<AboutRecipesScreen> {
if (state is CommentsStateLoading)
Padding(
padding: const EdgeInsets.all(32),
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
if (state is CommentsStateLoaded)
CommentsWidget(

View File

@@ -17,6 +17,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:image_picker/image_picker.dart';
import 'package:rive/rive.dart' as rive;
class RecipeCreateScreen extends StatelessWidget {
RecipeCreateScreen({Key? key}) : super(key: key);
@@ -31,7 +32,13 @@ class RecipeCreateScreen extends StatelessWidget {
} else if (state is RecipeCreateStateLoading) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: rive.RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is RecipeCreateStateError) {

View File

@@ -14,6 +14,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:image_picker/image_picker.dart';
import 'package:rive/rive.dart' as rive;
// ignore: must_be_immutable
class RecipeEditScreen extends StatelessWidget {
@@ -35,7 +36,13 @@ class RecipeEditScreen extends StatelessWidget {
} else if (state is RecipeCreateStateLoading) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: rive.RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is RecipeCreateStateError) {

View File

@@ -23,6 +23,7 @@ import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'package:validators/validators.dart';
class RegistrationScreen extends StatefulWidget {
@@ -318,7 +319,13 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
builder: (context) => PopScope(
canPop: false,
child: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
),
);

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/features/profile/models/profile_model.dart';
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
import 'package:eatvio_app/features/settings/models/profile_settings_model.dart';
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
@@ -24,6 +25,19 @@ class SettingsCubit extends Cubit<SettingsState> {
}
}
updateProfileDetails({
required ProfileDetailsModel profileDetailsModel
}) async {
try {
await settingsRepository.updateProfileDetails(
profileDetailsModel: profileDetailsModel,
);
} catch (e) {
print(e);
rethrow;
}
}
updateProfileSettings({
required ProfileSettingsModel profileSettingsModel
}) async {

View File

@@ -9,10 +9,12 @@ import 'package:go_router/go_router.dart';
class GeneralInfoScreen extends StatefulWidget {
final ProfileDetailsModel profileDetailsModel;
final bool isPublicProfile;
const GeneralInfoScreen({
super.key,
required this.profileDetailsModel,
required this.isPublicProfile,
});
@override
@@ -22,7 +24,12 @@ class GeneralInfoScreen extends StatefulWidget {
class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
final firstNameController = TextEditingController();
final lastNameController = TextEditingController();
final genderController = TextEditingController();
final countryController = TextEditingController();
final cityController = TextEditingController();
final languageController = TextEditingController();
late DateTime selectedDate;
late bool isPublicProfile;
@override
void initState() {
@@ -31,6 +38,11 @@ class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
firstNameController.text = widget.profileDetailsModel.firstName;
lastNameController.text = widget.profileDetailsModel.lastName;
selectedDate = DateTime.parse(widget.profileDetailsModel.birthdate);
genderController.text = widget.profileDetailsModel.gender;
countryController.text = widget.profileDetailsModel.country;
cityController.text = widget.profileDetailsModel.city;
languageController.text = widget.profileDetailsModel.lang;
isPublicProfile = widget.isPublicProfile;
}
@override
@@ -73,35 +85,35 @@ class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
Text('Пол'),
SizedBox(height: 4),
CustomTextFormField(
initialValue: 'Мужской',
controller: genderController,
onChanged: (newValue) {},
),
SizedBox(height: 16),
Text('Страна'),
SizedBox(height: 4),
CustomTextFormField(
initialValue: 'Россия',
controller: countryController,
onChanged: (newValue) {},
),
SizedBox(height: 16),
Text('Город'),
SizedBox(height: 4),
CustomTextFormField(
initialValue: 'Москва',
controller: cityController,
onChanged: (newValue) {},
),
SizedBox(height: 16),
Text('Предпочтительный язык общения'),
SizedBox(height: 4),
CustomTextFormField(
initialValue: 'Русский',
controller: languageController,
onChanged: (newValue) {},
),
SizedBox(height: 16),
Text('Показывать анкету'),
SizedBox(height: 4),
CustomTextFormField(
initialValue: 'Всем',
initialValue: isPublicProfile ? 'Всем' : 'Только зарегистрированным',
onChanged: (newValue) {},
),
],

View File

@@ -18,6 +18,24 @@ class OtherInfoScreen extends StatefulWidget {
}
class _OtherInfoScreenState extends State<OtherInfoScreen> {
final aboutAllergyController = TextEditingController();
final aboutTakingPillsController = TextEditingController();
final aboutSportHobbiesController = TextEditingController();
final favoriteFoodsController = TextEditingController();
final unfavouriteFoodsController = TextEditingController();
final additionalInfoController = TextEditingController();
@override
void initState() {
super.initState();
aboutAllergyController.text = widget.profileDetailsModel.aboutAlergy;
aboutTakingPillsController.text = widget.profileDetailsModel.aboutTakingPils;
aboutSportHobbiesController.text = widget.profileDetailsModel.aboutSportHobbies;
favoriteFoodsController.text = widget.profileDetailsModel.favoriteFoods;
unfavouriteFoodsController.text = widget.profileDetailsModel.unfavoriteFoods;
additionalInfoController.text = widget.profileDetailsModel.additionalInfo;
}
@override
Widget build(BuildContext context) {
final s = S.of(context);
@@ -35,6 +53,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
Text(s.allergies_presence),
SizedBox(height: 4),
CustomTextFormField(
controller: aboutAllergyController,
hintText: 'Например: орехи, мёд и т.д.',
autofocus: true,
minLines: 2,
@@ -45,6 +64,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
Text(s.do_you_take_pills),
SizedBox(height: 4),
CustomTextFormField(
controller: aboutTakingPillsController,
hintText: s.enter_information,
autofocus: true,
minLines: 2,
@@ -55,6 +75,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
Text(s.your_favorite_sports),
SizedBox(height: 4),
CustomTextFormField(
controller: aboutSportHobbiesController,
hintText:
"Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!",
autofocus: true,
@@ -65,6 +86,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
Text(s.favorite_foods),
SizedBox(height: 4),
CustomTextFormField(
controller: favoriteFoodsController,
hintText: s.enter_information,
maxLines: 7,
minLines: 2,
@@ -74,6 +96,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
Text(s.unfavorite_foods),
SizedBox(height: 4),
CustomTextFormField(
controller: unfavouriteFoodsController,
hintText: s.enter_information,
maxLines: 7,
minLines: 2,
@@ -88,6 +111,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
),
SizedBox(height: 4),
CustomTextFormField(
controller: additionalInfoController,
hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни",
maxLines: 8,
onChanged: (newValue) {},
@@ -104,7 +128,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
borderRadius: BorderRadius.circular(20),
child: Ink(
height: 52,
width: MediaQuery.of(context).size.width - 16,
width: MediaQuery.of(context).size.width - 32,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,

View File

@@ -1,4 +1,7 @@
import 'package:eatvio_app/features/profile/models/profile_model.dart';
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart';
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -15,10 +18,32 @@ class PhysicalActivityScreen extends StatefulWidget {
State<PhysicalActivityScreen> createState() => _PhysicalActivityScreenState();
}
enum PhysicalActivity { minimum, low, medium, high, extreme, hardWork }
enum PhysicalActivity { minimum, low, medium, high, extreme }
class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
PhysicalActivity? _physicalActivity = PhysicalActivity.minimum;
late PhysicalActivity? _physicalActivity;
@override
void initState() {
super.initState();
switch (widget.profileDetailsModel.activityCoefficient) {
case 1.2:
_physicalActivity = PhysicalActivity.minimum;
break;
case 1.375:
_physicalActivity = PhysicalActivity.low;
break;
case 1.55:
_physicalActivity = PhysicalActivity.medium;
break;
case 1.7:
_physicalActivity = PhysicalActivity.high;
break;
case 1.9:
_physicalActivity = PhysicalActivity.extreme;
break;
}
}
@override
Widget build(BuildContext context) {
@@ -87,17 +112,6 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
});
},
),
RadioListTile<PhysicalActivity>(
contentPadding: EdgeInsets.zero,
title: const Text('1,9 6–7 раз в неделю; очень трудоёмкая работа).'),
value: PhysicalActivity.hardWork,
groupValue: _physicalActivity,
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
),
],
),
),
@@ -106,7 +120,34 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
_saveButton() {
return InkWell(
onTap: () => GoRouter.of(context).pop(),
onTap: () {
late final double activityCoefficient;
switch (_physicalActivity) {
case PhysicalActivity.minimum:
activityCoefficient = 1.2;
break;
case PhysicalActivity.low:
activityCoefficient = 1.375;
break;
case PhysicalActivity.medium:
activityCoefficient = 1.55;
break;
case PhysicalActivity.high:
activityCoefficient = 1.7;
break;
case PhysicalActivity.extreme:
activityCoefficient = 1.9;
break;
default:
break;
}
sl<SettingsCubit>().updateProfileDetails(
profileDetailsModel: (sl<SettingsCubit>().state as SettingsStateLoaded).profileDetails.copyWith(
activityCoefficient: activityCoefficient,
),
);
GoRouter.of(context).pop();
},
borderRadius: BorderRadius.circular(20),
child: Ink(
height: 52,

View File

@@ -23,6 +23,16 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
final chestCircumferenceController = TextEditingController();
final waistCircumferenceController = TextEditingController();
final hipCircumferenceController = TextEditingController();
final heightController = TextEditingController();
@override
void initState() {
super.initState();
chestCircumferenceController.text = widget.profileDetailsModel.chestCircumference.toString();
waistCircumferenceController.text = widget.profileDetailsModel.waistCircumference.toString();
hipCircumferenceController.text = widget.profileDetailsModel.hipCircumference.toString();
heightController.text = widget.profileDetailsModel.height.toString();
}
@override
Widget build(BuildContext context) {
@@ -44,7 +54,7 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: chestCircumferenceController,
hintText: '90',
hintText: 'см',
),
SizedBox(height: 16),
Text(s.waist_circumference),
@@ -52,7 +62,7 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: waistCircumferenceController,
hintText: "60",
hintText: 'см',
),
SizedBox(height: 16),
Text(s.hip_circumference),
@@ -60,7 +70,16 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: hipCircumferenceController,
hintText: '90',
hintText: 'см',
textInputAction: TextInputAction.done,
),
SizedBox(height: 16),
Text('Рост'),
SizedBox(height: 4),
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: heightController,
hintText: 'см',
textInputAction: TextInputAction.done,
),
],

View File

@@ -22,9 +22,20 @@ class PressureScreen extends StatefulWidget {
class _PressureScreenState extends State<PressureScreen> {
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
final chestCircumferenceController = TextEditingController();
final waistCircumferenceController = TextEditingController();
final hipCircumferenceController = TextEditingController();
final bloodPressureUpController = TextEditingController();
final bloodPressureDownController = TextEditingController();
late SelectionPopupModel hypo;
late SelectionPopupModel hyper;
@override
void initState() {
super.initState();
bloodPressureUpController.text = widget.profileDetailsModel.bloodPressureUp.toString();
bloodPressureDownController.text = widget.profileDetailsModel.bloodPressureDown.toString();
hypo = widget.profileDetailsModel.hasHypo ? selectionPopupList[0] : selectionPopupList[1];
hyper = widget.profileDetailsModel.hasHyper ? selectionPopupList[0] : selectionPopupList[1];
}
final List<SelectionPopupModel> selectionPopupList = [
SelectionPopupModel(
id: 1,
@@ -54,6 +65,7 @@ class _PressureScreenState extends State<PressureScreen> {
Text(s.up_pressure),
SizedBox(height: 4),
CustomTextFormField(
controller: bloodPressureUpController,
inputFormatters: [digitsOnly],
hintText: "90",
onChanged: (newValue) {},
@@ -62,6 +74,7 @@ class _PressureScreenState extends State<PressureScreen> {
Text(s.down_pressure),
SizedBox(height: 4),
CustomTextFormField(
controller: bloodPressureDownController,
inputFormatters: [digitsOnly],
hintText: '90',
onChanged: (newValue) {},
@@ -71,10 +84,12 @@ class _PressureScreenState extends State<PressureScreen> {
SizedBox(height: 4),
CustomDropDown(
items: selectionPopupList,
value: selectionPopupList[0],
value: hypo,
hintText: "Не выбрано",
onChanged: (newPopup) {
setState(() {});
setState(() {
hypo = newPopup;
});
},
),
SizedBox(height: 16),
@@ -82,10 +97,12 @@ class _PressureScreenState extends State<PressureScreen> {
SizedBox(height: 4),
CustomDropDown(
items: selectionPopupList,
value: selectionPopupList[0],
value: hyper,
hintText: "Не выбрано",
onChanged: (newPopup) {
setState(() {});
setState(() {
hyper = newPopup;
});
},
),
],

View File

@@ -7,6 +7,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'package:url_launcher/url_launcher.dart';
class SettingsScreen extends StatefulWidget {
@@ -17,63 +18,70 @@ class SettingsScreen extends StatefulWidget {
}
class _SettingsScreenState extends State<SettingsScreen> {
final SettingsCubit settingsCubit = sl<SettingsCubit>()..init();
late bool updatesNotificationsSwitchState;
late bool fillDiaryNotificationsSwitchState;
@override
Widget build(BuildContext context) {
return BlocConsumer<SettingsCubit, SettingsState>(
bloc: settingsCubit,
listener: (BuildContext context, SettingsState state) {
if (state is SettingsStateLoaded) {
updatesNotificationsSwitchState = state.profileSettings.newUpdatesNotifications == 1 ? true : false;
fillDiaryNotificationsSwitchState = state.profileSettings.diaryReminderNotifications == 1 ? true : false;
}
},
builder: (BuildContext context, SettingsState state) {
if (state is SettingsStateLoaded) {
return BlocProvider<SettingsCubit>(
create: (BuildContext context) => sl<SettingsCubit>()..init(),
child: BlocConsumer<SettingsCubit, SettingsState>(
listener: (BuildContext context, SettingsState state) {
if (state is SettingsStateLoaded) {
updatesNotificationsSwitchState = state.profileSettings.newUpdatesNotifications == 1 ? true : false;
fillDiaryNotificationsSwitchState = state.profileSettings.diaryReminderNotifications == 1 ? true : false;
}
},
builder: (BuildContext context, SettingsState state) {
if (state is SettingsStateLoaded) {
return Scaffold(
appBar: AppBar(
title: Text('Настройки'),
),
body: SingleChildScrollView(
padding: EdgeInsets.symmetric(vertical: 16),
physics: const BouncingScrollPhysics(),
child: Column(
children: [
_additionalInfo(state),
const SizedBox(height: 12),
_notifications(state),
const SizedBox(height: 12),
_aboutEatvio(state),
const SizedBox(height: 12),
_becomeConsultantButton(state),
const SizedBox(height: 8),
_deleteAccountButton(state),
],
),
),
);
}
if (state is SettingsStateError) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(16),
child: Center(child: Text(state.errorMessage)),
),
);
}
return Scaffold(
appBar: AppBar(
title: Text('Настройки'),
),
body: SingleChildScrollView(
padding: EdgeInsets.symmetric(vertical: 16),
physics: const BouncingScrollPhysics(),
child: Column(
children: [
_additionalInfo(),
const SizedBox(height: 12),
_notifications(),
const SizedBox(height: 12),
_aboutEatvio(),
const SizedBox(height: 12),
_becomeConsultantButton(),
const SizedBox(height: 8),
_deleteAccountButton(),
],
body: Center(
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
if (state is SettingsStateError) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(16),
child: Center(child: Text(state.errorMessage)),
),
);
}
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
},
},
),
);
}
_additionalInfo() {
_additionalInfo(SettingsStateLoaded state) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -92,7 +100,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
_tile(
onTap: () => GoRouter.of(context).pushNamed(
'generalInfoScreen',
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
extra: state.profileDetails,
pathParameters: {
'isPublicProfile': state.profileSettings.isPublicProfile.toString(),
},
),
title: 'Общая информация',
),
@@ -100,7 +111,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_tile(
onTap: () => GoRouter.of(context).pushNamed(
'physicalFormScreen',
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
extra: state.profileDetails,
),
title: 'Физическая форма',
),
@@ -108,7 +119,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_tile(
onTap: () => GoRouter.of(context).pushNamed(
'pressureScreen',
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
extra: state.profileDetails,
),
title: 'Давление',
),
@@ -116,7 +127,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_tile(
onTap: () => GoRouter.of(context).pushNamed(
'otherInfoScreen',
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
extra: state.profileDetails,
),
title: 'Прочая информация',
),
@@ -124,7 +135,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_tile(
onTap: () => GoRouter.of(context).pushNamed(
'physicalActivityScreen',
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
extra: state.profileDetails,
),
title: 'Физическая нагрузка',
),
@@ -132,7 +143,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
_notifications() {
_notifications(SettingsStateLoaded state) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -152,8 +163,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() {
updatesNotificationsSwitchState = !updatesNotificationsSwitchState;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: (settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
context.read<SettingsCubit>().updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
newUpdatesNotifications: updatesNotificationsSwitchState,
),
);
@@ -166,8 +177,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() {
updatesNotificationsSwitchState = newValue;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: (settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
context.read<SettingsCubit>().updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
newUpdatesNotifications: updatesNotificationsSwitchState,
),
);
@@ -180,8 +191,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() {
fillDiaryNotificationsSwitchState = !fillDiaryNotificationsSwitchState;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: (settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
context.read<SettingsCubit>().updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
),
);
@@ -194,8 +205,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() {
fillDiaryNotificationsSwitchState = newValue;
});
settingsCubit.updateProfileSettings(
profileSettingsModel: (settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
context.read<SettingsCubit>().updateProfileSettings(
profileSettingsModel: state.profileSettings.copyWith(
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
),
);
@@ -206,7 +217,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
_aboutEatvio() {
_aboutEatvio(SettingsStateLoaded state) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -234,7 +245,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
_becomeConsultantButton() {
_becomeConsultantButton(SettingsStateLoaded state) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: InkWell(
@@ -263,7 +274,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
_deleteAccountButton() {
_deleteAccountButton(SettingsStateLoaded state) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: InkWell(

View File

@@ -31,7 +31,9 @@ class SettingsRepository {
required ProfileDetailsModel profileDetailsModel,
}) async {
try {
return await settingsService.updateProfileDetails(profileDetailsModel: profileDetailsModel);
return await settingsService.updateProfileDetails(
data: profileDetailsModel.toJson(),
);
} catch (e) {
rethrow;
}

View File

@@ -19,6 +19,6 @@ abstract class SettingsService {
@POST('/api/profile/update')
Future<ProfileDetailsModel> updateProfileDetails({
@MultiPart() required ProfileDetailsModel profileDetailsModel,
@Body() required Map<String, dynamic> data,
});
}

View File

@@ -91,11 +91,12 @@ class _SettingsService implements SettingsService {
@override
Future<ProfileDetailsModel> updateProfileDetails(
{required ProfileDetailsModel profileDetailsModel}) async {
{required Map<String, dynamic> data}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _data = <String, dynamic>{};
_data.addAll(data);
final _options = _setStreamType<ProfileDetailsModel>(Options(
method: 'POST',
headers: _headers,

View File

@@ -3,6 +3,7 @@ import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/theme/app_decoration.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:rive/rive.dart';
import 'bloc/diet_edit_bloc.dart';
import 'models/diet_edit_model.dart';
@@ -78,7 +79,13 @@ class DietEditScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -8,6 +8,7 @@ import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'bloc/diet_select_bloc.dart';
import 'models/diet_select_model.dart';
@@ -27,7 +28,13 @@ class DietSelectScreen extends StatelessWidget {
// Это начальное состояние, данные ещё не загружены.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is DietSelectLoadedState) {
@@ -37,7 +44,13 @@ class DietSelectScreen extends StatelessWidget {
// Другие состояния, если они есть.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -142,7 +155,13 @@ class DietSelectScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -5,6 +5,7 @@ import 'package:eatvio_app/theme/custom_text_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'bloc/diet_show_bloc.dart';
import 'models/diet_show_model.dart';
@@ -80,7 +81,13 @@ class DietScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -3,6 +3,7 @@ import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/theme/app_decoration.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:rive/rive.dart';
import 'bloc/blog_post_edit_bloc.dart';
import 'models/blog_post_edit_model.dart';
@@ -24,7 +25,13 @@ class BlogPostEditScreen extends StatelessWidget {
if (state is BlogPostEditInitialState) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is BlogPostEditLoadedState) {
@@ -36,7 +43,13 @@ class BlogPostEditScreen extends StatelessWidget {
} else {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -81,7 +94,13 @@ class BlogPostEditScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -8,6 +8,7 @@ import 'package:eatvio_app/theme/custom_text_style.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:eatvio_app/widgets/custom_image_view.dart';
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
class CommentWidget extends StatelessWidget {
CommentWidget(this.commentModelObj, {Key? key})
@@ -48,7 +49,13 @@ class CommentWidget extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -9,6 +9,7 @@ import 'package:eatvio_app/widgets/custom_drop_down.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:rive/rive.dart';
import 'bloc/glossary_screen_bloc.dart';
import 'models/glossary_screen_model.dart';
@@ -30,7 +31,13 @@ class GlossaryScreen extends StatelessWidget {
// Это начальное состояние, данные ещё не загружены.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is GlossaryLoadedState) {
@@ -43,7 +50,13 @@ class GlossaryScreen extends StatelessWidget {
// Другие состояния, если они есть.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -250,7 +263,13 @@ class GlossaryScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -3,6 +3,7 @@ import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/theme/app_decoration.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:rive/rive.dart';
import 'bloc/plan_edit_bloc.dart';
import 'models/plan_edit_model.dart';
@@ -78,7 +79,13 @@ class PlanEditScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -8,6 +8,7 @@ import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'bloc/plan_select_bloc.dart';
import 'models/plan_select_model.dart';
@@ -27,7 +28,13 @@ class PlanSelectScreen extends StatelessWidget {
// Это начальное состояние, данные ещё не загружены.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is PlanSelectLoadedState) {
@@ -37,7 +44,13 @@ class PlanSelectScreen extends StatelessWidget {
// Другие состояния, если они есть.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -142,7 +155,13 @@ class PlanSelectScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -5,6 +5,7 @@ import 'package:eatvio_app/theme/custom_text_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'bloc/plan_show_bloc.dart';
import 'models/plan_show_model.dart';
@@ -80,7 +81,13 @@ class PlanScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -10,6 +10,7 @@ import 'package:eatvio_app/widgets/custom_section_title.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'bloc/my_profile_bloc.dart';
import 'models/my_profile_model.dart';
@@ -29,7 +30,13 @@ class MySettingsScreen extends StatelessWidget {
// Это начальное состояние, данные ещё не загружены.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is MyProfileLoadedState) {
@@ -39,7 +46,13 @@ class MySettingsScreen extends StatelessWidget {
// Другие состояния, если они есть.
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}

View File

@@ -13,6 +13,7 @@ import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'bloc/recipe_edit_bloc.dart';
import 'models/recipe_edit_model.dart';
@@ -155,7 +156,13 @@ class RecipeEditScreen extends StatelessWidget {
// Установите ширину равной ширине родительского элемента
height: 200.0,
fit: BoxFit.cover,
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => Icon(Icons.error),
)
else
@@ -314,7 +321,13 @@ class RecipeEditScreen extends StatelessWidget {
height: 200.0,
// Задайте постоянную высоту элемента
fit: BoxFit.cover,
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => Icon(Icons.error),
)
else

View File

@@ -8,6 +8,7 @@ import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'bloc/recipe_select_bloc.dart';
import 'models/recipe_select_model.dart';
@@ -26,7 +27,13 @@ class RecipeSelectScreen extends StatelessWidget {
if (state is RecipeSelectInitialState) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
} else if (state is RecipeSelectLoadedState) {
@@ -35,7 +42,13 @@ class RecipeSelectScreen extends StatelessWidget {
} else {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
),
);
}
@@ -141,7 +154,13 @@ class RecipeSelectScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -10,6 +10,8 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart' as rive;
import 'package:rive/rive.dart';
import 'bloc/subscribers_bloc.dart';
import 'models/subscribers_model.dart';
@@ -26,9 +28,12 @@ class SubscribersScreen extends StatelessWidget {
builder: (context, state) {
if (state is SubscribersInitialState) {
// Это начальное состояние, данные ещё не загружены.
return CircularProgressIndicator(
color: Colors.white,
backgroundColor: Colors.white,
return SizedBox(
height: 32,
width: 32,
child: rive.RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
);
} else if (state is SubscribersLoadedState) {
// Данные загружены, можно строить экран.
@@ -188,7 +193,13 @@ class SubscribersScreen extends StatelessWidget {
backgroundImage: imageProvider,
radius: 25,
),
placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) => SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.person),
backgroundColor: Colors.white,

View File

@@ -1,5 +1,5 @@
import 'dart:convert';
import 'package:rive/rive.dart' as rive;
import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/generated/l10n.dart';
@@ -56,9 +56,12 @@ class _ExpandableListState extends State<ExpandableList> {
builder: (context, state) {
if (state is MyProfileInitialState) {
// Это начальное состояние, данные ещё не загружены.
return CircularProgressIndicator(
color: Colors.white,
backgroundColor: Colors.white,
return SizedBox(
height: 32,
width: 32,
child: rive.RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
);
} else if (state is MyProfileLoadedState) {
// Данные загружены, можно строить форму.

View File

@@ -90,7 +90,7 @@ class CustomTextFormField extends StatelessWidget {
hintText: hintText ?? "",
hintStyle: TextStyle(
fontSize: 16,
color: Color(0xFF323F4B),
color: Colors.grey.shade400,
fontWeight: FontWeight.w500,
),
prefixIcon: prefix,