From b385dccefd34e614708d999895f2a639f9908094 Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Wed, 6 Apr 2022 11:42:52 +0300 Subject: [PATCH] CMA #67 & #65 fixed --- lib/api/client/branch_api_client.dart | 4 +- lib/pages/dashboard/dashboard_page.dart | 7 +-- lib/pages/location/pick_location_page.dart | 4 +- lib/pages/settings/define_branch_page.dart | 18 ++++-- lib/pages/user/edit_account_page.dart | 68 +++++++++++----------- pubspec.yaml | 3 +- 6 files changed, 57 insertions(+), 47 deletions(-) diff --git a/lib/api/client/branch_api_client.dart b/lib/api/client/branch_api_client.dart index a56e93f..a5521ba 100644 --- a/lib/api/client/branch_api_client.dart +++ b/lib/api/client/branch_api_client.dart @@ -32,8 +32,8 @@ class BranchApiClent { "branchDescription": branchDescription, "cityID": cityId, "address": address, - "latitude": latitude, - "longitude": longitude, + "latitude": latitude.substring(0,9)??0, + "longitude": longitude.substring(0,9)??0, "isActive": true }; String t = AppState().getUser.data!.accessToken ?? ""; diff --git a/lib/pages/dashboard/dashboard_page.dart b/lib/pages/dashboard/dashboard_page.dart index 0e54543..c6d3eac 100644 --- a/lib/pages/dashboard/dashboard_page.dart +++ b/lib/pages/dashboard/dashboard_page.dart @@ -122,7 +122,7 @@ class _DashboardPageState extends State { if (response.messageStatus == 1) { Utils.showToast("Image is Deleted"); setState(() { - AppState().getUser.data!.userInfo!.userImageUrl=response.data; + AppState().getUser.data!.userInfo!.userImageUrl = response.data; }); } Utils.hideLoading(context); @@ -272,7 +272,7 @@ class _DashboardPageState extends State { Navigator.pop(context); if (response.messageStatus == 1) { Utils.showToast("Image is uploaded"); - AppState().getUser.data!.userInfo!.userImageUrl=response.data; + AppState().getUser.data!.userInfo!.userImageUrl = response.data; } else { Utils.showToast(response.message ?? ""); } @@ -302,7 +302,7 @@ class _DashboardPageState extends State { Navigator.pop(context); if (response.messageStatus == 1) { Utils.showToast("Image is uploaded"); - AppState().getUser.data!.userInfo!.userImageUrl=response.data; + AppState().getUser.data!.userInfo!.userImageUrl = response.data; } else { Utils.showToast(response.message ?? ""); } @@ -311,6 +311,5 @@ class _DashboardPageState extends State { imagePicked = pickedImageFile; }); } - } } diff --git a/lib/pages/location/pick_location_page.dart b/lib/pages/location/pick_location_page.dart index 933d4f9..a15862d 100644 --- a/lib/pages/location/pick_location_page.dart +++ b/lib/pages/location/pick_location_page.dart @@ -109,7 +109,9 @@ class _PickLocationPageState extends State { latitude = _position.target.latitude; longitude = _position.target.longitude; List placemarks = await placemarkFromCoordinates(latitude, longitude); - _counter.value = (placemarks.first.name) ?? "" + " " + (placemarks.first.street ?? "") + " " + (placemarks.first.country ?? ""); + _counter.value='${placemarks.first.street}, ${placemarks.first.subLocality}, ${placemarks.first.locality}, ${placemarks.first.postalCode}, ${placemarks.first.country}'; + print("Address121: "+_counter.value); + // _counter.value = (placemarks.first.name) ?? "" + " " + (placemarks.first.street ?? "") + " " + (placemarks.first.country ?? ""); } void _getUserLocation() async { diff --git a/lib/pages/settings/define_branch_page.dart b/lib/pages/settings/define_branch_page.dart index b078fcf..ab0b8f9 100644 --- a/lib/pages/settings/define_branch_page.dart +++ b/lib/pages/settings/define_branch_page.dart @@ -45,6 +45,10 @@ class _DefineBranchPageState extends State { } fetchCites() async { + print("objectfffffff"); + citiesDropList.clear(); + cities = null; + cityId = -1; cities = await UserApiClent().getAllCites(countryId.toString()); setState(() { cities!.data?.forEach((element) { @@ -84,12 +88,14 @@ class _DefineBranchPageState extends State { 12.height, if (countryId != -1) cities != null - ? DropdownField((DropValue value) { - setState(() { - // countryCode = value.subValue; - cityId = value.id; - }); - }, list: citiesDropList, hint: "Chosse City") + ? citiesDropList.length == 0 + ? Text("No City Available for this country") + : DropdownField((DropValue value) { + setState(() { + // countryCode = value.subValue; + cityId = value.id; + }); + }, list: citiesDropList, hint: "Chosse City") : CircularProgressIndicator(), 12.height, if (cityId != -1) diff --git a/lib/pages/user/edit_account_page.dart b/lib/pages/user/edit_account_page.dart index be42da7..178620b 100644 --- a/lib/pages/user/edit_account_page.dart +++ b/lib/pages/user/edit_account_page.dart @@ -1,5 +1,3 @@ - - import 'dart:convert'; import 'package:car_provider_app/api/client/user_api_client.dart'; @@ -19,8 +17,6 @@ import 'package:car_provider_app/widgets/dialog/otp_dialog.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; - - class EditAccountPage extends StatefulWidget { @override State createState() => _EditAccountPageState(); @@ -44,7 +40,7 @@ class _EditAccountPageState extends State { ListTile( leading: SvgPicture.asset("assets/images/ic_lock.svg"), title: "Change Password".toText12(), - onTap: (){ + onTap: () { navigateWithName(context, AppRoutes.changePassword); }, ), @@ -56,46 +52,55 @@ class _EditAccountPageState extends State { "Change Mobile".toText12(), "Verify".toText12(), RaisedButton( - onPressed: (){ + onPressed: () { navigateWithName(context, AppRoutes.changeMobilePage); }, - child: Text("Change", - style: TextStyle(fontSize: 14, - fontWeight: FontWeight.w600,),),color:Colors.blue, + child: Text( + "Change", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + color: Colors.blue, textColor: Colors.white, - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8) - ) + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8)) ], ), 20.height, Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Icon(Icons.email, color: Colors.blue,), + Icon( + Icons.email, + color: Colors.blue, + ), "Change Email".toText12(), - InkWell( - child:((AppState().getUser.data!.userInfo!.isEmailVerified??false)?"Verified" :"Verify").toText12(), - onTap: - (AppState().getUser.data!.userInfo!.isEmailVerified??false) ? - null - :(){ - verifyEmail(context); - }, + InkWell( + child: ((AppState().getUser.data!.userInfo!.isEmailVerified ?? false) ? "Verified" : "Verify").toText12(), + onTap: (AppState().getUser.data!.userInfo!.isEmailVerified ?? false) + ? null + : () { + verifyEmail(context); + }, ), RaisedButton( - onPressed: (){ + onPressed: () { navigateWithName(context, AppRoutes.changeEmailPage); }, - child: Text("Change", - style: TextStyle(fontSize: 14, - fontWeight: FontWeight.w600,),),color:Colors.blue, + child: Text( + "Change", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + color: Colors.blue, textColor: Colors.white, - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8) - ) + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8)) ], ) - // ListTile( // leading: SvgPicture.asset("assets/images/ic_mobile.svg"), // title: "Change Mobile".toText12(), @@ -128,11 +133,10 @@ class _EditAccountPageState extends State { MResponse otpCompare = await UserApiClent().EmailVerifyOTPVerify(otpRequest.data!.userToken ?? "", code); Utils.hideLoading(context); if (otpCompare.messageStatus == 1) { - AppState().getUser.data!.userInfo!.isEmailVerified=true; - setState(() { - }); + AppState().getUser.data!.userInfo!.isEmailVerified = true; + setState(() {}); Utils.showToast("Email is verified successfully"); - // Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route route) => false); + // Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route route) => false); // showMDialog( // context, // child: MessageDialog( @@ -151,6 +155,4 @@ class _EditAccountPageState extends State { Utils.showToast(otpRequest.message ?? ""); } } - - } diff --git a/pubspec.yaml b/pubspec.yaml index 38a1620..36194f0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,6 +45,7 @@ dependencies: fluttertoast: ^8.0.8 shared_preferences: ^2.0.6 file_picker: ^4.4.0 + image_picker: ^0.8.4+4 @@ -52,7 +53,7 @@ dependencies: google_maps_flutter: ^2.1.1 geolocator: any geocoding: ^2.0.2 - image_picker: ^0.8.4+4 +