updated error handling, consultant rating layout and complaining logic

This commit is contained in:
Username1548
2025-02-28 19:18:01 +07:00
parent e5b293db79
commit 0cdd40102f
86 changed files with 3853 additions and 279 deletions

View File

@@ -0,0 +1,68 @@
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/core/widgets/loader.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class DataErrorWidget extends StatefulWidget {
const DataErrorWidget({super.key, required this.onReload});
final Future<void> Function() onReload;
@override
State<DataErrorWidget> createState() => _DataErrorWidgetState();
}
class _DataErrorWidgetState extends State<DataErrorWidget> {
bool isLoading = false;
@override
Widget build(BuildContext context) {
final s = S.of(context);
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset('assets/icons/cloud.svg'),
SizedBox(height: 30),
Text(
s.something_went_wrong,
style: TextStyles.textLSemibold.copyWith(color: appTheme.black),
),
SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Text(
s.can_not_load_data_please_try_again,
style: TextStyles.textSMedium.copyWith(color: appTheme.black),
textAlign: TextAlign.center,
),
),
SizedBox(height: 20),
isLoading
? Loader()
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: CustomOutlinedButton(
text: s.try_again,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
onPressed: () async {
setState(() {
isLoading = true;
});
await widget.onReload();
setState(() {
isLoading = false;
});
},
),
),
],
);
}
}

View File

@@ -1,5 +1,5 @@
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/utils/enums.dart';
import 'package:eatvio_app/core/enums/product_type.dart';
import 'package:eatvio_app/core/utils/localization_utils.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/type_badges.dart';

View File

@@ -0,0 +1,59 @@
import 'package:eatvio_app/core/app_router.dart';
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void showErrorDialog(BuildContext context, {String? title, String? description}) {
showDialog<void>(
context: context,
barrierColor: Colors.transparent,
builder: (BuildContext context) {
final s = S.of(context);
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Container(
decoration: BoxDecoration(
color: appTheme.whiteA700,
borderRadius: BorderRadius.all(Radius.circular(20)),
boxShadow: [BoxShadow(color: appTheme.dialogShadow, blurRadius: 32)],
),
width: MediaQuery.sizeOf(context).width,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 20),
Text(
title ?? s.some_error_occurred,
style: TextStyles.textLSemibold.copyWith(color: appTheme.black, decoration: TextDecoration.none),
),
SizedBox(height: 12),
Padding(
padding: const EdgeInsets.only(right: 72),
child: Text(
description ?? s.some_error_occurred_description,
style: TextStyles.textSMedium.copyWith(color: appTheme.black, decoration: TextDecoration.none),
),
),
Align(
alignment: Alignment.centerRight,
child: TextButton(
onPressed: () => AppRouter.navigatorKey.currentContext?.pop(),
child: Text(s.ok, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
),
),
SizedBox(height: 12),
],
),
),
),
),
);
},
);
}

View File

@@ -3,6 +3,7 @@ import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/widgets/bottom_sheet_handler_bar.dart';
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -11,6 +12,7 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget {
final String title;
@override
Widget build(BuildContext context) {
final s = S.of(context);
return Column(
children: [
SizedBox(
@@ -37,7 +39,7 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget {
onPressed: () {
AppRouter.navigatorKey.currentContext?.pop();
},
text: 'Хорошо',
text: s.ok,
height: 52,
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(

View File

@@ -0,0 +1,57 @@
import 'package:eatvio_app/core/app_router.dart';
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/widgets/bottom_sheet_handler_bar.dart';
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class SuccessPublishedRecipeBottomSheet extends StatelessWidget {
const SuccessPublishedRecipeBottomSheet({super.key, required this.title});
final String title;
@override
Widget build(BuildContext context) {
final s = S.of(context);
return Column(
children: [
SizedBox(
height: 20,
),
BottomSheetHandlerBar(),
SizedBox(
height: 20,
),
Text(
s.recipe_publishing,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
Text(
'"$title" ${s.successfully_published}',
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: CustomOutlinedButton(
onPressed: () {
AppRouter.navigatorKey.currentContext?.pop();
},
text: s.ok,
height: 52,
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
),
),
SizedBox(
height: 20,
),
],
);
}
}