Commit 80134289 authored by Inomjon's avatar Inomjon

Call cannection to app

parent c02b32ca
class AppUsersModel {
User? user;
AppUsersModel({this.user});
AppUsersModel.fromJson(Map<String, dynamic> json) {
user = json['user'] != null ? User.fromJson(json['user']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (user != null) {
data['user'] = user!.toJson();
}
return data;
}
}
class User {
String? sId;
int? id;
String? createdAt;
String? updatedAt;
String? lastRequestAt;
String? timezone;
String? login;
String? email;
String? fullName;
String? phone;
String? website;
String? twitterId;
String? externalUserId;
String? facebookId;
String? customData;
String? userTags;
String? avatar;
String? externalId;
String? isGuest;
User(
{this.sId,
this.id,
this.createdAt,
this.updatedAt,
this.lastRequestAt,
this.timezone,
this.login,
this.email,
this.fullName,
this.phone,
this.website,
this.twitterId,
this.externalUserId,
this.facebookId,
this.customData,
this.userTags,
this.avatar,
this.externalId,
this.isGuest});
User.fromJson(Map<String, dynamic> json) {
sId = json['_id'];
id = json['id'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
lastRequestAt = json['last_request_at'];
timezone = json['timezone'].toString();
login = json['login'];
email = json['email'];
fullName = json['full_name'];
phone = json['phone'];
website = json['website'];
twitterId = json['twitter_id'];
externalUserId = json['external_user_id'].toString();
facebookId = json['facebook_id'];
customData = json['custom_data'].toString();
userTags = json['user_tags'].toString();
avatar = json['avatar'];
externalId = json['external_id'];
isGuest = json['is_guest'].toString();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['_id'] = sId;
data['id'] = id;
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
data['last_request_at'] = lastRequestAt;
data['timezone'] = timezone;
data['login'] = login;
data['email'] = email;
data['full_name'] = fullName;
data['phone'] = phone;
data['website'] = website;
data['twitter_id'] = twitterId;
data['external_user_id'] = externalUserId;
data['facebook_id'] = facebookId;
data['custom_data'] = customData;
data['user_tags'] = userTags;
data['avatar'] = avatar;
data['external_id'] = externalId;
data['is_guest'] = isGuest;
return data;
}
}
\ No newline at end of file
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:meta/meta.dart';
import 'package:vmeeting/service/user_repositores/user_repo.dart';
import '../../app_models/app_users_model/app_users_model.dart';
part 'home_page_event.dart';
part 'home_page_state.dart';
class HomePageBloc extends Bloc<HomePageEvent, HomePageState> {
late List<AppUsersModel> appUsersModelList = [];
HomePageBloc() : super(HomePageInitialState()){
on<HomePageFetchEvent>((event, emit) async {
appUsersModelList.addAll(await UserRepository.getInstance().getAppAllUsers());
emit(HomePageLoadedState(appUsersModelList: appUsersModelList));
});
}
}
part of 'home_page_bloc.dart';
@immutable
abstract class HomePageEvent extends Equatable{}
class HomePageFetchEvent extends HomePageEvent{
@override
List<Object?> get props => [];
}
part of 'home_page_bloc.dart';
@immutable
abstract class HomePageState extends Equatable{}
class HomePageInitialState extends HomePageState {
@override
List<Object?> get props => [];
}
class HomePageLoadedState extends HomePageState {
final List<AppUsersModel> appUsersModelList;
HomePageLoadedState({required this.appUsersModelList});
@override
List<Object?> get props => [appUsersModelList];
}
class HomePageExceptionState extends HomePageState {
final String message;
HomePageExceptionState({required this.message});
@override
List<Object?> get props => [message];
}
import 'package:bloc/bloc.dart';
import 'package:connectycube_sdk/connectycube_calls.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/cupertino.dart';
import 'package:meta/meta.dart';
import 'package:vmeeting/src/controllers/enter_number_cont.dart';
import '../../service/user_repositores/user_repo.dart';
part 'user_log_in_event.dart';
part 'user_log_in_state.dart';
class UserLogInBloc extends Bloc<UserLogInEvent, UserLogInState> {
UserLogInBloc() : super(UserLogInInitialState()) {
on<UserLogInFetchEvent>((event, emit) {
emit(UserLogInLoadedState());
});
on<UserLogInChakingEvent>((event, emit) async {
UserRepository.getInstance().userSigIn(context: event.context, user: event.user, controller: event.controller);
});
on<UserLogInChakedEvent>((event, emit) async {
emit(UserLogInInitialState());
bool response = await UserRepository.getInstance().userSigIn(context: event.context, user: event.user, controller: event.controller);
if(response == false){
emit(UserLogInLoadedState());
}
});
}
}
part of 'user_log_in_bloc.dart';
@immutable
abstract class UserLogInEvent extends Equatable{}
class UserLogInFetchEvent extends UserLogInEvent{
@override
List<Object?> get props => [];
}
class UserLogInChakingEvent extends UserLogInEvent{
final BuildContext context;
final CubeUser user;
final NumberController controller;
UserLogInChakingEvent({required this.controller, required this.context, required this.user});
@override
List<Object?> get props => [context,user, controller];
}
class UserLogInChakedEvent extends UserLogInEvent{
final BuildContext context;
final CubeUser user;
final NumberController controller;
UserLogInChakedEvent({required this.controller, required this.context, required this.user});
@override
List<Object?> get props => [context,user, controller];
}
\ No newline at end of file
part of 'user_log_in_bloc.dart';
@immutable
abstract class UserLogInState extends Equatable{}
class UserLogInInitialState extends UserLogInState {
@override
List<Object?> get props => [];
}
class UserLogInLoadedState extends UserLogInState {
@override
List<Object?> get props => [];
}
class UserLogInInChackingState extends UserLogInState {
@override
List<Object?> get props => [];
}
class UserLogInExceptionState extends UserLogInState {
final String? message;
UserLogInExceptionState({required this.message});
@override
List<Object?> get props => [message];
}
\ No newline at end of file
import 'package:bloc/bloc.dart';
import 'package:connectycube_sdk/connectycube_calls.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/cupertino.dart';
import 'package:meta/meta.dart';
import '../../service/user_repositores/user_repo.dart';
import '../../src/controllers/enter_number_cont.dart';
part 'user_sign_up_event.dart';
part 'user_sign_up_state.dart';
......@@ -10,5 +15,10 @@ class UserSignUpBloc extends Bloc<UserSignUpEvent, UserSignUpState> {
on<UserSignUpFetchEvent>((event, emit) {
emit(UserSignUpLoadedState());
});
on<UserSignUpChakingEvent>((event, emit) {
UserRepository.getInstance().userSigUp(context: event.context, user: event.user, controller: event.controller);
emit(UserSignUpLoadedState());
});
}
}
......@@ -7,3 +7,11 @@ class UserSignUpFetchEvent extends UserSignUpEvent{
@override
List<Object?> get props => [];
}
class UserSignUpChakingEvent extends UserSignUpEvent {
final BuildContext context;
final CubeUser user;
final NumberController controller;
UserSignUpChakingEvent({required this.controller, required this.context, required this.user});
@override
List<Object?> get props => [context,user, controller];
}
......@@ -5,6 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:vmeeting/blocs/user_sign_up_bloc/user_sign_up_bloc.dart';
import 'package:vmeeting/service/routes/routes_name.dart';
import 'package:vmeeting/views/main_view/main_page.dart';
import '../../blocs/user_login_bloc/user_log_in_bloc.dart';
import '../../src/controllers/enter_number_cont.dart';
import '../../views/signin_view/signin_page.dart';
import '../../views/signup_view/signup_page.dart';
......@@ -39,9 +40,6 @@ class MainNavigator extends StatelessWidget {
case MainRoutes.main_page:
builder = (BuildContext _) => MainPage(controller: controller);
break;
case MainRoutes.sign_in_page:
builder = (BuildContext _) => UserSignInPage(controller: controller);
break;
case MainRoutes.user_signup_page:
builder = (BuildContext _) => MultiBlocProvider(
providers: [
......@@ -52,6 +50,16 @@ class MainNavigator extends StatelessWidget {
child: UserSignUpPage(controller: controller),
);
break;
case MainRoutes.sign_in_page:
builder = (BuildContext _) => MultiBlocProvider(
providers: [
BlocProvider<UserLogInBloc>(
create: (context) => UserLogInBloc(),
),
],
child: UserSignInPage(controller: controller),
);
break;
}
if (builder != null) {
return MaterialPageRoute(builder: builder, settings: settings);
......
import 'package:connectycube_sdk/connectycube_calls.dart';
import 'package:flutter/cupertino.dart';
import 'package:vmeeting/src/controllers/enter_number_cont.dart';
import '../../app_models/app_users_model/app_users_model.dart';
import '../../app_models/user_model/user_model.dart';
import '../../src/utils/app_utils.dart';
import '../../src/utils/pref_util.dart';
import '../../src/utils/show_dialogs.dart';
import '../routes/routes_name.dart';
class UserRepository {
static final UserRepository _singleton = UserRepository._internal();
UserRepository._internal();
static UserRepository getInstance() {
return _singleton;
}
Future<bool> userSigIn({required BuildContext context, required CubeUser user, required NumberController controller}) async {
bool isChaking = true;
await signIn(user).then((cubeUser) async {
AppUtils.userModel = UserModel(
id: cubeUser.id,
login: cubeUser.login,
email: cubeUser.email,
fullName: cubeUser.fullName
);
controller.inputElevatedButton.add(false);
SharedPrefs.saveNewUser(user);
Navigator.pushReplacementNamed(context, MainRoutes.main_page);
isChaking = true;
})
.catchError((error){
controller.inputElevatedButton.add(false);
errorMessage(context);
print(error);
isChaking = false;
});
return isChaking;
}
Future<void> userSigUp({required BuildContext context, required CubeUser user, required NumberController controller}) async {
signUp(user).then((cubeUser) {
AppUtils.userModel = UserModel(
id: cubeUser.id,
login: cubeUser.login,
email: cubeUser.email,
fullName: cubeUser.fullName
);
SharedPrefs.saveNewUser(user);
controller.inputElevatedButton.add(false);
Navigator.pushReplacementNamed(context, MainRoutes.main_page);
})
.catchError((error){
controller.inputElevatedButton.add(false);
errorMessage(context);
print(error);
});
}
Future<List<AppUsersModel>> getAppAllUsers() async {
List<AppUsersModel> appUsersModelList = [];
await getAllUsers().then((response) {
print("Shu yerda $response");
for(var item in response!.items){
appUsersModelList.add(AppUsersModel(
user: User(
fullName: item.fullName,
email: item.email,
login: item.login,
id: item.id,
avatar: item.avatar,
createdAt: item.createdAt?.timeZoneName,
customData: item.customData,
externalId: item.externalId.toString(),
externalUserId: item.externalUserId.toString(),
facebookId: item.facebookId,
isGuest: item.isGuest.toString(),
lastRequestAt: item.lastRequestAt?.toIso8601String(),
phone: item.phone,
)
));
}
}).catchError((onError){
});
return appUsersModelList;
}
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:vmeeting/src/constants/colors_const.dart';
import '../../app_models/user_model/user_model.dart';
class AppUtils {
static Widget buttonLoader = SizedBox(
width: 30,
......@@ -32,5 +34,6 @@ class AppUtils {
);
ScaffoldMessenger.of(context).showSnackBar(snackdemo);
}
static UserModel userModel = UserModel();
}
......@@ -28,13 +28,12 @@ class SharedPrefs {
static Future<bool> saveNewUser(CubeUser cubeUser) {
return getPrefs().then((prefs) {
prefs.clear();
prefs.setString(prefUserLogin, cubeUser.login!);
prefs.setString(prefUserPsw, cubeUser.password!);
prefs.setString(prefUserName, cubeUser.fullName!);
prefs.setInt(prefUserId, cubeUser.id!);
prefs.setString(prefUserLogin, cubeUser.login ?? "");
prefs.setString(prefUserPsw, cubeUser.password ?? "");
prefs.setString(prefUserName, cubeUser.fullName ?? "");
prefs.setInt(prefUserId, cubeUser.id ?? 0);
if (cubeUser.avatar != null)
prefs.setString(prefUserAvatar, cubeUser.avatar!);
prefs.setString(prefUserAvatar, cubeUser.avatar ?? "");
return Future.value(true);
});
}
......@@ -42,13 +41,13 @@ class SharedPrefs {
static Future<bool> updateUser(CubeUser cubeUser) {
return getPrefs().then((prefs) {
if (cubeUser.password != null)
prefs.setString(prefUserPsw, cubeUser.password!);
prefs.setString(prefUserPsw, cubeUser.password ?? "");
if (cubeUser.login != null)
prefs.setString(prefUserLogin, cubeUser.login!);
prefs.setString(prefUserLogin, cubeUser.login ?? "");
if (cubeUser.fullName != null)
prefs.setString(prefUserName, cubeUser.fullName!);
prefs.setString(prefUserName, cubeUser.fullName ?? "");
if (cubeUser.avatar != null)
prefs.setString(prefUserAvatar, cubeUser.avatar!);
prefs.setString(prefUserAvatar, cubeUser.avatar ?? "");
return Future.value(true);
});
......
import 'package:flutter/material.dart';
import '../constants/colors_const.dart';
class AvatarImage extends StatelessWidget {
final double radius;
final String imagePath;
const AvatarImage({Key? key, this.radius = 60, required this.imagePath}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: radius*1.8,
height: radius*1.8,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(60),
color: ColorConst.appWhiteColor
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Image.asset(
imagePath,
width: radius*1.8,
height: radius*1.8,
fit: BoxFit.fill,
),
),
),
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:vmeeting/src/constants/colors_const.dart';
import 'package:vmeeting/src/widgets/big_text_widget.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:vmeeting/app_models/app_users_model/app_users_model.dart';
import 'package:vmeeting/blocs/home_page_bloc/home_page_bloc.dart';
import 'package:vmeeting/src/controllers/enter_number_cont.dart';
import 'package:vmeeting/src/widgets/small_text.dart';
import '../../service/routes/routes_name.dart';
import '../../src/widgets/custom_loading/customloading.dart';
import '../../src/widgets/exceptions/app_exeptions.dart';
import '../../src/controllers/enter_number_cont.dart';
class HomePage extends StatelessWidget {
class HomePage extends StatefulWidget {
final NumberController controller;
const HomePage({super.key, required this.controller});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
late HomePageBloc homePageBloc;
@override
void initState() {
super.initState();
homePageBloc = BlocProvider.of<HomePageBloc>(context);
homePageBloc.add(HomePageFetchEvent());
}
@override
Widget build(BuildContext context) {
return Center(
child:BigText( text: "Salom",color: ColorConst.appMainBackgroundColor,)
return Scaffold(
body: BlocConsumer<HomePageBloc, HomePageState>(
listener: (context, state) {},
builder: (context, state) {
if (state is HomePageInitialState) {
return buildLoading();
} else if (state is HomePageLoadedState) {
return buildUI(state.appUsersModelList);
}
if (state is HomePageExceptionState) {
return const Center(
child: AppExceptionsWidget(
message: "Exception",
authName: MainRoutes.main_page));
}
return const Center(child: Text("AloVoice"));
},
),
);
}
Widget buildUI(List<AppUsersModel> appUserModelList) {
return ListView.builder(
itemCount: appUserModelList.length,
itemBuilder: (BuildContext context, int index){
return SmallText(text: appUserModelList[index].user?.fullName ?? "");
});
}
Widget buildLoading() {
return Center(child: CustomLoading());
}
}
\ No newline at end of file
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:vmeeting/blocs/home_page_bloc/home_page_bloc.dart';
import 'package:vmeeting/src/controllers/enter_number_cont.dart';
import 'package:vmeeting/views/home_view/home_page.dart';
import 'package:vmeeting/views/profile_view/profile_page.dart';
import 'package:vmeeting/views/users_view/users_page.dart';
import '../../src/constants/colors_const.dart';
class MainPage extends StatefulWidget {
......@@ -18,7 +19,14 @@ class MainPage extends StatefulWidget {
class _MainPageState extends State<MainPage> {
int current_index = 0;
late List<Widget> pages = [
HomePage(controller: widget.controller),
MultiBlocProvider(
providers: [
BlocProvider<HomePageBloc>(
create: (context) => HomePageBloc(),
),
],
child: HomePage(controller: widget.controller),
),
AllUsersViewPage(controller: widget.controller),
ProfilePage(controller: widget.controller)
];
......@@ -39,7 +47,7 @@ class _MainPageState extends State<MainPage> {
borderRadius: BorderRadius.circular(50),
child: CurvedNavigationBar(
height: 50,
backgroundColor: ColorConst.appGreanColor,
backgroundColor: ColorConst.appBackgroundColor,
color: ColorConst.appGreenColor,
buttonBackgroundColor: ColorConst.appGreenColor,
onTap: OnTapped,
......
import 'package:flutter/material.dart';
import 'package:vmeeting/src/extension/context_extensions.dart';
import 'package:vmeeting/src/widgets/small_text.dart';
import '../../src/constants/colors_const.dart';
import '../../src/controllers/enter_number_cont.dart';
import '../../src/utils/app_utils.dart';
import '../../src/widgets/big_text_widget.dart';
import '../../src/widgets/image_avatar.dart';
class ProfilePage extends StatelessWidget {
final NumberController controller;
......@@ -9,9 +14,97 @@ class ProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text("Profil Page"),
body: buildUI(context),
);
}
Widget buildUI(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(horizontal: context.w * 0.06),
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: context.h * 0.1),
buildImage(context),
SizedBox(height: context.h * 0.1),
buildDetails(context),
],
),
)
);
}
Widget buildDetails(BuildContext context) {
return Column(
children: [
Container(
height: context.h * 0.06,
decoration: BoxDecoration(
color: ColorConst.appBackgroundColor,
borderRadius: BorderRadius.circular(12)),
child: Center(
child: SmallText(
text: AppUtils.userModel.id.toString() ?? "",
),
),
),
SizedBox(height: context.h * 0.03),
Container(
height: context.h * 0.06,
decoration: BoxDecoration(
color: ColorConst.appBackgroundColor,
borderRadius: BorderRadius.circular(12)),
child: Center(
child: SmallText(
text: AppUtils.userModel.fullName ?? "",
),
),
),
SizedBox(height: context.h * 0.03),
Container(
height: context.h * 0.06,
decoration: BoxDecoration(
color: ColorConst.appBackgroundColor,
borderRadius: BorderRadius.circular(12)),
child: Center(
child: SmallText(
text: AppUtils.userModel.email ?? "",
),
),
),
SizedBox(height: context.h * 0.12),
buildButtons(context),
],
);
}
Widget buildButtons(BuildContext context) {
return ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: ColorConst.appGreenColor,
disabledForegroundColor: Colors.grey.withOpacity(0.38),
disabledBackgroundColor: Colors.grey.withOpacity(0.12),
),
onPressed: () async {},
child: SizedBox(
width: context.w * 0.8,
height: context.h * 0.06,
child: Center(
child: BigText(
text: "Edit Profile".toUpperCase(),
fontWidget: FontWeight.bold,
size: 16,
),
),
),
);
}
}
\ No newline at end of file
Widget buildImage(BuildContext context) {
return Center(
child: AvatarImage(
radius: context.h * 0.1, imagePath: 'assets/contact_avatar.png'),
);
}
}
import 'package:connectycube_sdk/connectycube_calls.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:vmeeting/blocs/user_login_bloc/user_log_in_bloc.dart';
import 'package:vmeeting/src/controllers/enter_number_cont.dart';
import 'package:vmeeting/src/extension/context_extensions.dart';
import '../../app_models/user_model/user_model.dart';
import '../../service/routes/routes_name.dart';
import '../../src/constants/colors_const.dart';
import '../../src/utils/app_utils.dart';
import '../../src/utils/show_dialogs.dart';
import '../../src/utils/pref_util.dart';
import '../../src/widgets/big_text_widget.dart';
import '../../src/widgets/custom_loading/customloading.dart';
import '../../src/widgets/exceptions/app_exeptions.dart';
import '../../src/widgets/small_text.dart';
import '../../src/widgets/textfiled_widgets/auth_text_fild.dart';
class UserSignInPage extends StatefulWidget {
......@@ -21,16 +23,46 @@ class UserSignInPage extends StatefulWidget {
}
class _UserSignInPageState extends State<UserSignInPage> {
late UserLogInBloc userLogInBloc;
late bool isDarkMode = false;
final _loginControlle = TextEditingController(text: "");
final _loginControlle = TextEditingController(text: "Inomjon2000");
final _loginFocusNode = FocusNode();
final _passwordControlle = TextEditingController(text: "");
final _passwordControlle = TextEditingController(text: "Inomjon5408");
final _passwordFocusNode = FocusNode();
@override
void initState() {
userLogInBloc = BlocProvider.of<UserLogInBloc>(context);
SharedPrefs.getUser().then((loggedUser) {
if (loggedUser != null) {
userLogInBloc.add(UserLogInChakedEvent(controller: widget.controller, context: context, user: loggedUser));
} else{
userLogInBloc.add(UserLogInFetchEvent());
}
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: buildUI(),
body: BlocConsumer<UserLogInBloc, UserLogInState>(
listener: (context, state) {},
builder: (context, state) {
if (state is UserLogInInitialState) {
return buildLoading();
} else if (state is UserLogInLoadedState) {
return buildUI();
}
if (state is UserLogInExceptionState) {
return const Center(
child: AppExceptionsWidget(
message: "Exception",
authName: MainRoutes.user_signup_page));
}
return const Center(child: Text("AloVoice"));
},
),
);
}
Widget buildUI(){
......@@ -76,7 +108,15 @@ class _UserSignInPageState extends State<UserSignInPage> {
focusNode: _passwordFocusNode,
textEditingController: _passwordControlle,
),
SizedBox(height: context.h * 0.16),
SizedBox(height: context.h * 0.02),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(onPressed: (){
Navigator.pushReplacementNamed(context, MainRoutes.user_signup_page);
}, child: SmallText(text: "Sign Up",color: ColorConst.appMainColor,))
],),
SizedBox(height: context.h * 0.13),
buildButtons(),
],
),
......@@ -111,8 +151,8 @@ class _UserSignInPageState extends State<UserSignInPage> {
child: Center(
child: snapshot.data ?? false
? AppUtils.buttonLoader
: const BigText(
text: "Sin Up",
: BigText(
text: "Sign In".toUpperCase(),
fontWidget: FontWeight.bold,
size: 16,
),
......@@ -127,23 +167,8 @@ class _UserSignInPageState extends State<UserSignInPage> {
CubeUser user = CubeUser(
login: _loginControlle.text,
password: _passwordControlle.text,);
signIn(user).then((cubeUser) {
UserModel(
id: cubeUser.id,
login: cubeUser.login,
email: cubeUser.email,
fullName: cubeUser.fullName
);
print("Shu yerda $cubeUser");
widget.controller.inputElevatedButton.add(false);
Navigator.pushReplacementNamed(context, MainRoutes.main_page);
userLogInBloc.add(UserLogInChakingEvent(controller: widget.controller, context: context, user: user));
})
.catchError((error){
widget.controller.inputElevatedButton.add(false);
errorMessage(context);
print(error);
});
}
Widget buildLoading() {
......
......@@ -5,6 +5,7 @@ import 'package:vmeeting/blocs/user_sign_up_bloc/user_sign_up_bloc.dart';
import 'package:vmeeting/src/controllers/enter_number_cont.dart';
import 'package:vmeeting/src/extension/context_extensions.dart';
import 'package:vmeeting/src/utils/app_utils.dart';
import 'package:vmeeting/src/widgets/small_text.dart';
import '../../app_models/user_model/user_model.dart';
import '../../service/routes/routes_name.dart';
......@@ -136,8 +137,15 @@ class _UserSignUpPageState extends State<UserSignUpPage> {
focusNode: _fullNameFocusNode,
textEditingController: _fullNameControlle,
),
SizedBox(height: context.h * 0.06),
SizedBox(height: context.h * 0.06),
SizedBox(height: context.h * 0.01),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(onPressed: (){
Navigator.pushReplacementNamed(context, MainRoutes.sign_in_page);
}, child: SmallText(text: "Sign In",color: ColorConst.appMainColor,))
],),
SizedBox(height: context.h * 0.08),
buildButtons(),
],
),
......@@ -159,9 +167,7 @@ class _UserSignUpPageState extends State<UserSignUpPage> {
disabledBackgroundColor: Colors.grey.withOpacity(0.12),
),
onPressed: () async {
Navigator.pushReplacementNamed(context, MainRoutes.main_page);
if(_fullNameControlle.text.isNotEmpty && _emailControlle.text.isNotEmpty && _loginControlle.text.isNotEmpty && _passwordControlle.text.isNotEmpty){
widget.controller.inputElevatedButton.add(true);
userSigUp();
}else{
AppUtils.showSnackBar(context, "PLEASE ENTER THE SAME VALUE AGAIN");
......@@ -174,8 +180,8 @@ class _UserSignUpPageState extends State<UserSignUpPage> {
child: Center(
child: snapshot.data ?? false
? AppUtils.buttonLoader
: const BigText(
text: "Sin Up",
: BigText(
text: "Sign Up".toUpperCase(),
fontWidget: FontWeight.bold,
size: 16,
),
......@@ -188,26 +194,14 @@ class _UserSignUpPageState extends State<UserSignUpPage> {
}
Future<void> userSigUp() async {
widget.controller.inputElevatedButton.add(true);
CubeUser user = CubeUser(
login: _loginControlle.text,
password: _passwordControlle.text,
email: _emailControlle.text,
fullName: _fullNameControlle.text,);
signUp(user).then((cubeUser) {
UserModel(
id: cubeUser.id,
login: cubeUser.login,
email: cubeUser.email,
fullName: cubeUser.fullName
);
print("Shu yerda $cubeUser");
widget.controller.inputElevatedButton.add(false);
})
.catchError((error){
widget.controller.inputElevatedButton.add(false);
errorMessage(context);
print(error);
});
userSignUpBloc.add(UserSignUpChakingEvent(controller: widget.controller, context: context, user: user));
}
Widget buildLoading() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment