From 8fa46703921548cd7392cd6f09c12aa101298798 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Tue, 13 Sep 2022 14:22:19 +0300 Subject: [PATCH 1/2] fix issues --- lib/ui/landing/dashboard_screen.dart | 7 ++- lib/ui/landing/widget/app_drawer.dart | 7 ++- lib/ui/my_team/my_team.dart | 2 - lib/ui/profile/add_update_family_member.dart | 34 ++---------- lib/ui/profile/family_members.dart | 54 +++++++++++--------- lib/ui/profile/widgets/profile_panel.dart | 8 ++- 6 files changed, 52 insertions(+), 60 deletions(-) diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 3f4e5f2..cefe40f 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -71,10 +71,15 @@ class _DashboardScreenState extends State { return Row( mainAxisSize: MainAxisSize.min, children: [ - Image.memory( + Image.memory( Utils.getPostBytes( AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", ), + errorBuilder: (BuildContext context, error, stackTrace) { + return SvgPicture.asset( + "assets/images/user.svg", height: 34, width: 34, + ); + }, width: 34, height: 34, fit: BoxFit.cover, diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index 7ea9748..2971b24 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -43,7 +43,12 @@ class _AppDrawerState extends State { ).paddingOnly(left: 4, right: 14), Row( children: [ - CircleAvatar( + AppState().memberInformationList!.eMPLOYEEIMAGE == null + ? SvgPicture.asset( + "assets/images/user.svg", + height: 52, + width: 52,) + : CircleAvatar( radius: 52 / 2, backgroundImage: MemoryImage(Utils.getPostBytes(AppState().memberInformationList!.eMPLOYEEIMAGE)), backgroundColor: Colors.black, diff --git a/lib/ui/my_team/my_team.dart b/lib/ui/my_team/my_team.dart index c9cc2c7..2187960 100644 --- a/lib/ui/my_team/my_team.dart +++ b/lib/ui/my_team/my_team.dart @@ -93,7 +93,6 @@ class _MyTeamState extends State { enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, contentPadding: EdgeInsets.zero, - //contentPadding: EdgeInsets.fromLTRB(14, 15, 10, 15), hintText: LocaleKeys.searchBy.tr() + " $dropdownValue", hintStyle: const TextStyle( fontSize: 14.0, @@ -111,7 +110,6 @@ class _MyTeamState extends State { _textEditingController!.text.isNotEmpty && getEmployeeSListOnSearch.isEmpty ? Utils.getNoDataWidget(context).paddingOnly(top: 120) : ListView.separated( - //scrollDirection: Axis.vertical, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.only(top: 12), diff --git a/lib/ui/profile/add_update_family_member.dart b/lib/ui/profile/add_update_family_member.dart index 78d99de..fa01e30 100644 --- a/lib/ui/profile/add_update_family_member.dart +++ b/lib/ui/profile/add_update_family_member.dart @@ -135,9 +135,8 @@ class _AddUpdateFamilyMemberState extends State { : args['flag'] == 2 ? Column( children: [ - getContactDetailsList!.isEmpty - ? LocaleKeys.noDataAvailable.tr().toText16().center - : ListView(physics: const BouncingScrollPhysics(), padding: const EdgeInsets.all(21), children: [ + // getContactDetailsList!.isEmpty + ListView(physics: const BouncingScrollPhysics(), padding: const EdgeInsets.all(21), children: [ ListView.separated( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, @@ -355,34 +354,7 @@ class _AddUpdateFamilyMemberState extends State { return time; } - Widget footer() { - return Container( - color: MyColors.white, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - color: MyColors.gradiantEndColor, - margin: EdgeInsets.only(bottom: 20, top: 20), - padding: EdgeInsets.only(left: 50, right: 50), - child: TextButton( - style: TextButton.styleFrom( - primary: MyColors.white, - onSurface: MyColors.white, - backgroundColor: MyColors.gradiantEndColor, - ), - onPressed: () { - submitUpdateForm(); - }, - child: Text( - LocaleKeys.next.tr(), - style: TextStyle(fontStyle: FontStyle.normal, fontSize: 16, color: Colors.white, fontWeight: FontWeight.w600), - ), - )), - ], - ), - ); - } + void submitUpdateForm() async { try { diff --git a/lib/ui/profile/family_members.dart b/lib/ui/profile/family_members.dart index 70c907c..00f7e11 100644 --- a/lib/ui/profile/family_members.dart +++ b/lib/ui/profile/family_members.dart @@ -1,4 +1,5 @@ import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/profile_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; @@ -33,8 +34,15 @@ class _FamilyMembersState extends State { @override void initState() { super.initState(); - List menuData = Provider.of(context, listen: false).getMenuEntriesList!; - menuEntries = menuData.where((GetMenuEntriesList e) => e.requestType == 'CONTACT').toList()[0]; + List menuData = Provider.of(context, listen: false).getMenuEntriesList!; + + List arr = menuData.where((GetMenuEntriesList e) => e.requestType == 'CONTACT').toList(); + if(arr.isNotEmpty){ + menuEntries = arr[0]; + }else{ + menuEntries = new GetMenuEntriesList(); + } + getEmployeeContacts(); } @@ -57,11 +65,11 @@ class _FamilyMembersState extends State { title: LocaleKeys.profile_familyDetails.tr(), ), backgroundColor: MyColors.backgroundColor, - body: Column( - children: [ + body: getEmployeeContactsList.isEmpty ? Utils.getNoDataWidget(context) + : Column( + children: [ Expanded( - child: getEmployeeContactsList.length != 0 - ? ListView.separated( + child: ListView.separated( padding: const EdgeInsets.all(21), separatorBuilder: (cxt, index) => 12.height, itemCount: getEmployeeContactsList.length, @@ -82,20 +90,17 @@ class _FamilyMembersState extends State { text: TextSpan( children: [ WidgetSpan( - child: menuEntries.updateButton == 'Y' - ? Icon(Icons.edit, size: 14, color: MyColors.grey67Color, - ).onPress(() async { - relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); - showUpdateAlertDialog(context, relationId!.toInt(), 2, LocaleKeys.update.tr()); - }) - :Icon(Icons.edit, size: 14, color: MyColors.lightGreyColor, - ), + child: Icon(Icons.edit, size: 14, color: menuEntries.updateButton == 'Y' ? MyColors.grey67Color : MyColors.lightGreyColor,) ), - TextSpan( + TextSpan( text: LocaleKeys.update.tr(), - style: menuEntries.updateButton == 'Y'? TextStyle(color: MyColors.grey67Color, fontSize: 12, letterSpacing: -0.36, fontWeight: FontWeight.w600) - :TextStyle(color: MyColors.lightGreyColor, fontSize: 12, letterSpacing: -0.36, fontWeight: FontWeight.w600), - ), + style:TextStyle(color: menuEntries.updateButton == 'Y' ? MyColors.grey67Color : MyColors.lightGreyColor, fontSize: 12, letterSpacing: -0.36, fontWeight: FontWeight.w600), + recognizer: TapGestureRecognizer() + ..onTap = () async { + relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); + menuEntries.updateButton == 'Y'? showUpdateAlertDialog(context, relationId!.toInt(), 2, LocaleKeys.update.tr()):null; + } + ) ], ), ), @@ -119,13 +124,14 @@ class _FamilyMembersState extends State { ), ], ).objectContainerView(disablePadding: true); - }) - : Container(), + }), ), - DefaultButton(LocaleKeys.addNewFamilyMember.tr(), () async { + DefaultButton(LocaleKeys.addNewFamilyMember.tr(), + menuEntries.updateButton == 'Y' + ? () async { Navigator.pushNamed(context, AppRoutes.addUpdateFamilyMember, arguments: {"relationID": relationId, "flag": 1, "actionType": "ADD"}); - ProfileScreen(); - }).insideContainer, + // ProfileScreen(); + } : null).insideContainer, ], )); } @@ -147,7 +153,7 @@ class _FamilyMembersState extends State { Navigator.pushNamed( context, AppRoutes.addUpdateFamilyMember, - arguments: {"relationID": relationId, "flag": flag, "actionType": "UPDATE"}, + arguments: {"relationID": relationId, "flag": 2, "actionType": "UPDATE"}, ); }, ); diff --git a/lib/ui/profile/widgets/profile_panel.dart b/lib/ui/profile/widgets/profile_panel.dart index da3e02c..2678599 100644 --- a/lib/ui/profile/widgets/profile_panel.dart +++ b/lib/ui/profile/widgets/profile_panel.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/ui/profile/widgets/profile_info.dart'; @@ -41,7 +42,12 @@ class ProfilePanel extends StatelessWidget { ); } - Widget profileImage() => CircleAvatar( + Widget profileImage() => memberInformationList.eMPLOYEEIMAGE == null + ? SvgPicture.asset( + "assets/images/user.svg", + height: 68, + width: 68,) + : CircleAvatar( radius: 68, backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)), backgroundColor: Colors.black, From c2142c99977e87d0813d900b514e5a32957c690d Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 14 Sep 2022 10:36:08 +0300 Subject: [PATCH 2/2] fix issues --- lib/ui/profile/family_members.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ui/profile/family_members.dart b/lib/ui/profile/family_members.dart index 00f7e11..0a0bb0c 100644 --- a/lib/ui/profile/family_members.dart +++ b/lib/ui/profile/family_members.dart @@ -65,11 +65,11 @@ class _FamilyMembersState extends State { title: LocaleKeys.profile_familyDetails.tr(), ), backgroundColor: MyColors.backgroundColor, - body: getEmployeeContactsList.isEmpty ? Utils.getNoDataWidget(context) - : Column( + body: Column( children: [ Expanded( - child: ListView.separated( + child: getEmployeeContactsList.isEmpty ? Utils.getNoDataWidget(context) + : ListView.separated( padding: const EdgeInsets.all(21), separatorBuilder: (cxt, index) => 12.height, itemCount: getEmployeeContactsList.length,