Commit c593748d authored by Inomjon's avatar Inomjon

update chiqarish

parent 52d9223a
...@@ -10,6 +10,8 @@ import 'package:vmeeting/views/main_view/main_page.dart'; ...@@ -10,6 +10,8 @@ import 'package:vmeeting/views/main_view/main_page.dart';
import '../../blocs/user_login_bloc/user_log_in_bloc.dart'; import '../../blocs/user_login_bloc/user_log_in_bloc.dart';
import '../../src/controllers/enter_number_cont.dart'; import '../../src/controllers/enter_number_cont.dart';
import '../../src/login_screen.dart'; import '../../src/login_screen.dart';
import '../../src/utils/app_utils.dart';
import '../../srcchat/settings_screen.dart';
import '../../views/edit_profile_view/edit_profile_page.dart'; import '../../views/edit_profile_view/edit_profile_page.dart';
import '../../views/reset_password_view/reset_password_page.dart'; import '../../views/reset_password_view/reset_password_page.dart';
import '../../views/signin_view/signin_page.dart'; import '../../views/signin_view/signin_page.dart';
...@@ -51,9 +53,9 @@ class MainNavigator extends StatelessWidget { ...@@ -51,9 +53,9 @@ class MainNavigator extends StatelessWidget {
case MainRoutes.reset_password_page: case MainRoutes.reset_password_page:
builder = (BuildContext _) => ResetPasswordPage(controller: controller); builder = (BuildContext _) => ResetPasswordPage(controller: controller);
break; break;
// case MainRoutes.chat_dialog: case MainRoutes.setting_screen:
// builder = (BuildContext _) => ChatDialogScreen(args![USER_ARG_NAME], args[DIALOG_ARG_NAME]); builder = (BuildContext _) => SettingsScreen(AppUtils.cubeUser);
// break; break;
case MainRoutes.user_signup_page: case MainRoutes.user_signup_page:
builder = (BuildContext _) => MultiBlocProvider( builder = (BuildContext _) => MultiBlocProvider(
providers: [ providers: [
......
...@@ -8,5 +8,5 @@ class MainRoutes { ...@@ -8,5 +8,5 @@ class MainRoutes {
static const String old_sign_in = "old_sign_in"; static const String old_sign_in = "old_sign_in";
static const String edit_profile_page = "edit_profile_page"; static const String edit_profile_page = "edit_profile_page";
static const String reset_password_page = "reset_password_page"; static const String reset_password_page = "reset_password_page";
static const String chat_dialog = "chat_dialog"; static const String setting_screen = "setting_screen";
} }
\ No newline at end of file
...@@ -39,6 +39,7 @@ class UserRepository { ...@@ -39,6 +39,7 @@ class UserRepository {
isChaking = false; isChaking = false;
controller.inputElevatedButton.add(false); controller.inputElevatedButton.add(false);
errorMessage(context," ConnectyCube 11"); errorMessage(context," ConnectyCube 11");
SharedPrefs.deleteUserData();
}); });
} }
return isChaking; return isChaking;
...@@ -68,6 +69,7 @@ class UserRepository { ...@@ -68,6 +69,7 @@ class UserRepository {
}) })
.catchError((error){ .catchError((error){
controller.inputElevatedButton.add(false); controller.inputElevatedButton.add(false);
SharedPrefs.deleteUserData();
errorMessage(context, " ConnectyCube 33"); errorMessage(context, " ConnectyCube 33");
print(error); print(error);
}); });
......
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../srcchat/settings_screen.dart';
import '../../../srcchat/utils/platform_utils.dart';
import '../../constants/colors_const.dart'; import '../../constants/colors_const.dart';
import '../../utils/app_utils.dart';
import '../textfiled_widgets/auth_text_fild.dart'; import '../textfiled_widgets/auth_text_fild.dart';
import 'icon_painters/notification_icon_painter.dart'; import 'icon_painters/notification_icon_painter.dart';
...@@ -14,7 +17,12 @@ const double _appBarExpandedHeight1 = 50 + _searchBarHeight; // 154 ...@@ -14,7 +17,12 @@ const double _appBarExpandedHeight1 = 50 + _searchBarHeight; // 154
class SliverScaffold extends StatefulWidget { class SliverScaffold extends StatefulWidget {
final Widget appBarIcon; final Widget appBarIcon;
final int pageIndex; final int pageIndex;
const SliverScaffold({Key? key, required this.body,required this.appBarIcon, required this.pageIndex}) : super(key: key); const SliverScaffold(
{Key? key,
required this.body,
required this.appBarIcon,
required this.pageIndex})
: super(key: key);
final Widget body; final Widget body;
...@@ -55,19 +63,22 @@ class _SliverScaffoldState extends State<SliverScaffold> { ...@@ -55,19 +63,22 @@ class _SliverScaffoldState extends State<SliverScaffold> {
headerSliverBuilder: (_, __) => [ headerSliverBuilder: (_, __) => [
SliverAppBar( SliverAppBar(
leading: Row( leading: Row(
children: [ children: [SizedBox(width: actionSpacing), widget.appBarIcon],
SizedBox(width: actionSpacing),
widget.appBarIcon
],
), ),
leadingWidth: 74, leadingWidth: 74,
centerTitle: true, centerTitle: true,
actions: [ actions: [
IconButton( widget.pageIndex == 0
onPressed: () {}, ? IconButton(
splashRadius: 24, onPressed: () {},
icon: NotificationIconPainter.getCustomPaint(iconStrokeWidth), splashRadius: 24,
), icon: NotificationIconPainter.getCustomPaint(iconStrokeWidth),
)
: IconButton(
onPressed: () => _openSettings(context),
splashRadius: 24,
icon: Icon(Icons.settings, color: ColorConst.appBleckColor),
),
SizedBox(width: actionSpacing), SizedBox(width: actionSpacing),
], ],
toolbarHeight: _appBarCollapsedHeight, toolbarHeight: _appBarCollapsedHeight,
...@@ -90,19 +101,19 @@ class _SliverScaffoldState extends State<SliverScaffold> { ...@@ -90,19 +101,19 @@ class _SliverScaffoldState extends State<SliverScaffold> {
title: Column( title: Column(
children: [ children: [
widget.pageIndex == 0 widget.pageIndex == 0
? AuthTextFild( ? AuthTextFild(
lableName: "Search...", lableName: "Search...",
borderRadius: 10, borderRadius: 10,
elevation: 1, elevation: 1,
color: ColorConst.appBackgroundColor.withOpacity(0.4), color: ColorConst.appBackgroundColor.withOpacity(0.4),
focusNode: _searchFocusNode, focusNode: _searchFocusNode,
textEditingController: _searchControlle, textEditingController: _searchControlle,
) )
: widget.pageIndex == 1 : widget.pageIndex == 1
? SizedBox() ? SizedBox()
: widget.pageIndex == 2 : widget.pageIndex == 2
? SizedBox() ? SizedBox()
: SizedBox(), : SizedBox(),
const Spacer(), const Spacer(),
], ],
), ),
...@@ -117,6 +128,10 @@ class _SliverScaffoldState extends State<SliverScaffold> { ...@@ -117,6 +128,10 @@ class _SliverScaffoldState extends State<SliverScaffold> {
); );
} }
_openSettings(BuildContext context) {
showModal(context: context, child: SettingsScreen(AppUtils.cubeUser,));
}
_scrollListener() { _scrollListener() {
setState(() { setState(() {
currentExtent = _scrollController.offset; currentExtent = _scrollController.offset;
......
...@@ -16,11 +16,8 @@ class CreateDialog extends StatelessWidget { ...@@ -16,11 +16,8 @@ class CreateDialog extends StatelessWidget {
key: Navigation.createDialogNavigation, key: Navigation.createDialogNavigation,
initialRoute: 'search_users', initialRoute: 'search_users',
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
Map<String, dynamic>? args = Map<String, dynamic>? args = settings.arguments as Map<String, dynamic>?;
settings.arguments as Map<String, dynamic>?;
Widget page; Widget page;
switch (settings.name) { switch (settings.name) {
case 'search_users': case 'search_users':
page = CreateChatScreen(currentUser); page = CreateChatScreen(currentUser);
......
...@@ -3,9 +3,12 @@ import 'package:flutter/material.dart'; ...@@ -3,9 +3,12 @@ import 'package:flutter/material.dart';
import 'package:connectycube_sdk/connectycube_chat.dart'; import 'package:connectycube_sdk/connectycube_chat.dart';
import 'package:vmeeting/src/constants/colors_const.dart'; import 'package:vmeeting/src/constants/colors_const.dart';
import 'chat_dialog_resizable_screen.dart';
import 'chat_dialog_screen.dart';
import 'utils/api_utils.dart'; import 'utils/api_utils.dart';
import 'utils/consts.dart'; import 'utils/consts.dart';
import 'widgets/common.dart'; import 'widgets/common.dart';
import 'package:vmeeting/srcchat//utils/platform_utils.dart' as platformUtils;
class CreateChatScreen extends StatelessWidget { class CreateChatScreen extends StatelessWidget {
final CubeUser _cubeUser; final CubeUser _cubeUser;
...@@ -29,13 +32,13 @@ class CreateChatScreen extends StatelessWidget { ...@@ -29,13 +32,13 @@ class CreateChatScreen extends StatelessWidget {
); );
} }
CreateChatScreen(this._cubeUser); const CreateChatScreen(this._cubeUser, {super.key});
} }
class BodyLayout extends StatefulWidget { class BodyLayout extends StatefulWidget {
final CubeUser currentUser; final CubeUser currentUser;
BodyLayout(this.currentUser); const BodyLayout(this.currentUser, {super.key});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
...@@ -48,7 +51,7 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -48,7 +51,7 @@ class _BodyLayoutState extends State<BodyLayout> {
final CubeUser currentUser; final CubeUser currentUser;
List<CubeUser> userList = []; List<CubeUser> userList = [];
Set<int> _selectedUsers = {}; final Set<int> _selectedUsers = {};
var _isUsersContinues = false; var _isUsersContinues = false;
var _isPrivateDialog = true; var _isPrivateDialog = true;
String? userToSearch; String? userToSearch;
...@@ -58,30 +61,31 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -58,30 +61,31 @@ class _BodyLayoutState extends State<BodyLayout> {
_searchUser(value) { _searchUser(value) {
log("searchUser _user= $value"); log("searchUser _user= $value");
if (value != null) if (value != null) {
setState(() { setState(() {
userToSearch = value; userToSearch = value;
_isUsersContinues = true; _isUsersContinues = true;
}); });
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( body: Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 16), padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Column( child: Column(
children: [ children: [
_buildTextFields(), _buildTextFields(),
_buildDialogButton(), _buildDialogButton(),
Container( Container(
margin: EdgeInsets.only(left: 8), margin: const EdgeInsets.only(left: 8),
child: Visibility( child: Visibility(
maintainSize: false, maintainSize: false,
maintainAnimation: false, maintainAnimation: false,
maintainState: false, maintainState: false,
visible: _isUsersContinues, visible: _isUsersContinues,
child: CircularProgressIndicator( child: const CircularProgressIndicator(
strokeWidth: 2, strokeWidth: 2,
), ),
), ),
...@@ -91,36 +95,32 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -91,36 +95,32 @@ class _BodyLayoutState extends State<BodyLayout> {
), ),
], ],
)), )),
floatingActionButton: new Visibility( floatingActionButton: Visibility(
visible: !_isPrivateDialog, visible: !_isPrivateDialog,
child: FloatingActionButton( child: FloatingActionButton(
heroTag: "New dialog", heroTag: "New dialog",
child: Icon( backgroundColor: Colors.blue,
onPressed: () => _createDialog(context, _selectedUsers, true),
child: const Icon(
Icons.check, Icons.check,
color: Colors.white, color: Colors.white,
), ),
backgroundColor: Colors.blue,
onPressed: () => _createDialog(context, _selectedUsers, true),
), ),
), ),
); );
} }
Widget _buildTextFields() { Widget _buildTextFields() {
return new Container( return Column(
child: new Column( children: <Widget>[
children: <Widget>[ TextField(
new Container( autofocus: true,
child: new TextField( textInputAction: TextInputAction.search,
autofocus: true, decoration: const InputDecoration(labelText: 'Search users'),
textInputAction: TextInputAction.search, onSubmitted: (value) {
decoration: new InputDecoration(labelText: 'Search users'), _searchUser(value.trim());
onSubmitted: (value) { }),
_searchUser(value.trim()); ],
}),
),
],
),
); );
} }
...@@ -141,7 +141,7 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -141,7 +141,7 @@ class _BodyLayoutState extends State<BodyLayout> {
} }
} }
return new Container( return Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: TextButton.icon( child: TextButton.icon(
icon: Icon( icon: Icon(
...@@ -184,48 +184,48 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -184,48 +184,48 @@ class _BodyLayoutState extends State<BodyLayout> {
}); });
} }
} }
if (userList.isEmpty) if (userList.isEmpty) {
return FittedBox( return FittedBox(
fit: BoxFit.contain, fit: BoxFit.contain,
child: Text(userMsg), child: Text(userMsg),
); );
else } else {
return ListView.builder( return ListView.builder(
itemCount: userList.length, itemCount: userList.length,
itemBuilder: _getListItemTile, itemBuilder: _getListItemTile,
); );
}
} }
Widget _getListItemTile(BuildContext context, int index) { Widget _getListItemTile(BuildContext context, int index) {
getPrivateWidget() { getPrivateWidget() {
return Container( return Container(
margin: const EdgeInsets.only(bottom: 10.0, left: 5.0, right: 5.0),
child: TextButton( child: TextButton(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
getUserAvatarWidget(userList[index], 30), getUserAvatarWidget(userList[index], 30),
Flexible( Flexible(
child: Container( child: Container(
margin: const EdgeInsets.only(left: 20.0),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.fromLTRB(10.0, 0.0, 0.0, 5.0),
child: Text( child: Text(
'${userList[index].fullName}', '${userList[index].fullName}',
style: TextStyle(color: primaryColor), style: TextStyle(color: primaryColor),
), ),
alignment: Alignment.centerLeft,
margin: EdgeInsets.fromLTRB(10.0, 0.0, 0.0, 5.0),
), ),
], ],
), ),
margin: EdgeInsets.only(left: 20.0),
), ),
), ),
Container( Icon(
child: Icon( Icons.arrow_forward,
Icons.arrow_forward, size: 25.0,
size: 25.0, color: themeColor,
color: themeColor,
),
), ),
], ],
), ),
...@@ -233,46 +233,44 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -233,46 +233,44 @@ class _BodyLayoutState extends State<BodyLayout> {
_createDialog(context, {userList[index].id!}, false); _createDialog(context, {userList[index].id!}, false);
}, },
), ),
margin: EdgeInsets.only(bottom: 10.0, left: 5.0, right: 5.0),
); );
} }
getGroupWidget() { getGroupWidget() {
return Container( return Container(
margin: const EdgeInsets.only(bottom: 10.0, left: 5.0, right: 5.0),
child: TextButton( child: TextButton(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
getUserAvatarWidget(userList[index], 30), getUserAvatarWidget(userList[index], 30),
Flexible( Flexible(
child: Container( child: Container(
margin: const EdgeInsets.only(left: 20.0),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.fromLTRB(10.0, 0.0, 0.0, 5.0),
child: Text( child: Text(
'${userList[index].fullName}', '${userList[index].fullName}',
style: TextStyle(color: primaryColor), style: TextStyle(color: primaryColor),
), ),
alignment: Alignment.centerLeft,
margin: EdgeInsets.fromLTRB(10.0, 0.0, 0.0, 5.0),
), ),
], ],
), ),
margin: EdgeInsets.only(left: 20.0),
), ),
), ),
Container( Checkbox(
child: Checkbox( value: _selectedUsers.contains(userList[index].id),
value: _selectedUsers.contains(userList[index].id), onChanged: ((checked) {
onChanged: ((checked) { setState(() {
setState(() { if (checked!) {
if (checked!) { _selectedUsers.add(userList[index].id!);
_selectedUsers.add(userList[index].id!); } else {
} else { _selectedUsers.remove(userList[index].id);
_selectedUsers.remove(userList[index].id); }
} });
}); }),
}),
),
), ),
], ],
), ),
...@@ -286,7 +284,6 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -286,7 +284,6 @@ class _BodyLayoutState extends State<BodyLayout> {
}); });
}, },
), ),
margin: EdgeInsets.only(bottom: 10.0, left: 5.0, right: 5.0),
); );
} }
...@@ -302,7 +299,6 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -302,7 +299,6 @@ class _BodyLayoutState extends State<BodyLayout> {
} }
void _createDialog(BuildContext context, Set<int> users, bool isGroup) async { void _createDialog(BuildContext context, Set<int> users, bool isGroup) async {
log("_createDialog with users= $users");
if (isGroup) { if (isGroup) {
CubeDialog newDialog = CubeDialog(CubeDialogType.GROUP, occupantsIds: users.toList()); CubeDialog newDialog = CubeDialog(CubeDialogType.GROUP, occupantsIds: users.toList());
List<CubeUser> usersToAdd = users.map((id) => userList.firstWhere((user) => user.id == id)).toList(); List<CubeUser> usersToAdd = users.map((id) => userList.firstWhere((user) => user.id == id)).toList();
...@@ -314,10 +310,15 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -314,10 +310,15 @@ class _BodyLayoutState extends State<BodyLayout> {
} else { } else {
CubeDialog newDialog = CubeDialog(CubeDialogType.PRIVATE, occupantsIds: users.toList()); CubeDialog newDialog = CubeDialog(CubeDialogType.PRIVATE, occupantsIds: users.toList());
createDialog(newDialog).then((createdDialog) { createDialog(newDialog).then((createdDialog) {
Navigator.of(context, rootNavigator: true).pushNamedAndRemoveUntil('chat_dialog', (route) => false, arguments: { platformUtils.isDesktop()
USER_ARG_NAME: currentUser, ? Navigator.push(
DIALOG_ARG_NAME: createdDialog context,
}); MaterialPageRoute(builder: (context) => ChatDialogResizableScreen(currentUser, createdDialog)),
)
: Navigator.push(
context,
MaterialPageRoute(builder: (context) => ChatDialogScreen(currentUser, createdDialog)),
);
}).catchError((error) { }).catchError((error) {
_processCreateDialogError(error); _processCreateDialogError(error);
}); });
......
...@@ -5,13 +5,11 @@ import 'package:flutter/material.dart'; ...@@ -5,13 +5,11 @@ import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:connectycube_sdk/connectycube_sdk.dart'; import 'package:connectycube_sdk/connectycube_sdk.dart';
import '../src/constants/colors_const.dart';
import '../src/utils/app_utils.dart'; import '../src/utils/app_utils.dart';
import 'chat_dialog_resizable_screen.dart'; import 'chat_dialog_resizable_screen.dart';
import 'chat_dialog_screen.dart'; import 'chat_dialog_screen.dart';
import 'create_dialog_flow.dart'; import 'create_dialog_flow.dart';
import 'managers/chat_manager.dart'; import 'managers/chat_manager.dart';
import 'settings_screen.dart';
import 'utils/api_utils.dart'; import 'utils/api_utils.dart';
import 'utils/consts.dart'; import 'utils/consts.dart';
import 'utils/platform_utils.dart'; import 'utils/platform_utils.dart';
...@@ -22,35 +20,15 @@ class SelectDialogScreen extends StatelessWidget { ...@@ -22,35 +20,15 @@ class SelectDialogScreen extends StatelessWidget {
final Function(CubeDialog)? onDialogSelectedCallback; final Function(CubeDialog)? onDialogSelectedCallback;
final CubeDialog? selectedDialog; final CubeDialog? selectedDialog;
SelectDialogScreen(this.selectedDialog, this.onDialogSelectedCallback); const SelectDialogScreen(this.selectedDialog, this.onDialogSelectedCallback, {super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: Text(
'Logged in as ${AppUtils.cubeUser.fullName ?? AppUtils.cubeUser.login ?? AppUtils.cubeUser.email}',
),
actions: <Widget>[
IconButton(
onPressed: () => _openSettings(context),
icon: Icon(
Icons.settings,
color: ColorConst.appBleckColor,
),
),
],
),
body: BodyLayout(AppUtils.cubeUser, selectedDialog, onDialogSelectedCallback), body: BodyLayout(AppUtils.cubeUser, selectedDialog, onDialogSelectedCallback),
); );
} }
_openSettings(BuildContext context) {
showModal(context: context, child: SettingsScreen(AppUtils.cubeUser));
}
} }
class BodyLayout extends StatefulWidget { class BodyLayout extends StatefulWidget {
...@@ -58,7 +36,7 @@ class BodyLayout extends StatefulWidget { ...@@ -58,7 +36,7 @@ class BodyLayout extends StatefulWidget {
final Function(CubeDialog)? onDialogSelectedCallback; final Function(CubeDialog)? onDialogSelectedCallback;
final CubeDialog? selectedDialog; final CubeDialog? selectedDialog;
BodyLayout(this.currentUser, this.selectedDialog, this.onDialogSelectedCallback, {super.key}); const BodyLayout(this.currentUser, this.selectedDialog, this.onDialogSelectedCallback, {super.key});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
...@@ -137,11 +115,9 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -137,11 +115,9 @@ class _BodyLayoutState extends State<BodyLayout> {
if (_isDialogContinues) { if (_isDialogContinues) {
getDialogs().then((dialogs) { getDialogs().then((dialogs) {
_isDialogContinues = false; _isDialogContinues = false;
log("getDialogs: $dialogs", TAG);
setState(() { setState(() {
dialogList.clear(); dialogList.clear();
dialogList.addAll( dialogList.addAll(dialogs?.items.map((dialog) => ListItem(dialog)).toList() ?? []);
dialogs?.items.map((dialog) => ListItem(dialog)).toList() ?? []);
}); });
}).catchError((exception) { }).catchError((exception) {
_processGetDialogError(exception); _processGetDialogError(exception);
...@@ -150,7 +126,7 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -150,7 +126,7 @@ class _BodyLayoutState extends State<BodyLayout> {
if (_isDialogContinues && dialogList.isEmpty) { if (_isDialogContinues && dialogList.isEmpty) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} else if (dialogList.isEmpty) } else if (dialogList.isEmpty)
return const Center( return const Center(
child: Text( child: Text(
'No dialogs yet', 'No dialogs yet',
style: TextStyle(fontSize: 20), style: TextStyle(fontSize: 20),
...@@ -191,8 +167,7 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -191,8 +167,7 @@ class _BodyLayoutState extends State<BodyLayout> {
getDialogAvatar() { getDialogAvatar() {
var dialog = dialogList[index].data; var dialog = dialogList[index].data;
return getDialogAvatarWidget(dialog, 25, return getDialogAvatarWidget(dialog, 25, placeholder: getDialogIcon(), errorWidget: getDialogIcon());
placeholder: getDialogIcon(), errorWidget: getDialogIcon());
} }
return Container( return Container(
...@@ -213,8 +188,7 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -213,8 +188,7 @@ class _BodyLayoutState extends State<BodyLayout> {
children: <Widget>[ children: <Widget>[
Container( Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(dialogList[index].data.name ?? 'Unknown dialog',
'${dialogList[index].data.name ?? 'Unknown dialog'}',
style: TextStyle( style: TextStyle(
color: primaryColor, color: primaryColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
......
...@@ -4,9 +4,14 @@ import 'package:flutter/material.dart'; ...@@ -4,9 +4,14 @@ import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:connectycube_sdk/connectycube_sdk.dart'; import 'package:connectycube_sdk/connectycube_sdk.dart';
import 'package:vmeeting/service/routes/routes_name.dart';
import 'package:vmeeting/src/extension/context_extensions.dart';
import '../src/constants/colors_const.dart'; import '../src/constants/colors_const.dart';
import '../src/controllers/enter_number_cont.dart';
import '../src/utils/app_utils.dart'; import '../src/utils/app_utils.dart';
import '../src/widgets/image_avatar.dart';
import '../src/widgets/textfiled_widgets/auth_text_fild.dart';
import 'managers/push_notifications_manager.dart'; import 'managers/push_notifications_manager.dart';
import 'utils/api_utils.dart'; import 'utils/api_utils.dart';
import 'utils/consts.dart'; import 'utils/consts.dart';
...@@ -57,9 +62,12 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -57,9 +62,12 @@ class _BodyLayoutState extends State<BodyLayout> {
final CubeUser currentUser; final CubeUser currentUser;
var _isUsersContinues = false; var _isUsersContinues = false;
String? _avatarUrl = ""; String? _avatarUrl = "";
final TextEditingController _loginFilter = new TextEditingController(); final TextEditingController _loginFilter = TextEditingController();
final TextEditingController _nameFilter = new TextEditingController(); final TextEditingController _nameFilter = TextEditingController();
final TextEditingController _emailFilter = new TextEditingController(); final _nameFocusNode = FocusNode();
final _loginFocusNode = FocusNode();
final _emileFocusNode = FocusNode();
final TextEditingController _emailFilter = TextEditingController();
String _login = ""; String _login = "";
String _name = ""; String _name = "";
String _email = ""; String _email = "";
...@@ -103,14 +111,16 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -103,14 +111,16 @@ class _BodyLayoutState extends State<BodyLayout> {
body: SingleChildScrollView( body: SingleChildScrollView(
child: Center( child: Center(
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 400), constraints: const BoxConstraints(maxWidth: 400),
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.all(60), padding: const EdgeInsets.all(8),
child: Column( child: Column(
children: [ children: [
_buildAvatarFields(), _buildAvatarFields(),
const SizedBox(height: 30),
_buildTextFields(), _buildTextFields(),
const SizedBox(height: 50),
_buildButtons(), _buildButtons(),
Container( Container(
margin: const EdgeInsets.only(left: 8), margin: const EdgeInsets.only(left: 8),
...@@ -130,21 +140,25 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -130,21 +140,25 @@ class _BodyLayoutState extends State<BodyLayout> {
), ),
); );
} }
Widget buildImage(String? imagaAvatar) {
return Center(
child: AvatarImage(
radius: context.h * 0.08,
imagePath: getPrivateUrlForUid(imagaAvatar),
));
}
Widget _buildAvatarFields() { Widget _buildAvatarFields() {
Widget avatarCircle = getUserAvatarWidget(currentUser, 50);
return Stack( return Stack(
children: <Widget>[ children: <Widget>[
InkWell( InkWell(
splashColor: greyColor2, splashColor: greyColor2,
borderRadius: BorderRadius.circular(45), borderRadius: BorderRadius.circular(45),
onTap: () => _chooseUserImage(), onTap: () => _chooseUserImage(),
child: avatarCircle, child: buildImage(AppUtils.userModel.avatar ?? ""),
), ),
Positioned( Positioned(
top: 55.0, top: 75.0,
right: 35.0, right: 85.0,
child: RawMaterialButton( child: RawMaterialButton(
onPressed: () { onPressed: () {
_chooseUserImage(); _chooseUserImage();
...@@ -185,17 +199,34 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -185,17 +199,34 @@ class _BodyLayoutState extends State<BodyLayout> {
Widget _buildTextFields() { Widget _buildTextFields() {
return Column( return Column(
children: <Widget>[ children: <Widget>[
TextField( AuthTextFild(
controller: _nameFilter, lableName: "Change name",
decoration: const InputDecoration(labelText: 'Change name'), borderRadius: 10,
elevation: 1,
color: Colors.grey.withOpacity(0.2),
type: TextInputType.emailAddress,
focusNode: _nameFocusNode,
textEditingController: _nameFilter,
), ),
TextField( const SizedBox(height: 10),
controller: _loginFilter, AuthTextFild(
decoration: const InputDecoration(labelText: 'Change login'), lableName: "Change login",
borderRadius: 10,
elevation: 1,
color: Colors.grey.withOpacity(0.2),
type: TextInputType.emailAddress,
focusNode: _loginFocusNode,
textEditingController: _loginFilter,
), ),
TextField( const SizedBox(height: 10),
controller: _emailFilter, AuthTextFild(
decoration: const InputDecoration(labelText: 'Change e-mail'), lableName: "Change e-mail",
borderRadius: 10,
elevation: 1,
color: Colors.grey.withOpacity(0.2),
type: TextInputType.emailAddress,
focusNode: _emileFocusNode,
textEditingController: _emailFilter,
), ),
], ],
); );
...@@ -218,20 +249,6 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -218,20 +249,6 @@ class _BodyLayoutState extends State<BodyLayout> {
const SizedBox( const SizedBox(
height: 6, height: 6,
), ),
OutlinedButton.icon(
style: OutlinedButton.styleFrom(
backgroundColor: ColorConst.appMainColor,
minimumSize: const Size(160, 36),
),
icon: const Icon(
Icons.logout,
),
label: const Text('Logout'),
onPressed: _logout,
),
const SizedBox(
height: 6,
),
OutlinedButton.icon( OutlinedButton.icon(
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
foregroundColor: Colors.red.shade300, foregroundColor: Colors.red.shade300,
...@@ -252,17 +269,11 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -252,17 +269,11 @@ class _BodyLayoutState extends State<BodyLayout> {
} }
void _updateUser() { void _updateUser() {
print( if (_login.isEmpty && _name.isEmpty && _avatarUrl!.isEmpty && _email.isEmpty) {
'_updateUser user with login: $_login, name: $_name, e-mail: $_email');
if (_login.isEmpty &&
_name.isEmpty &&
_avatarUrl!.isEmpty &&
_email.isEmpty) {
Fluttertoast.showToast(msg: 'Nothing to save'); Fluttertoast.showToast(msg: 'Nothing to save');
return; return;
} }
var userToUpdate = CubeUser()..id = currentUser.id; var userToUpdate = CubeUser()..id = currentUser.id;
if (_name.isNotEmpty) userToUpdate.fullName = _name; if (_name.isNotEmpty) userToUpdate.fullName = _name;
if (_login.isNotEmpty) userToUpdate.login = _login; if (_login.isNotEmpty) userToUpdate.login = _login;
if (_email.isNotEmpty) userToUpdate.email = _email; if (_email.isNotEmpty) userToUpdate.email = _email;
...@@ -271,7 +282,7 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -271,7 +282,7 @@ class _BodyLayoutState extends State<BodyLayout> {
_isUsersContinues = true; _isUsersContinues = true;
}); });
updateUser(userToUpdate).then((user) { updateUser(userToUpdate).then((user) {
SharedPrefs.instance.updateUser(user); // SharedPrefs.instance.updateUser(user);
Fluttertoast.showToast(msg: 'Success'); Fluttertoast.showToast(msg: 'Success');
setState(() { setState(() {
_isUsersContinues = false; _isUsersContinues = false;
...@@ -310,8 +321,7 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -310,8 +321,7 @@ class _BodyLayoutState extends State<BodyLayout> {
).whenComplete(() { ).whenComplete(() {
CubeChatConnection.instance.destroy(); CubeChatConnection.instance.destroy();
PushNotificationsManager.instance.unsubscribe(); PushNotificationsManager.instance.unsubscribe();
FirebaseAuth.instance.currentUser FirebaseAuth.instance.currentUser?.unlink(PhoneAuthProvider.PROVIDER_ID);
?.unlink(PhoneAuthProvider.PROVIDER_ID);
SharedPrefs.instance.deleteUser(); SharedPrefs.instance.deleteUser();
Navigator.pop(context); // cancel current screen Navigator.pop(context); // cancel current screen
_navigateToLoginScreen(context); _navigateToLoginScreen(context);
...@@ -325,7 +335,6 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -325,7 +335,6 @@ class _BodyLayoutState extends State<BodyLayout> {
} }
void _deleteUserPressed() { void _deleteUserPressed() {
print('_deleteUserPressed ${_login.isNotEmpty ? _login : _email}');
_userDelete(); _userDelete();
} }
...@@ -334,24 +343,22 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -334,24 +343,22 @@ class _BodyLayoutState extends State<BodyLayout> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text("Delete user"), title: const Text("Delete user"),
content: Text("Are you sure you want to delete current user?"), content: const Text("Are you sure you want to delete current user?"),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("CANCEL"), child: const Text("CANCEL"),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
TextButton( TextButton(
child: Text("OK"), child: const Text("OK"),
onPressed: () async { onPressed: () async {
CubeChatConnection.instance.destroy(); CubeChatConnection.instance.destroy();
await SharedPrefs.instance.deleteUser();
deleteUser(currentUser.id!).then( deleteUser(currentUser.id!).then(
(voidValue) { (voidValue) {
Navigator.pop(context); // cancel current Dialog Navigator.pushReplacementNamed(context, MainRoutes.sign_in_page);
}, },
).catchError( ).catchError(
(onError) { (onError) {
...@@ -359,7 +366,6 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -359,7 +366,6 @@ class _BodyLayoutState extends State<BodyLayout> {
}, },
).whenComplete(() async { ).whenComplete(() async {
await PushNotificationsManager.instance.unsubscribe(); await PushNotificationsManager.instance.unsubscribe();
Navigator.pop(context); // cancel current screen
_navigateToLoginScreen(context); _navigateToLoginScreen(context);
}); });
}, },
...@@ -371,7 +377,8 @@ class _BodyLayoutState extends State<BodyLayout> { ...@@ -371,7 +377,8 @@ class _BodyLayoutState extends State<BodyLayout> {
} }
_navigateToLoginScreen(BuildContext context) { _navigateToLoginScreen(BuildContext context) {
Navigator.pushNamedAndRemoveUntil(context, 'login', (route) => false); SharedPrefs.instance.deleteUser();
Navigator.pushReplacementNamed(context, MainRoutes.sign_in_page);
} }
void _processUpdateUserError(exception) { void _processUpdateUserError(exception) {
......
...@@ -65,7 +65,7 @@ Widget getMessageStateWidget(MessageState? state) { ...@@ -65,7 +65,7 @@ Widget getMessageStateWidget(MessageState? state) {
switch (state) { switch (state) {
case MessageState.read: case MessageState.read:
result = Stack(children: <Widget>[ result = const Stack(children: <Widget>[
Icon( Icon(
Icons.check_rounded, Icons.check_rounded,
size: 15.0, size: 15.0,
......
...@@ -82,6 +82,17 @@ class _DrawerMenueState extends State<DrawerMenue> { ...@@ -82,6 +82,17 @@ class _DrawerMenueState extends State<DrawerMenue> {
Navigator.pushNamed(context, MainRoutes.reset_password_page); Navigator.pushNamed(context, MainRoutes.reset_password_page);
}, },
), ),
ListTile(
leading: Icon(Icons.settings, color: ColorConst.appBleckColor),
title: const SmallText(text: "Settings",size: 16),
trailing: Icon(Icons.navigate_next,
color: ColorConst.appBleckColor,
size: 30,
),
onTap: () async {
Navigator.pushNamed(context, MainRoutes.setting_screen);
},
),
const Spacer(), const Spacer(),
ListTile( ListTile(
leading: Icon(Icons.login, color: ColorConst.appRedColor), leading: Icon(Icons.login, color: ColorConst.appRedColor),
......
...@@ -34,7 +34,7 @@ class _MainPageState extends State<MainPage> { ...@@ -34,7 +34,7 @@ class _MainPageState extends State<MainPage> {
], ],
child: HomePage(controller: widget.controller), child: HomePage(controller: widget.controller),
), ),
SelectDialogScreen(null, null), SelectDialogScreen(null,null),
ProfilePage(controller: widget.controller) ProfilePage(controller: widget.controller)
]; ];
......
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