feature(registration): remove .env

This commit is contained in:
mso7nueh
2024-07-15 17:06:13 +03:00
parent 726b74a236
commit d859a15cfd
188 changed files with 2509 additions and 3147 deletions

View File

@@ -1,17 +1,17 @@
//import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart';
import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:hive/hive.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:image_picker/image_picker.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
import '/core/app_export.dart';
part 'my_profile_event.dart';
part 'my_profile_state.dart';
@@ -36,7 +36,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
//final token =
// "9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1ne AggmpR2TidVGDPN34fa201a";
final response = await http.get(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/index'),
Uri.parse(baseUrl + '/api/profile/index'),
headers: {
'Authorization': 'Bearer $token',
},
@@ -278,7 +278,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
}
Future<String> uploadImageToServer(String imagePath, String? token) async {
String url = '${dotenv.env['SERVER_ROOT']!}/profile/photo/upload';
String url = '${baseUrl}/api/profile/photo/upload';
print(url);
var request = http.MultipartRequest('POST', Uri.parse(url));
request.headers['Authorization'] = 'Bearer $token';

View File

@@ -12,49 +12,48 @@ class MyProfileState extends Equatable {
}
class MyProfileInitialState extends MyProfileState {
MyProfileInitialState({required MyProfileModel myProfileModelObj})
: super(myProfileModelObj: myProfileModelObj);
MyProfileInitialState({required MyProfileModel myProfileModelObj}) : super(myProfileModelObj: myProfileModelObj);
}
/// Represents the state of MyProfile in the application.
class MyProfileLoadedState extends MyProfileState {
MyProfileLoadedState(
{this.chestCircumferenceController,
this.waistCircumferenceController,
this.hipCircumferenceController,
this.myProfileModelObj,
this.weightController,
this.user,
this.userDetails,
this.chartPoints,
this.chartDates,
this.plans,
this.token,
this.selectedCountry,
this.selectedCity,
this.selectedActivity,
this.chestCircumferenceFormController,
this.waistCircumferenceFormController,
this.hipCircumferenceFormController,
this.firstNameFormController,
this.lastNameFormController,
this.countryFormController,
this.dateFormController,
this.cityFormController,
this.heightFormController,
this.weightFormController,
this.upPressureFormController,
this.downPressureFormController,
this.allergiesFormController,
this.pillsFormController,
this.sportsFormController,
this.favoriteFormController,
this.unfavoriteFormController,
this.additionalFormController,
this.hypoFormController,
this.hyperFormController,
this.circumferences,})
: super(myProfileModelObj: null);
MyProfileLoadedState({
this.chestCircumferenceController,
this.waistCircumferenceController,
this.hipCircumferenceController,
this.myProfileModelObj,
this.weightController,
this.user,
this.userDetails,
this.chartPoints,
this.chartDates,
this.plans,
this.token,
this.selectedCountry,
this.selectedCity,
this.selectedActivity,
this.chestCircumferenceFormController,
this.waistCircumferenceFormController,
this.hipCircumferenceFormController,
this.firstNameFormController,
this.lastNameFormController,
this.countryFormController,
this.dateFormController,
this.cityFormController,
this.heightFormController,
this.weightFormController,
this.upPressureFormController,
this.downPressureFormController,
this.allergiesFormController,
this.pillsFormController,
this.sportsFormController,
this.favoriteFormController,
this.unfavoriteFormController,
this.additionalFormController,
this.hypoFormController,
this.hyperFormController,
this.circumferences,
}) : super(myProfileModelObj: null);
MyProfileModel? myProfileModelObj;
Map<String, dynamic>? user;
@@ -174,42 +173,27 @@ class MyProfileLoadedState extends MyProfileState {
chartPoints: chartPoints ?? this.chartPoints,
chartDates: chartDates ?? this.chartDates,
weightController: weightController ?? this.weightController,
chestCircumferenceController:
chestCircumferenceController ?? this.chestCircumferenceController,
waistCircumferenceController:
waistCircumferenceController ?? this.waistCircumferenceController,
hipCircumferenceController:
hipCircumferenceController ?? this.hipCircumferenceController,
chestCircumferenceFormController: chestCircumferenceFormController ??
this.chestCircumferenceFormController,
waistCircumferenceFormController: waistCircumferenceFormController ??
this.waistCircumferenceFormController,
hipCircumferenceFormController:
hipCircumferenceFormController ?? this.hipCircumferenceFormController,
firstNameFormController:
firstNameFormController ?? this.firstNameFormController,
lastNameFormController:
lastNameFormController ?? this.lastNameFormController,
countryFormController:
countryFormController ?? this.countryFormController,
chestCircumferenceController: chestCircumferenceController ?? this.chestCircumferenceController,
waistCircumferenceController: waistCircumferenceController ?? this.waistCircumferenceController,
hipCircumferenceController: hipCircumferenceController ?? this.hipCircumferenceController,
chestCircumferenceFormController: chestCircumferenceFormController ?? this.chestCircumferenceFormController,
waistCircumferenceFormController: waistCircumferenceFormController ?? this.waistCircumferenceFormController,
hipCircumferenceFormController: hipCircumferenceFormController ?? this.hipCircumferenceFormController,
firstNameFormController: firstNameFormController ?? this.firstNameFormController,
lastNameFormController: lastNameFormController ?? this.lastNameFormController,
countryFormController: countryFormController ?? this.countryFormController,
dateFormController: dateFormController ?? this.dateFormController,
cityFormController: cityFormController ?? this.cityFormController,
heightFormController: heightFormController ?? this.heightFormController,
weightFormController: weightFormController ?? this.weightFormController,
upPressureFormController:
upPressureFormController ?? this.upPressureFormController,
downPressureFormController:
downPressureFormController ?? this.downPressureFormController,
allergiesFormController:
allergiesFormController ?? this.allergiesFormController,
upPressureFormController: upPressureFormController ?? this.upPressureFormController,
downPressureFormController: downPressureFormController ?? this.downPressureFormController,
allergiesFormController: allergiesFormController ?? this.allergiesFormController,
pillsFormController: pillsFormController ?? this.pillsFormController,
sportsFormController: sportsFormController ?? this.sportsFormController,
favoriteFormController:
favoriteFormController ?? this.favoriteFormController,
unfavoriteFormController:
unfavoriteFormController ?? this.unfavoriteFormController,
additionalFormController:
additionalFormController ?? this.additionalFormController,
favoriteFormController: favoriteFormController ?? this.favoriteFormController,
unfavoriteFormController: unfavoriteFormController ?? this.unfavoriteFormController,
additionalFormController: additionalFormController ?? this.additionalFormController,
token: token ?? this.token,
selectedCountry: selectedCountry ?? this.selectedCountry,
selectedCity: selectedCity ?? this.selectedCity,

View File

@@ -1,21 +1,21 @@
import 'package:go_router/go_router.dart';
import 'dart:convert';
import 'dart:math';
import 'bloc/my_profile_bloc.dart';
import 'models/my_profile_model.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:image_picker/image_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter/services.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:http/http.dart' as http;
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'dart:math';
import 'dart:convert';
import 'bloc/my_profile_bloc.dart';
import 'models/my_profile_model.dart';
class MyProfileScreen extends StatelessWidget {
static Widget builder(BuildContext context) {
@@ -156,7 +156,7 @@ class MyProfileScreen extends StatelessWidget {
GestureDetector(
onTap: () => addImage(context),
child: CachedNetworkImage(
imageUrl: dotenv.env['STORAGE_URL']! + (state.user?['profile_photo_path'] ?? ''),
imageUrl: baseUrl + '/storage/' + (state.user?['profile_photo_path'] ?? ''),
imageBuilder: (context, imageProvider) => CircleAvatar(
backgroundImage: imageProvider,
radius: 60,
@@ -720,7 +720,7 @@ class MyProfileScreen extends StatelessWidget {
child: Container(
margin: EdgeInsets.only(bottom: 12.h),
child: Image.network(
dotenv.env['STORAGE_URL']! + imagePaths?[i],
baseUrl + '/storage/' + imagePaths?[i],
height: 25.adaptSize,
width: 25.adaptSize,
),
@@ -849,7 +849,7 @@ class MyProfileScreen extends StatelessWidget {
try {
final token = state.token;
final response = await http.post(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/addCircumference'),
Uri.parse(baseUrl + '/api/profile/addCircumference'),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $token',
@@ -941,7 +941,7 @@ class MyProfileScreen extends StatelessWidget {
try {
final token = state.token;
final response = await http.post(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/addWeight'),
Uri.parse(baseUrl + '/api/profile/addWeight'),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $token',

View File

@@ -1,22 +1,24 @@
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_about_list.dart';
import 'package:eatvio_app/widgets/custom_expandable_list.dart';
import 'package:eatvio_app/widgets/custom_language_drop_down.dart';
import 'package:eatvio_app/widgets/custom_notification_screen.dart';
import 'package:eatvio_app/widgets/custom_section_title.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'bloc/my_profile_bloc.dart';
import 'models/my_profile_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_about_list.dart';
import 'package:eatvio_app/widgets/custom_expandable_list.dart';
import 'package:eatvio_app/widgets/custom_notification_screen.dart';
import 'package:eatvio_app/widgets/custom_section_title.dart';
import 'package:eatvio_app/widgets/custom_language_drop_down.dart';
import 'package:flutter/material.dart';
class MySettingsScreen extends StatelessWidget {
static Widget builder(BuildContext context) {
return BlocProvider<MyProfileBloc>(
create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()), child: MySettingsScreen(),);
create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()),
child: MySettingsScreen(),
);
}
Widget build(BuildContext context) {
@@ -45,7 +47,6 @@ class MySettingsScreen extends StatelessWidget {
}
_buildSetingsScreen(BuildContext context, MyProfileLoadedState state) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
@@ -64,30 +65,32 @@ class MySettingsScreen extends StatelessWidget {
children: [
SizedBox(height: 30),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(12)),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3),
),
],
),
child: CustomAppBar(
height: 54.v,
leadingWidth: 28.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: () => GoRouter.of(context).pop(),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(12)),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3),
),
title: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Row(children: [AppbarSubtitle(text: state.user?['name'], margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v))]),),
),),
],
),
child: CustomAppBar(
height: 54.v,
leadingWidth: 28.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: () => GoRouter.of(context).pop(),
),
title: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Row(children: [AppbarSubtitle(text: state.user?['name'], margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v))]),
),
),
),
SizedBox(height: 20),
Container(
padding: EdgeInsets.symmetric(