Merge remote-tracking branch 'origin/main_design2.0' into main_design2.0

main_design2.0
zaid_daoud 2 years ago
commit db3053bc3a

@ -46,6 +46,11 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data

2
ios/.gitignore vendored

@ -22,7 +22,7 @@ Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutterassets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*

@ -25,6 +25,7 @@ class URLs {
// static get login => "$_baseUrl/MobileAuth/LoginIntegration"; // mobile login
static get register => "$_baseUrl/handle/create/user"; // post
static get updateProfile => "$_baseUrl/update/user/profile"; // post
static get updateProfileImage => "$_baseUrl/Account/ChangeImageEmployee"; // post
static get getSites => "$_baseUrl/Customer/GetCustomers"; // get
static get getSitesAutoComplete => "$_baseUrl/Customer/GetCustomersAutoComplete"; // get

@ -5,6 +5,7 @@ import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/models/all_requests_and_count_model.dart';
import 'package:test_sa/models/enums/user_types.dart';
import '../../../models/search_all_requests_model.dart';
@ -175,9 +176,10 @@ class AllRequestsProvider extends ChangeNotifier {
if (openRequests == null) notifyListeners();
Response response;
try {
bool isEngineer = ApiManager.instance.user.type == UsersTypes.engineer;
Map<String, dynamic> body = {
"typeTransaction": [1, 2, 3, 4],
"statusTransaction": [1],
"statusTransaction": [isEngineer ? 2 : 1],
"priority": [],
"displayData": []
};

@ -113,16 +113,24 @@ class AssetProvider extends ChangeNotifier {
@required int hospitalId,
String serialNumber,
String number,
bool addPagination = true,
}) async {
Response response;
try {
response = await ApiManager.instance.post(URLs.getAssets, body: {
"pageSize": pageItemNumber,
"pageNumber": devices.length ~/ pageItemNumber + 1,
Map<String, dynamic> body = {
// "pageSize": pageItemNumber,
// "pageNumber": devices.length ~/ pageItemNumber + 1,
// "siteId": hospitalId,
if (serialNumber?.isEmpty == false) "assetSerialNumber": serialNumber,
if (number?.isEmpty == false) "assetNo": number,
});
};
if (addPagination) {
body["pageSize"] = pageItemNumber;
body["pageNumber"] = devices.length ~/ pageItemNumber + 1;
}
response = await ApiManager.instance.post(URLs.getAssets, body: body);
// response = await get(
// Uri.parse("$host${URLs.getEquipment}?siteId=$hospitalId"
// "${serialNumber?.isEmpty == false ? "&assetSerialNumber=$serialNumber" :""}"

@ -186,6 +186,7 @@ class RegularVisitsProvider extends ChangeNotifier {
body["id"] = visit.id;
body["assetId"] = visit.deviceId;
body["ppmScheduleId"] = visit.ppmScheduleId;
body["assignedEmployeeId"] = user.userName;
// body["token"] = user.token;
// body["vChecklists"]?.addAll({});
// body["vCalibrationTools"]?.addAll({"visitId": visit.id,});

@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
@ -19,7 +20,11 @@ class UserProvider extends ChangeNotifier {
// contain user data
// when user not login or register _user = null
User _user;
User get user => _user;
File profileImage;
set user(User user) {
_user = user;
ApiManager.instance.user = user;
@ -29,7 +34,9 @@ class UserProvider extends ChangeNotifier {
// when login or register in-process _login = true
// when login or register is done or not start = false
bool _loading = false;
bool get isLoading => _loading;
set isLoading(bool isLoading) {
_loading = isLoading;
notifyListeners();
@ -53,6 +60,7 @@ class UserProvider extends ChangeNotifier {
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
_user = User.fromJson(jsonDecode(response.body));
_user.profilePhotoName = URLs.getFileUrl(_user.profilePhotoName);
ApiManager.instance.user = _user;
notifyListeners();
return response.statusCode;
@ -106,51 +114,69 @@ class UserProvider extends ChangeNotifier {
return response.statusCode;
}
/// sign up with User object;
/// return -2 if request in progress
/// return -1 if error happen when sending request
/// return state code if request complete may be 200, 404 or 403
/// for more details about state codes check http state manager
/// lib\controllers\http_status_manger\http_status_manger.dart
// Future<int> updateProfile({
// @required String host,
// @required User user,
// }) async {
// if (_loading == true) return -2;
// _loading = true;
// notifyListeners();
// Response response;
//
// Map<String, dynamic> jsonObject = {};
// jsonObject["uid"] = user.id;
// jsonObject["token"] = user.token;
// if (user.departmentId != _user.departmentId) jsonObject["department"] = user.departmentId;
// // if (user.whatsApp != _user.whatsApp) jsonObject["whatsapp"] = user.whatsApp;
// if (user.phoneNumber != _user.phoneNumber) jsonObject["phone"] = user.phoneNumber;
// try {
// response = response = await ApiManager.instance.post(
// URLs.login,
// body: jsonObject,
// );
// } catch (error) {
// _loading = false;
// notifyListeners();
// return -1;
// }
//
// _loading = false;
// notifyListeners();
//
// if (response.statusCode >= 200 && response.statusCode < 300) {
// // client's request was successfully received
// _user = User.fromJson(jsonDecode(utf8.decode(response.bodyBytes))[0]);
// _user.clientId = user.clientId;
// _user.clientName = user.clientName;
// _user.departmentName = user.departmentName;
// _user.departmentId = user.departmentId;
// notifyListeners();
// return response.statusCode;
// }
// return response.statusCode;
// }
Future<int> uploadProfileImage(String userId, File image) async {
if (_loading == true) return -2;
_loading = true;
notifyListeners();
Response response;
try {
Map<String, dynamic> body = {
"userId": userId,
"imageEmployee": "${image.path.split("/").last}|${base64Encode(image.readAsBytesSync())}",
};
response = await ApiManager.instance.post(URLs.updateProfileImage, body: body);
if (response.statusCode >= 200 && response.statusCode < 300) {
profileImage = image;
}
_loading = false;
notifyListeners();
return response.statusCode;
} catch (error) {
_loading = false;
notifyListeners();
return -1;
}
}
// Future<int> updateProfile({
// @required String host,
// @required User user,
// }) async {
// if (_loading == true) return -2;
// _loading = true;
// notifyListeners();
// Response response;
//
// Map<String, dynamic> jsonObject = {};
// jsonObject["uid"] = user.id;
// jsonObject["token"] = user.token;
// if (user.departmentId != _user.departmentId) jsonObject["department"] = user.departmentId;
// // if (user.whatsApp != _user.whatsApp) jsonObject["whatsapp"] = user.whatsApp;
// if (user.phoneNumber != _user.phoneNumber) jsonObject["phone"] = user.phoneNumber;
// try {
// response = response = await ApiManager.instance.post(
// URLs.login,
// body: jsonObject,
// );
// } catch (error) {
// _loading = false;
// notifyListeners();
// return -1;
// }
//
// _loading = false;
// notifyListeners();
//
// if (response.statusCode >= 200 && response.statusCode < 300) {
// // client's request was successfully received
// _user = User.fromJson(jsonDecode(utf8.decode(response.bodyBytes))[0]);
// _user.clientId = user.clientId;
// _user.clientName = user.clientName;
// _user.departmentName = user.departmentName;
// _user.departmentId = user.departmentId;
// notifyListeners();
// return response.statusCode;
// }
// return response.statusCode;
// }
}

@ -115,7 +115,9 @@ class Asset {
}
comment = json['comment'];
tagCode = json['tagCode'];
assetPhoto = json['assetPhoto'];
}
num id;
String assetSerialNo;
String systemID;
@ -165,6 +167,7 @@ class Asset {
String comment;
String tagCode;
String assetPhoto;
Asset copyWith({
num id,
String assetSerialNo,
@ -267,6 +270,7 @@ class Asset {
tagCode: tagCode ?? this.tagCode,
assetPhoto: assetPhoto ?? this.assetPhoto,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;

@ -29,7 +29,7 @@ class Hospital {
}
Map<String, dynamic> toMap() {
return {'id': id, 'customerCode': customerCode, 'custName': name, "buildings": buildings};
return {'id': id, 'customerCode': customerCode, 'custName': name, "buildings": []};
}
}

@ -21,9 +21,11 @@ class Building extends Base {
});
}
}
num id;
num value;
List<Floor> floors;
Building copyWith({
num id,
String name,
@ -36,14 +38,18 @@ class Building extends Base {
value: value ?? this.value,
floors: floors ?? this.floors,
);
Map<String, dynamic> toJson() {
Map<String, dynamic> toJson({bool addFloor = true}) {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
map['value'] = value;
if (floors != null) {
map['floors'] = floors.map((v) => v.toJson()).toList();
if(addFloor) {
if (floors != null) {
map['floors'] = floors.map((v) => v.toJson()).toList();
}
}
return map;
}
}

@ -21,9 +21,11 @@ class Floor extends Base {
});
}
}
num id;
num value;
List<Department> departments;
Floor copyWith({
num id,
String name,
@ -36,14 +38,16 @@ class Floor extends Base {
value: value ?? this.value,
departments: departments ?? this.departments,
);
Map<String, dynamic> toJson() {
Map<String, dynamic> toJson({bool addDepartments = true}) {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
map['value'] = value;
if (departments != null) {
map['departments'] = departments.map((v) => v.toJson()).toList();
}
return map;
if (addDepartments)
if (departments != null) {
map['departments'] = departments.map((v) => v.toJson()).toList();
}
return map;
}
}

@ -157,13 +157,13 @@ class GasRefillModel {
map['nurseSignature'] = nurseSignature;
map['workingHours'] = workingHours;
if (site != null) {
map['site'] = site.toJson();
map['site'] = site.toJson(addBuildings: false);
}
if (building != null) {
map['building'] = building.toJson();
map['building'] = building.toJson(addFloor: false);
}
if (floor != null) {
map['floor'] = floor.toJson();
map['floor'] = floor.toJson(addDepartments: false);
}
if (department != null) {
map['department'] = department.toJson();

@ -20,9 +20,11 @@ class Site extends Base {
});
}
}
num id;
String custName;
List<Building> buildings;
Site copyWith({
num id,
String custName,
@ -33,13 +35,19 @@ class Site extends Base {
custName: custName ?? this.custName,
buildings: buildings ?? this.buildings,
);
Map<String, dynamic> toJson() {
Map<String, dynamic> toJson({bool addBuildings = true}) {
final map = <String, dynamic>{};
map['id'] = id;
map['custName'] = custName;
if (buildings != null) {
map['buildings'] = buildings.map((v) => v.toJson()).toList();
if (addBuildings) {
if (buildings != null) {
map['buildings'] = buildings.map((v) => v.toJson()).toList();
}
} else {
map['buildings'] = [];
}
return map;
}
}

@ -283,8 +283,8 @@ class ServiceReport {
if (reason != null) {
map['reason'] = reason.toJson();
}
map['startofWorkTime'] = startofWorkTime;
map['endofWorkTime'] = endofWorkTime;
map['startofWorkTime'] = timer.startAt.toString();
map['endofWorkTime'] = timer.endAt.toString();
map['workingHours'] = workingHours;
map['travelingHours'] = travelingHours;
map['travelingExpenses'] = travelingExpenses;

@ -27,6 +27,7 @@ class User {
String securityStamp;
String concurrencyStamp;
String phoneNumber;
String extensionNo;
bool phoneNumberConfirmed;
bool twoFactorEnabled;
dynamic lockoutEnd;
@ -139,6 +140,7 @@ class User {
map['securityStamp'] = securityStamp;
map['concurrencyStamp'] = concurrencyStamp;
map['phoneNumber'] = phoneNumber;
map['extensionNo'] = extensionNo;
map['phoneNumberConfirmed'] = phoneNumberConfirmed;
map['twoFactorEnabled'] = twoFactorEnabled;
map['lockoutEnd'] = lockoutEnd;
@ -188,6 +190,7 @@ class User {
securityStamp = json['securityStamp'];
concurrencyStamp = json['concurrencyStamp'];
phoneNumber = json['phoneNumber'];
extensionNo = json['extensionNo'];
phoneNumberConfirmed = json['phoneNumberConfirmed'];
twoFactorEnabled = json['twoFactorEnabled'];
lockoutEnd = json['lockoutEnd'];

@ -33,39 +33,44 @@ class AppDrawer extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 90,
height: 90,
decoration: ShapeDecoration(
image: DecorationImage(
image: NetworkImage(
(userProvider.user?.profilePhotoName?.isNotEmpty) ?? false
? userProvider.user.profilePhotoName
: "https://www.shutterstock.com/shutterstock/photos/1714666150/display_1500/stock-photo-head-shot-portrait-close-up-smiling-confident-businessman-wearing-glasses-looking-at-camera-1714666150.jpg",
Consumer<UserProvider>(builder: (context, snapshot, _) {
return CircleAvatar(
radius: 45,
backgroundColor: const Color(0xFFE4E5E6),
child: Padding(
padding: const EdgeInsets.all(1), // Border radius
child: ClipOval(
child: (snapshot.user.profilePhotoName?.isNotEmpty ?? false)
? Image.network(snapshot.user.profilePhotoName)
: snapshot.profileImage != null
? Image.file(snapshot.profileImage)
: const Icon(
Icons.person,
size: 50,
color: Colors.white,
),
),
fit: BoxFit.cover,
),
shape: const OvalBorder(side: BorderSide(width: 1, color: Color(0xFFE4E5E6))),
),
).onPress(() => Navigator.of(context).pushNamed(ProfilePage.id)),
);
}).onPress(() => Navigator.of(context).pushNamed(ProfilePage.id)),
const Icon(Icons.clear).onPress(() => Navigator.of(context).pop())
],
),
8.height,
(userProvider.user?.username ?? "Eng Mahmoud").heading3(context).custom(fontWeight: FontWeight.w600),
(userProvider.user?.email ?? "context.welcome@gmail.com").heading6(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
userProvider.user.username.heading3(context).custom(fontWeight: FontWeight.w600),
if ((userProvider.user?.email ?? "").isNotEmpty) (userProvider.user?.email).heading6(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
18.height,
1.divider,
ListView(
// "settings" : " Settings",
// "ReportBug " : "Report a bug",
// "whatsNew" : "What's New",
// "logout" : "Logout"
// "settings" : " Settings",
// "ReportBug " : "Report a bug",
// "whatsNew" : "What's New",
// "logout" : "Logout"
// "settings" : " الاعدادات",
// "ReportBug " "ابلاغ عن خطا",
// "whatsNew" : "ماهو الجديد",
// "logout" : "خروج"
// "settings" : " الاعدادات",
// "ReportBug " "ابلاغ عن خطا",
// "whatsNew" : "ماهو الجديد",
// "logout" : "خروج"
padding: const EdgeInsets.only(top: 24),
children: [
drawerItem("drawer_notification", context.translation.notifications, context).onPress(() => Navigator.of(context).pushNamed(NotificationsPage.id)),
@ -113,7 +118,7 @@ class AppDrawer extends StatelessWidget {
);
}
Widget drawerItem(String icon, String title, BuildContext context,{Color color}) {
Widget drawerItem(String icon, String title, BuildContext context, {Color color}) {
return Row(
children: [
SvgPicture.asset(
@ -125,7 +130,9 @@ class AppDrawer extends StatelessWidget {
16.width,
Text(
title,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50,),
style: AppTextStyles.heading6.copyWith(
color: context.isDark ? AppColor.neutral10 : AppColor.neutral50,
),
),
],
);

@ -32,7 +32,7 @@ class AppFilledButton extends StatelessWidget {
borderRadius: BorderRadius.circular(10),
color: buttonColor ?? Theme.of(context).primaryColor,
),
child: loading ? const CircularProgressIndicator(color: Colors.white) : label.heading6(context).custom(color: textColor ?? (context.isDark ? AppColor.neutral60 : Colors.white)),
child: label.heading6(context).custom(color: textColor ?? (context.isDark ? AppColor.neutral60 : Colors.white)),
).onPress(onPressed);
}
}

@ -47,20 +47,26 @@ class _DashboardPageState extends State<DashboardPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 48,
height: 48,
decoration: const ShapeDecoration(
image: DecorationImage(
image: NetworkImage(
"https://www.shutterstock.com/shutterstock/photos/1714666150/display_1500/stock-photo-head-shot-portrait-close-up-smiling-confident-businessman-wearing-glasses-looking-at-camera-1714666150.jpg"),
fit: BoxFit.cover,
),
shape: OvalBorder(
side: BorderSide(width: 1, color: Color(0xFFE4E5E6)),
Consumer<UserProvider>(builder: (context, snapshot, _) {
return CircleAvatar(
radius: 24,
backgroundColor: const Color(0xFFE4E5E6),
child: Padding(
padding: const EdgeInsets.all(1), // Border radius
child: ClipOval(
child: (snapshot.user.profilePhotoName?.isNotEmpty ?? false)
? Image.network(snapshot.user.profilePhotoName)
: snapshot.profileImage != null
? Image.file(snapshot.profileImage)
: const Icon(
Icons.person,
size: 24,
color: Colors.white,
),
),
),
),
).onPress(widget.onDrawerPress),
);
}).onPress(widget.onDrawerPress),
Stack(
alignment: Alignment.topRight,
children: [

@ -7,7 +7,9 @@ import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/all_requests_and_count_model.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/pages/device_transfer/device_transfer_details.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
class AssetItemView extends StatelessWidget {
@ -27,11 +29,11 @@ class AssetItemView extends StatelessWidget {
children: [
StatusLabel(label: request.priority, textColor: AColors.getRequestStatusTextColorByName(request.priority), backgroundColor: AColors.getRequestStatusColorByName(request.priority)),
8.width,
StatusLabel(
label: request.status,
textColor: AColors.getRequestStatusTextColorByName(request.status),
backgroundColor: AColors.getRequestStatusColorByName(request.status),
),
// StatusLabel(
// label: request.status,
// textColor: AColors.getRequestStatusTextColorByName(request.status),
// backgroundColor: AColors.getRequestStatusColorByName(request.status),
// ),
1.width.expanded,
Text(request.date?.toServiceRequestCardFormat ?? "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
@ -72,6 +74,14 @@ class AssetItemView extends StatelessWidget {
],
),
],
).toShadowContainer(context,showShadow: showShadow).onPress(() {});
).toShadowContainer(context,showShadow: showShadow).onPress(() {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => DeviceTransferDetails(model: AssetTransfer(
id:request.id
))));
});
}
}

@ -1,4 +1,10 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
@ -42,220 +48,269 @@ class _ProfilePageState extends State<ProfilePage> {
_user = User.fromJson(_userProvider.user.toJson());
_firstTime = false;
}
Color color = context.isDark ? AppColor.neutral10 : AppColor.neutral50;
return Scaffold(
key: _scaffoldKey,
appBar: DefaultAppBar(title: context.translation.myProfile),
body: LoadingManager(
isLoading: _userProvider.isLoading,
isFailedLoading: false,
stateCode: 200,
onRefresh: () async {},
child: SafeArea(
child: Card(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: double.infinity,
child: Column(
children: [
Container(
width: 90,
height: 90,
decoration: ShapeDecoration(
image: DecorationImage(
image: NetworkImage(
(_user.profilePhotoName?.isNotEmpty ?? false)
? _user.profilePhotoName
: "https://www.shutterstock.com/shutterstock/photos/1714666150/display_1500/stock-photo-head-shot-portrait-close-up-smiling-confident-businessman-wearing-glasses-looking-at-camera-1714666150.jpg",
body: SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: double.infinity,
child: Column(
children: [
Consumer<UserProvider>(builder: (context, snapshot, _) {
return Stack(
alignment: Alignment.bottomRight,
children: [
CircleAvatar(
radius: 45,
backgroundColor: const Color(0xFFE4E5E6),
child: Padding(
padding: const EdgeInsets.all(1), // Border radius
child: ClipOval(
child: (snapshot.user.profilePhotoName?.isNotEmpty ?? false)
? Image.network(snapshot.user.profilePhotoName)
: snapshot.profileImage != null
? Image.file(snapshot.profileImage)
: const Icon(
Icons.person,
size: 50,
color: Colors.white,
),
),
fit: BoxFit.cover,
),
shape: const OvalBorder(side: BorderSide(width: 1, color: Color(0xFFE4E5E6))),
),
),
(_user.username ?? "Eng Mahmoud").heading3(context).custom(fontWeight: FontWeight.w600),
(_user.email ?? "context.welcome@gmail.com").heading6(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
],
),
),
24.height,
const Divider().defaultStyle(context),
8.height,
(_user.phoneNumber ?? "+966 433 443 344").heading5(context),
8.height,
const Divider().defaultStyle(context),
8.height,
("Ext: ${"2212"}").heading5(context),
8.height,
if ((_user.departmentName?.length ?? 0) > 0) const Divider().defaultStyle(context),
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
itemCount: _user.departmentName?.length ?? 0,
shrinkWrap: true,
itemBuilder: (context, index) {
return (_user.departmentName[index] ?? "N/A").heading5(context).paddingOnly(top: 8, bottom: 8);
},
),
],
).paddingAll(16),
).paddingAll(16),
// child: Stack(
// children: [
// Form(
// key: _formKey,
// child: ListView(
// children: [
// //AppNameBar(),
// Hero(
// tag: "logo",
// child: Image(
// height: _height / 4,
// image: AssetImage("assets/images/logo.png"),
// ),
// ),
// Container(
// padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
// margin: EdgeInsets.symmetric(horizontal: 16),
// decoration: BoxDecoration(color: AColors.primaryColor, borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)), boxShadow: [
// BoxShadow(
// color: AColors.grey,
// offset: Offset(0, -1),
// )
// ]),
// child: Column(
// children: [
// ATextFormField(
// initialValue: _user.userName,
// hintText: context.translation.name,
// enable: false,
// prefixIconData: Icons.account_circle,
// style: Theme.of(context).textTheme.headline6,
// validator: (value) => Validator.hasValue(value) ? null : context.translation.nameValidateMessage,
// onSaved: (value) {
// _user.userName = value;
// },
// ),
// SizedBox(
// height: 8,
// ),
// ATextFormField(
// initialValue: _user.email,
// hintText: context.translation.email,
// enable: false,
// prefixIconData: Icons.email,
// textInputType: TextInputType.emailAddress,
// style: Theme.of(context).textTheme.headline6,
// validator: (value) => Validator.isEmail(value) ? null : context.translation.emailValidateMessage,
// onSaved: (value) {
// _user.email = value;
// },
// ),
// SizedBox(
// height: 8,
// ),
// AbsorbPointer(
// child: HospitalButton(
// hospital: Hospital(name: _user.clientName, id: _user.clientId),
// onHospitalPick: (hospital) {
// _user.clientName = hospital.name;
// _user.clientId = hospital.id;
// setState(() {});
// },
// ),
// ),
// SizedBox(
// height: 8,
// ),
// // DepartmentButton(
// // department: Department(name: _user.departmentName, id: _user.departmentId),
// // onDepartmentPick: (department) {
// // _user.departmentName = department.name;
// // _user.departmentId = department.id;
// // setState(() {});
// // },
// // ),
// SizedBox(
// height: 8,
// ),
// ATextFormField(
// initialValue: _user.phoneNumber,
// hintText: context.translation.phoneNumber,
// style: Theme.of(context).textTheme.headline6,
// prefixIconData: Icons.phone_android,
// validator: (value) => Validator.isPhoneNumber(value) ? null : context.translation.phoneNumberValidateMessage,
// textInputType: TextInputType.phone,
// onSaved: (value) {
// _user.phoneNumber = value;
// },
// ),
// SizedBox(
// height: 8,
// ),
// // ATextFormField(
// // initialValue: _user.whatsApp,
// // hintText: context.translation.whatsApp,
// // style: Theme.of(context).textTheme.headline6,
// // prefixIconData: FontAwesomeIcons.whatsapp,
// // prefixIconSize: 36,
// // validator: (value) =>
// // Validator.isPhoneNumber(value) ? null : context.translation.phoneNumberValidateMessage,
// // textInputType: TextInputType.phone,
// // onSaved: (value){
// // _user.whatsApp = value;
// // },
// // ),
// ],
// ),
// ),
// SizedBox(
// height: 16,
// ),
// Center(
// child: SizedBox(
// height: _width / 8,
// width: _width / 1.2,
// child: AButton(
// text: context.translation.update,
// onPressed: () async {
// // if (!_formKey.currentState.validate()) return;
// // _formKey.currentState.save();
// // if (_user.departmentId == null) {
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
// // content: Text(context.translation.unitRequired),
// // ));
// // return;
// // }
// // int status = await _userProvider.updateProfile(
// // user: _user,
// // host: _settingProvider.host,
// // );
// // if (status >= 200 && status < 300) {
// // _settingProvider.setUser(_userProvider.user);
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
// // content: Text(context.translation.requestCompleteSuccessfully),
// // ));
// // } else {
// // String errorMessage = HttpStatusManger.getStatusMessage(status: status, subtitle: context.translation);
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
// // content: Text(errorMessage),
// // ));
// // }
// },
// ),
// ),
// ),
// SizedBox(
// height: 32,
// ),
// ],
// ),
// ),
// ABackButton(),
// ],
// ),
),
CircleAvatar(
radius: 14,
backgroundColor: AppColor.primary70,
child: Padding(
padding: EdgeInsets.all(1), // Border radius
child: snapshot.isLoading
? const SizedBox(height: 16, width: 16, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2))
: Icon(Icons.upload, size: 16, color: Colors.white),
),
).onPress(snapshot.isLoading
? null
: () async {
final pickedFile = await ImagePicker().pickImage(source: ImageSource.gallery, imageQuality: 70, maxWidth: 800, maxHeight: 800);
if (pickedFile != null) {
CroppedFile croppedFile = await ImageCropper().cropImage(
sourcePath: pickedFile.path,
aspectRatioPresets: [CropAspectRatioPreset.square],
uiSettings: [
AndroidUiSettings(
toolbarTitle: 'ATOMS',
toolbarColor: Colors.white,
toolbarWidgetColor: color,
initAspectRatio: CropAspectRatioPreset.square,
lockAspectRatio: false,
),
IOSUiSettings(title: 'ATOMS'),
],
);
if (croppedFile != null) {
snapshot.uploadProfileImage(_user.userID, File(croppedFile.path));
}
}
}),
],
);
}),
8.height,
(_user.username).heading3(context).custom(fontWeight: FontWeight.w600, color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
if ((_user.email ?? "").isNotEmpty) (_user.email ?? "").heading6(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
],
),
),
24.height,
if ((_user.phoneNumber ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),
8.height,
_user.phoneNumber.heading5(context),
8.height,
],
if ((_user.extensionNo ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),
8.height,
_user.extensionNo.heading5(context),
8.height,
],
if ((_user.departmentName?.length ?? 0) > 0) const Divider().defaultStyle(context),
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
itemCount: _user.departmentName?.length ?? 0,
shrinkWrap: true,
itemBuilder: (context, index) {
return (_user.departmentName[index] ?? "N/A").heading5(context).paddingOnly(top: 8, bottom: 8);
},
),
if ((_user.clientName ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),
8.height,
_user.clientName.heading5(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
8.height,
],
],
).toShadowContainer(context).paddingAll(16),
// child: Stack(
// children: [
// Form(
// key: _formKey,
// child: ListView(
// children: [
// //AppNameBar(),
// Hero(
// tag: "logo",
// child: Image(
// height: _height / 4,
// image: AssetImage("assets/images/logo.png"),
// ),
// ),
// Container(
// padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
// margin: EdgeInsets.symmetric(horizontal: 16),
// decoration: BoxDecoration(color: AColors.primaryColor, borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)), boxShadow: [
// BoxShadow(
// color: AColors.grey,
// offset: Offset(0, -1),
// )
// ]),
// child: Column(
// children: [
// ATextFormField(
// initialValue: _user.userName,
// hintText: context.translation.name,
// enable: false,
// prefixIconData: Icons.account_circle,
// style: Theme.of(context).textTheme.headline6,
// validator: (value) => Validator.hasValue(value) ? null : context.translation.nameValidateMessage,
// onSaved: (value) {
// _user.userName = value;
// },
// ),
// SizedBox(
// height: 8,
// ),
// ATextFormField(
// initialValue: _user.email,
// hintText: context.translation.email,
// enable: false,
// prefixIconData: Icons.email,
// textInputType: TextInputType.emailAddress,
// style: Theme.of(context).textTheme.headline6,
// validator: (value) => Validator.isEmail(value) ? null : context.translation.emailValidateMessage,
// onSaved: (value) {
// _user.email = value;
// },
// ),
// SizedBox(
// height: 8,
// ),
// AbsorbPointer(
// child: HospitalButton(
// hospital: Hospital(name: _user.clientName, id: _user.clientId),
// onHospitalPick: (hospital) {
// _user.clientName = hospital.name;
// _user.clientId = hospital.id;
// setState(() {});
// },
// ),
// ),
// SizedBox(
// height: 8,
// ),
// // DepartmentButton(
// // department: Department(name: _user.departmentName, id: _user.departmentId),
// // onDepartmentPick: (department) {
// // _user.departmentName = department.name;
// // _user.departmentId = department.id;
// // setState(() {});
// // },
// // ),
// SizedBox(
// height: 8,
// ),
// ATextFormField(
// initialValue: _user.phoneNumber,
// hintText: context.translation.phoneNumber,
// style: Theme.of(context).textTheme.headline6,
// prefixIconData: Icons.phone_android,
// validator: (value) => Validator.isPhoneNumber(value) ? null : context.translation.phoneNumberValidateMessage,
// textInputType: TextInputType.phone,
// onSaved: (value) {
// _user.phoneNumber = value;
// },
// ),
// SizedBox(
// height: 8,
// ),
// // ATextFormField(
// // initialValue: _user.whatsApp,
// // hintText: context.translation.whatsApp,
// // style: Theme.of(context).textTheme.headline6,
// // prefixIconData: FontAwesomeIcons.whatsapp,
// // prefixIconSize: 36,
// // validator: (value) =>
// // Validator.isPhoneNumber(value) ? null : context.translation.phoneNumberValidateMessage,
// // textInputType: TextInputType.phone,
// // onSaved: (value){
// // _user.whatsApp = value;
// // },
// // ),
// ],
// ),
// ),
// SizedBox(
// height: 16,
// ),
// Center(
// child: SizedBox(
// height: _width / 8,
// width: _width / 1.2,
// child: AButton(
// text: context.translation.update,
// onPressed: () async {
// // if (!_formKey.currentState.validate()) return;
// // _formKey.currentState.save();
// // if (_user.departmentId == null) {
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
// // content: Text(context.translation.unitRequired),
// // ));
// // return;
// // }
// // int status = await _userProvider.updateProfile(
// // user: _user,
// // host: _settingProvider.host,
// // );
// // if (status >= 200 && status < 300) {
// // _settingProvider.setUser(_userProvider.user);
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
// // content: Text(context.translation.requestCompleteSuccessfully),
// // ));
// // } else {
// // String errorMessage = HttpStatusManger.getStatusMessage(status: status, subtitle: context.translation);
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
// // content: Text(errorMessage),
// // ));
// // }
// },
// ),
// ),
// ),
// SizedBox(
// height: 32,
// ),
// ],
// ),
// ),
// ABackButton(),
// ],
// ),
),
);
}

@ -170,7 +170,8 @@ class _SingleDevicePickerState extends State<SingleDevicePicker> {
return AssetItemListView(
device: _searchableList[itemIndex],
onPressed: (device) {
Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id);
Navigator.of(context).pop(device);
// Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id);
},
);
},

@ -82,6 +82,7 @@ class _AutoCompleteDeviceNumberFieldState extends State<AutoCompleteDeviceNumber
user: _userProvider.user,
hospitalId: widget.hospitalId,
number: vale,
addPagination: false
);
},
itemBuilder: (context, device) {

@ -565,6 +565,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.3.0"
image_cropper:
dependency: "direct main"
description:
name: image_cropper
sha256: "710ab4b7953e9ce1d27d833f741e5f8f3afb0b0ba3556dc0b844741b5f55c2b3"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
image_cropper_for_web:
dependency: transitive
description:
name: image_cropper_for_web
sha256: "09e93a8ec0435adcaa23622ac090442872f18145d70b9ff605ffedcf97d56255"
url: "https://pub.dev"
source: hosted
version: "1.0.3"
image_cropper_platform_interface:
dependency: transitive
description:
name: image_cropper_platform_interface
sha256: "62349e3aab63873ea9b9ab9f69d036ab8a0d74b3004beec4303981386cb9273f"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
image_picker:
dependency: "direct main"
description:

@ -74,6 +74,7 @@ dependencies:
flutter_advanced_switch: ^3.0.1
pie_chart: ^5.3.2
table_calendar: ^3.0.8
image_cropper: ^3.0.3
dev_dependencies:
flutter_test:

Loading…
Cancel
Save