Commit 2f86dea6 authored by Inomjon's avatar Inomjon

Aplication webga chiqdi

parent dac0c905
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:connectycube_sdk/connectycube_calls.dart'; import 'package:connectycube_sdk/connectycube_calls.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:flutter/cupertino.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:vmeeting/service/user_repositores/user_repo.dart'; import 'package:vmeeting/service/user_repositores/user_repo.dart';
import 'package:vmeeting/src/controllers/enter_number_cont.dart';
import '../../src/utils/app_utils.dart'; import '../../src/utils/app_utils.dart';
part 'edit_profile_event.dart'; part 'edit_profile_event.dart';
part 'edit_profile_state.dart'; part 'edit_profile_state.dart';
...@@ -16,7 +18,8 @@ class EditProfileBloc extends Bloc<EditProfileEvent, EditProfileState> { ...@@ -16,7 +18,8 @@ class EditProfileBloc extends Bloc<EditProfileEvent, EditProfileState> {
on<EditProfileUpdateEvent>((event, emit) async { on<EditProfileUpdateEvent>((event, emit) async {
try{ try{
await UserRepository.getInstance().updateUserProfile(event.user ?? CubeUser()); await UserRepository.getInstance().updateUserProfile(event.context,event.user ?? CubeUser());
event.controller?.inputElevatedButton.add(false);
emit(EditProfileLoadedState(user: AppUtils.cubeUser)); emit(EditProfileLoadedState(user: AppUtils.cubeUser));
}catch(e){ }catch(e){
emit(EditProfileExceptionState(message: e.toString())); emit(EditProfileExceptionState(message: e.toString()));
......
...@@ -9,8 +9,10 @@ class EditProfileFetchEvent extends EditProfileEvent{ ...@@ -9,8 +9,10 @@ class EditProfileFetchEvent extends EditProfileEvent{
} }
class EditProfileUpdateEvent extends EditProfileEvent{ class EditProfileUpdateEvent extends EditProfileEvent{
final BuildContext context;
final NumberController? controller;
final CubeUser? user; final CubeUser? user;
EditProfileUpdateEvent({this.user}); EditProfileUpdateEvent({required this.context, this.controller, this.user});
@override @override
List<Object?> get props => [user]; List<Object?> get props => [user];
} }
...@@ -145,8 +145,8 @@ class UserRepository { ...@@ -145,8 +145,8 @@ class UserRepository {
}); });
} }
Future<void> updateUserProfile(CubeUser user) async { Future<void> updateUserProfile(BuildContext context,CubeUser user) async {
updateUser(user).then((updatedUser) { await updateUser(user).then((updatedUser) {
AppUtils.cubeUser = updatedUser; AppUtils.cubeUser = updatedUser;
AppUtils.userModel = UserModel( AppUtils.userModel = UserModel(
login: updatedUser.login ?? "", login: updatedUser.login ?? "",
...@@ -166,8 +166,9 @@ class UserRepository { ...@@ -166,8 +166,9 @@ class UserRepository {
timezone: updatedUser.timeZone.toString(), timezone: updatedUser.timeZone.toString(),
twitterId: updatedUser.twitterId ?? "", twitterId: updatedUser.twitterId ?? "",
updatedAt: updatedUser.updatedAt?.toIso8601String() ?? "", updatedAt: updatedUser.updatedAt?.toIso8601String() ?? "",
website: updatedUser.website.toString() ?? "" website: updatedUser.website.toString(),
); );
AppUtils.showSnackBar(context, "The profile has been updated ✅");
}).catchError((error) {}); }).catchError((error) {});
} }
......
import 'package:connectycube_sdk/connectycube_chat.dart';
import 'package:connectycube_sdk/connectycube_sdk.dart'; import 'package:connectycube_sdk/connectycube_sdk.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vmeeting/src/extension/context_extensions.dart'; import 'package:vmeeting/src/extension/context_extensions.dart';
...@@ -73,8 +72,8 @@ class _DrawerMenueState extends State<DrawerMenue> { ...@@ -73,8 +72,8 @@ class _DrawerMenueState extends State<DrawerMenue> {
child: Column( child: Column(
children: [ children: [
ListTile( ListTile(
leading: Icon(Icons.settings, color: ColorConst.appBleckColor), leading: Icon(Icons.lock, color: ColorConst.appBleckColor),
title: const BigText(text: "Settings",), title: const SmallText(text: "Password changed",size: 16),
trailing: Icon(Icons.navigate_next, trailing: Icon(Icons.navigate_next,
color: ColorConst.appBleckColor, color: ColorConst.appBleckColor,
size: 30, size: 30,
......
...@@ -141,8 +141,14 @@ class _EditProfilePageState extends State<EditProfilePage> { ...@@ -141,8 +141,14 @@ class _EditProfilePageState extends State<EditProfilePage> {
],); ],);
} }
Widget buildButtons(BuildContext context, CubeUser cubeUser) { Widget buildButtons(BuildContext context, CubeUser cubeUser) {
return ElevatedButton( return StreamBuilder(stream: widget.controller.outputElevatedButton,
builder: (BuildContext context, snapshot){
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, foregroundColor: Colors.white,
backgroundColor: ColorConst.appGreenColor, backgroundColor: ColorConst.appGreenColor,
...@@ -151,14 +157,16 @@ class _EditProfilePageState extends State<EditProfilePage> { ...@@ -151,14 +157,16 @@ class _EditProfilePageState extends State<EditProfilePage> {
), ),
onPressed: () async { onPressed: () async {
if(_loginControlle.text.isNotEmpty && _emailControlle.text.isNotEmpty && _fullNameControlle.text.isNotEmpty){ if(_loginControlle.text.isNotEmpty && _emailControlle.text.isNotEmpty && _fullNameControlle.text.isNotEmpty){
widget.controller.inputElevatedButton.add(true);
editProfileBloc.add(EditProfileUpdateEvent( editProfileBloc.add(EditProfileUpdateEvent(
controller: widget.controller,
user: CubeUser( user: CubeUser(
fullName: _fullNameControlle.text, fullName: _fullNameControlle.text,
email: _emailControlle.text, email: _emailControlle.text,
login: _loginControlle.text, login: _loginControlle.text,
phone: _phoneControlle.text, phone: _phoneControlle.text,
id: cubeUser.id, id: cubeUser.id,
) ), context: context
)); ));
}else{ }else{
AppUtils.showSnackBar(context, "PLEASE ENTER THE SAME VALUE AGAIN"); AppUtils.showSnackBar(context, "PLEASE ENTER THE SAME VALUE AGAIN");
...@@ -168,16 +176,22 @@ class _EditProfilePageState extends State<EditProfilePage> { ...@@ -168,16 +176,22 @@ class _EditProfilePageState extends State<EditProfilePage> {
child: SizedBox( child: SizedBox(
height: context.h * 0.06, height: context.h * 0.06,
child: Center( child: Center(
child: BigText( child: snapshot.data ?? false
? AppUtils.buttonLoader
: BigText(
text: "Update".toUpperCase(), text: "Update".toUpperCase(),
fontWidget: FontWeight.bold, fontWidget: FontWeight.bold,
size: 16, size: 16,
), ),
), ),
), ),
),
],
); );
});
} }
Widget buildImage(BuildContext context, CubeUser cubeUser) { Widget buildImage(BuildContext context, CubeUser cubeUser) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
......
...@@ -47,11 +47,11 @@ class ProfilePage extends StatelessWidget { ...@@ -47,11 +47,11 @@ class ProfilePage extends StatelessWidget {
borderRadius: BorderRadius.circular(12)), borderRadius: BorderRadius.circular(12)),
child: Center( child: Center(
child: SmallText( child: SmallText(
text: AppUtils.userModel.id.toString() ?? "", text: "ID: ${AppUtils.userModel.id ?? ""}",
), ),
), ),
), ),
SizedBox(height: context.h * 0.03), SizedBox(height: context.h * 0.02),
Container( Container(
height: context.h * 0.06, height: context.h * 0.06,
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -59,11 +59,11 @@ class ProfilePage extends StatelessWidget { ...@@ -59,11 +59,11 @@ class ProfilePage extends StatelessWidget {
borderRadius: BorderRadius.circular(12)), borderRadius: BorderRadius.circular(12)),
child: Center( child: Center(
child: SmallText( child: SmallText(
text: AppUtils.userModel.fullName ?? "", text: "Full Name: ${AppUtils.userModel.fullName ?? ""}",
), ),
), ),
), ),
SizedBox(height: context.h * 0.03), SizedBox(height: context.h * 0.02),
Container( Container(
height: context.h * 0.06, height: context.h * 0.06,
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -71,11 +71,11 @@ class ProfilePage extends StatelessWidget { ...@@ -71,11 +71,11 @@ class ProfilePage extends StatelessWidget {
borderRadius: BorderRadius.circular(12)), borderRadius: BorderRadius.circular(12)),
child: Center( child: Center(
child: SmallText( child: SmallText(
text: AppUtils.userModel.email ?? "", text: "Emile: ${AppUtils.userModel.email ?? " "}",
), ),
), ),
), ),
SizedBox(height: context.h * 0.03), SizedBox(height: context.h * 0.02),
Container( Container(
height: context.h * 0.06, height: context.h * 0.06,
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -83,11 +83,23 @@ class ProfilePage extends StatelessWidget { ...@@ -83,11 +83,23 @@ class ProfilePage extends StatelessWidget {
borderRadius: BorderRadius.circular(12)), borderRadius: BorderRadius.circular(12)),
child: Center( child: Center(
child: SmallText( child: SmallText(
text: result.toString(), text: "Phone: ${AppUtils.userModel.phone ?? "No phone"}",
), ),
), ),
), ),
SizedBox(height: context.h * 0.1), SizedBox(height: context.h * 0.02),
Container(
height: context.h * 0.06,
decoration: BoxDecoration(
color: ColorConst.appBackgroundColor,
borderRadius: BorderRadius.circular(12)),
child: Center(
child: SmallText(
text: "Create Date: $result",
),
),
),
SizedBox(height: context.h * 0.05),
buildButtons(context), buildButtons(context),
], ],
); );
......
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