Merge pull request 'main' (#247) from BLoC/eatvio_app:main into main

Reviewed-on: eatvio/eatvio_app#247
This commit is contained in:
BLoC
2025-03-10 12:46:43 +00:00
18 changed files with 253 additions and 186 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -2,27 +2,27 @@ C/C++ Structured Loga
_
]/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  էȃ×2  ‹°™²Ö2^
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  Úðèû×2  ‹°™²Ö2^
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/android_gradle_build.json  էȃ×2¥ ‘°™²Ö2c
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/android_gradle_build.json  Úðèû×2¥ ‘°™²Ö2c
a
_/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/android_gradle_build_mini.json  էȃ×2² –°™²Ö2P
_/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/android_gradle_build_mini.json  Úðèû×2² –°™²Ö2P
N
L/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build.ninja  էȃ×2ŠÃ 쯙²Ö2T
L/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build.ninja  Úðèû×2ŠÃ 쯙²Ö2T
R
P/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build.ninja.txt  ֧ȃ×2Y
P/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build.ninja.txt  Úðèû×2Y
W
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build_file_index.txt  ֧ȃ×2
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/build_file_index.txt  Úðèû×2
P —°™²Ö2Z
X
X
V/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/compile_commands.json  Úðèû×2^
\
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/compile_commands.json.bin  Úðèû×2 d
b
b
`/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/metadata_generation_command.txt  Úðèû×2
ÿ —°™²Ö2W
U
U
S/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/prefab_config.json  Úðèû×2
 ( —°™²Ö2\
 ( —°™²Ö2\
Z
X/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/symbol_folder_index.txt  ֧ȃ×2
X/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/arm64-v8a/symbol_folder_index.txt  Úðèû×2

View File

@@ -2,27 +2,27 @@ C/C++ Structured Logc
a
_/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  —©Èƒ×2  àòš²Ö2`
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  íðèû×2  àòš²Ö2`
^
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/android_gradle_build.json  —©Èƒ×2© âòš²Ö2e
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/android_gradle_build.json  íðèû×2© âòš²Ö2e
c
a/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/android_gradle_build_mini.json  —©Èƒ×2 ãòš²Ö2R
a/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/android_gradle_build_mini.json  íðèû×2 ãòš²Ö2R
P
N/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build.ninja  —©Èƒ×2–à Âòš²Ö2V
N/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build.ninja  íðèû×2–Ã Âòš²Ö2V
T
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build.ninja.txt  —©Èƒ×2[
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build.ninja.txt  íðèû×2[
Y
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build_file_index.txt  —©Èƒ×2
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/build_file_index.txt  íðèû×2
P ãòš²Ö2\
Z
Z
X/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/compile_commands.json  íðèû×2`
^
^
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/compile_commands.json.bin  íðèû×2 f
d
d
b/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/metadata_generation_command.txt  íðèû×2
‰ ãòš²Ö2Y
W
W
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/prefab_config.json  íðèû×2
 ( ãòš²Ö2^
 ( ãòš²Ö2^
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/symbol_folder_index.txt  —©Èƒ×2
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/armeabi-v7a/symbol_folder_index.txt  íðèû×2

View File

@@ -2,27 +2,27 @@ C/C++ Structured Log[
Y
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ¥©Èƒ×2  <20>÷š²Ö2X
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ôðèû×2  <20>÷š²Ö2X
V
T/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/android_gradle_build.json  ¥©Èƒ×2™ <20>÷š²Ö2]
T/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/android_gradle_build.json  ôðèû×2™ <20>÷š²Ö2]
[
Y/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/android_gradle_build_mini.json  ¥©Èƒ×2¦ ‘÷š²Ö2J
Y/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/android_gradle_build_mini.json  ôðèû×2¦ ‘÷š²Ö2J
H
F/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build.ninja  ¥©Èƒ×2æÂ †÷š²Ö2N
F/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build.ninja  ôðèû×2æÂ †÷š²Ö2N
L
J/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build.ninja.txt  ¥©Èƒ×2S
J/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build.ninja.txt  ôðèû×2S
Q
O/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build_file_index.txt  ¥©Èƒ×2
O/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/build_file_index.txt  ôðèû×2
P ‘÷š²Ö2T
R
R
P/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/compile_commands.json  ôðèû×2X
V
V
T/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/compile_commands.json.bin  ôðèû×2 ^
\
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/metadata_generation_command.txt  ôðèû×2
á ‘÷š²Ö2Q
O
O
M/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/prefab_config.json  ôðèû×2
 ( ‘÷š²Ö2V
 ( ‘÷š²Ö2V
T
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/symbol_folder_index.txt  ¥©Èƒ×2
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86/symbol_folder_index.txt  ôðèû×2

View File

@@ -2,27 +2,27 @@ C/C++ Structured Log^
\
Z/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  á©Èƒ×2  Üúš²Ö2[
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  úðèû×2  Üúš²Ö2[
Y
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/android_gradle_build.json  á©Èƒ×2Ÿ Þúš²Ö2`
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/android_gradle_build.json  úðèû×2Ÿ Þúš²Ö2`
^
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/android_gradle_build_mini.json  á©Èƒ×2¬ Þúš²Ö2M
\/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/android_gradle_build_mini.json  úðèû×2¬ Þúš²Ö2M
K
I/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build.ninja  á©Èƒ×2øÂ Ðúš²Ö2Q
I/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build.ninja  úðèû×2øÂ Ðúš²Ö2Q
O
M/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build.ninja.txt  á©Èƒ×2V
M/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build.ninja.txt  úðèû×2V
T
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build_file_index.txt  á©Èƒ×2
R/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/build_file_index.txt  úðèû×2
P ßúš²Ö2W
U
U
S/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/compile_commands.json  úðèû×2[
Y
Y
W/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/compile_commands.json.bin  úðèû×2 a
_
_
]/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/metadata_generation_command.txt  úðèû×2
ð ßúš²Ö2T
R
R
P/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/prefab_config.json  úðèû×2
 ( ßúš²Ö2Y
 ( ßúš²Ö2Y
W
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/symbol_folder_index.txt  á©Èƒ×2
U/Users/alex/eatvio_app/android/app/.cxx/Debug/5g696y4j/x86_64/symbol_folder_index.txt  úðèû×2

BIN
assets/.DS_Store vendored

Binary file not shown.

View File

@@ -65,7 +65,7 @@ class AppRouter {
routes: [
GoRoute(
path: '/auth-screen',
name: 'authScreen',
name: 'authScreen',
builder: (context, state) => const AuthScreen(),
routes: [
GoRoute(

View File

@@ -167,7 +167,7 @@ Future<void> init() async {
sl.registerLazySingleton(
() => Dio(
BaseOptions(
baseUrl: baseUrl,
baseUrl: baseUrl,
headers: {
'accept': 'application/json',
'content-type': 'application/json',

View File

@@ -1,12 +1,11 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
abstract class TokenStorage {
static Future<bool> haveTokenInStorage() async {
try {
if (await FlutterSecureStorage().read(key: 'token') == null) {
return false;
} else {
} else {
return true;
}
} catch (e) {
@@ -17,7 +16,7 @@ abstract class TokenStorage {
static Future<String?> getTokenFromStorage() async => await FlutterSecureStorage().read(key: 'token');
static saveTokenInStorage(String token) async {
await FlutterSecureStorage().write(key: 'token', value: token);
await FlutterSecureStorage().write(key: 'token', value: token);
}
static Future<void> removeTokenInStorage() async => (await FlutterSecureStorage().delete(key: 'token'));

View File

@@ -1,4 +1,5 @@
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
const int _toastDuration = 2;
@@ -19,10 +20,10 @@ void showErrorToast(String message) {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.TOP,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: _toastDuration,
backgroundColor: appTheme.whiteA700,
textColor: appTheme.gray,
backgroundColor: appTheme.red,
textColor: Colors.white,
fontSize: 16.0,
);
}
@@ -31,7 +32,7 @@ void showSuccessToast(String message) {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.TOP,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: _toastDuration,
backgroundColor: appTheme.greenA70001,
textColor: appTheme.whiteA700,

View File

@@ -1,6 +1,7 @@
import 'package:eatvio_app/core/app_router.dart';
import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/features/auth/presentation/bloc/auth_state.dart';
import 'package:eatvio_app/features/auth/repositories/auth_repository.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
@@ -28,11 +29,13 @@ class AuthCubit extends Cubit<AuthState> {
token: token,
),
);
showSuccessToast('Успешный вход');
await TokenStorage.saveTokenInStorage(token);
await sl<ProfileAvatarCubit>().getMyProfile();
AppRouter.navigatorKey.currentContext?.go('/my-profile-screen');
} catch (e) {
print(e);
showErrorToast('Неверный адрес электронной почты или пароль');
emit(AuthState.error(errorMessage: '$e'));
}
}

View File

@@ -5,6 +5,7 @@ import 'package:eatvio_app/core/utils/image_constant.dart';
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
import 'package:eatvio_app/features/auth/presentation/bloc/auth_cubit.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
@@ -12,6 +13,8 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:url_launcher/url_launcher.dart';
import '../bloc/auth_state.dart';
class AuthScreen extends StatefulWidget {
const AuthScreen();
@@ -32,120 +35,128 @@ class _AuthScreenState extends State<AuthScreen> {
FlutterNativeSplash.remove();
return BlocProvider<AuthCubit>(
create: (BuildContext context) => authCubit,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: SvgPicture.asset(
ImageConstant.imgLogoEatvio,
height: 64,
fit: BoxFit.contain,
),
),
body: SafeArea(
child: Padding(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(s.email),
const SizedBox(height: 4),
CustomTextFormField(
controller: emailController,
textInputAction: TextInputAction.next,
keyboardType: TextInputType.emailAddress,
textInputType: TextInputType.emailAddress,
hintText: 'Введите email',
),
const SizedBox(height: 16),
Text(s.password),
const SizedBox(height: 4),
CustomTextFormField(
obscureText: hidePassword,
controller: passwordController,
hintText: 'Введите пароль',
suffix: IconButton(
onPressed: () {
setState(() {
hidePassword = !hidePassword;
});
},
icon: Icon(
hidePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined,
color: Colors.grey,
),
),
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Нет аккаунта? '),
GestureDetector(
onTap: () => GoRouter.of(context).goNamed('webViewRegistrationScreen'),
child: Text(
'Зарегистрироваться',
style: TextStyle(
color: appTheme.blueA400,
decorationColor: appTheme.blueA400,
decoration: TextDecoration.underline,
),
),
),
],
),
Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Нажимая "Войти", Вы соглашаетесь с ',
style: TextStyle(
fontSize: 12,
),
),
GestureDetector(
onTap: () async {
await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf'));
},
child: Text(
'Публичной офертой',
style: TextStyle(
fontSize: 12,
color: appTheme.blueA400,
decorationColor: appTheme.blueA400,
decoration: TextDecoration.underline,
),
),
),
],
),
const SizedBox(height: 16),
Container(
height: 48,
width: MediaQuery.of(context).size.width - 32,
child: FloatingActionButton.extended(
heroTag: 'authButton',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
backgroundColor: appTheme.blueA400,
onPressed: () => authCubit.getTokenByCredentials(
emailController.text,
passwordController.text,
),
label: Text(
'Войти',
style: theme.textTheme.titleSmall!.copyWith(color: Colors.white),
),
),
),
],
child: BlocBuilder<AuthCubit, AuthState>(
builder: (BuildContext context, AuthState state) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: SvgPicture.asset(
ImageConstant.imgLogoEatvio,
height: 64,
fit: BoxFit.contain,
),
),
),
),
body: SafeArea(
child: Padding(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(s.email),
const SizedBox(height: 4),
CustomTextFormField(
controller: emailController,
textInputAction: TextInputAction.next,
keyboardType: TextInputType.emailAddress,
textInputType: TextInputType.emailAddress,
hintText: 'Введите email',
),
const SizedBox(height: 16),
Text(s.password),
const SizedBox(height: 4),
CustomTextFormField(
obscureText: hidePassword,
controller: passwordController,
hintText: 'Введите пароль',
suffix: IconButton(
onPressed: () {
setState(() {
hidePassword = !hidePassword;
});
},
icon: Icon(
hidePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined,
color: Colors.grey,
),
),
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Нет аккаунта? '),
GestureDetector(
onTap: () => GoRouter.of(context).goNamed('webViewRegistrationScreen'),
child: Text(
'Зарегистрироваться',
style: TextStyle(
color: appTheme.blueA400,
decorationColor: appTheme.blueA400,
decoration: TextDecoration.underline,
),
),
),
],
),
Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Нажимая "Войти", Вы соглашаетесь с ',
style: TextStyle(
fontSize: 12,
),
),
GestureDetector(
onTap: () async {
await launchUrl(Uri.parse(baseUrl + '/oferta_bs.pdf'));
},
child: Text(
'Публичной офертой',
style: TextStyle(
fontSize: 12,
color: appTheme.blueA400,
decorationColor: appTheme.blueA400,
decoration: TextDecoration.underline,
),
),
),
],
),
const SizedBox(height: 16),
Container(
height: 48,
width: MediaQuery.of(context).size.width - 32,
child: FloatingActionButton.extended(
heroTag: 'authButton',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
backgroundColor: state is AuthStateLoading ? Colors.black.withAlpha(50) : appTheme.blueA400,
onPressed: state is AuthStateLoading
? null
: () => authCubit.getTokenByCredentials(
emailController.text,
passwordController.text,
),
label: state is AuthStateLoading
? CupertinoActivityIndicator()
: Text(
'Войти',
style: theme.textTheme.titleSmall!.copyWith(color: Colors.white),
),
),
),
],
),
),
),
);
},
),
);
}

View File

@@ -72,7 +72,7 @@ class _CommentsWidgetState extends State<CommentsWidget> {
style: TextStyle(
height: 1,
color: appTheme.gray,
fontSize: 12,
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
@@ -84,7 +84,7 @@ class _CommentsWidgetState extends State<CommentsWidget> {
style: TextStyle(
height: 1,
color: appTheme.black,
fontSize: 12,
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
@@ -97,7 +97,7 @@ class _CommentsWidgetState extends State<CommentsWidget> {
style: TextStyle(
height: 1,
color: appTheme.gray,
fontSize: 12,
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
@@ -112,8 +112,8 @@ class _CommentsWidgetState extends State<CommentsWidget> {
style: TextStyle(
height: 1,
color: appTheme.gray,
fontSize: 12,
fontWeight: FontWeight.w500,
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
),

View File

@@ -102,7 +102,7 @@ class _PlanWidgetState extends State<PlanWidget> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
widget.plan.name,
style: TextStyles.textMSemibold.copyWith(color: appTheme.black),
style: TextStyles.textMSemibold.copyWith(color: appTheme.black, fontSize: 18),
),
),
if (widget.plan.details.isNotEmpty) ...[
@@ -117,7 +117,7 @@ class _PlanWidgetState extends State<PlanWidget> {
"*": Style(
margin: Margins.zero,
color: appTheme.black,
fontSize: FontSize(TextStyles.textSMedium.fontSize ?? 14),
fontSize: FontSize(16),
fontWeight: TextStyles.textSMedium.fontWeight ?? FontWeight.w400,
),
},

View File

@@ -69,12 +69,12 @@ class MenuScreen extends StatelessWidget {
}
},
),
_divider(context),
_tile(
leading: 'assets/icons/calendar.svg',
title: 'Календарь',
onTap: () => GoRouter.of(context).push('/calendar-screen'),
),
// _divider(context),
// _tile(
// leading: 'assets/icons/calendar.svg',
// title: 'Календарь',
// onTap: () => GoRouter.of(context).push('/calendar-screen'),
// ),
_divider(context),
_tile(
leading: ImageConstant.icnGlossary,

View File

@@ -106,6 +106,7 @@ class _ProfileBlogPostWidgetState extends State<ProfileBlogPostWidget> {
state.blogPosts[widget.index].title,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18,
color: Colors.black87,
),
),
@@ -120,6 +121,7 @@ class _ProfileBlogPostWidgetState extends State<ProfileBlogPostWidget> {
: state.blogPosts[widget.index].description,
style: {
"*": Style(
fontSize: FontSize(16),
color: Colors.black87,
),
},

View File

@@ -1,6 +1,9 @@
import 'dart:convert';
import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/features/auth/presentation/bloc/auth_cubit.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewRegistrationScreen extends StatefulWidget {
@@ -12,23 +15,71 @@ class WebViewRegistrationScreen extends StatefulWidget {
class _WebViewRegistrationScreenState extends State<WebViewRegistrationScreen> {
late final WebViewController _controller;
late final AuthCubit authCubit;
String? email;
String? password;
@override
void initState() {
super.initState();
authCubit = sl<AuthCubit>();
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..addJavaScriptChannel(
'flutter_inject',
onMessageReceived: (JavaScriptMessage message) {
final data = jsonDecode(message.message);
if (data['type'] == 'email') {
email = data['value'];
print("Email: $email");
} else if (data['type'] == 'password') {
password = data['value'];
print("Password: $password");
}
},
)
..setNavigationDelegate(
NavigationDelegate(
onNavigationRequest: (NavigationRequest request) {
if (request.url.contains('profile')) {
GoRouter.of(context).go('authScreen');
authCubit.getTokenByCredentials(
email!,
password!,
);
}
return NavigationDecision.navigate;
},
),
)
..loadRequest(Uri.parse(baseUrl + '/registration/step1'));
_injectJavaScript();
}
void _injectJavaScript() async {
await Future.delayed(Duration(seconds: 2));
_controller.runJavaScript('''
function sendMessageToFlutter(data) {
window.flutter_inject.postMessage(JSON.stringify(data));
}
function trackInputChanges() {
let emailField = document.getElementById('inputEmail');
let passwordField = document.getElementById('inputPassword');
if (emailField && passwordField) {
emailField.addEventListener('input', function() {
sendMessageToFlutter({ type: 'email', value: emailField.value });
});
passwordField.addEventListener('input', function() {
sendMessageToFlutter({ type: 'password', value: passwordField.value });
});
}
}
trackInputChanges();
''');
}
@override

View File

@@ -420,7 +420,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(
title,
style: TextStyle(
fontSize: 14,
fontSize: 16,
fontWeight: FontWeight.w500,
height: 1,
),