improvements

main_design2.0
Sikander Saleem 2 years ago
parent e98bd62be9
commit 593cecbe55

@ -119,8 +119,8 @@ class AllRequestsProvider extends ChangeNotifier {
Response response;
try {
Map<String, dynamic> body = {
"typeTransaction": [1, 2, 3, 4],
"statusTransaction": [1, 2, 3,4],
"typeTransaction": [1],
"statusTransaction": [1, 2, 4],
"priority": [1],
"displayData": []
};
@ -149,7 +149,7 @@ class AllRequestsProvider extends ChangeNotifier {
try {
Map<String, dynamic> body = {
"typeTransaction": [1, 2, 3, 4],
"statusTransaction": [1, 2, 3,4],
"statusTransaction": [1, 2, 4],
"priority": [],
"displayData": [1]
};

@ -222,7 +222,7 @@ class MyApp extends StatelessWidget {
RequestGasRefill.id: (_) => const RequestGasRefill(),
CreateServiceRequestPage.id: (_) => const CreateServiceRequestPage(),
SingleHospitalPicker.id: (_) => SingleHospitalPicker(),
SingleDevicePicker.id: (_) => const SingleDevicePicker(),
MyAssetsPage.id: (_) => const MyAssetsPage(),
SingleDepartmentPicker.id: (_) => SingleDepartmentPicker(),
NotificationsPage.id: (_) => NotificationsPage(),
FutureRequestServiceDetails.id: (_) => FutureRequestServiceDetails(),

@ -111,6 +111,8 @@ class RequestsDetails {
String assetTransferTo;
String code;
String date;
String siteTransferFrom;
String siteTransferTo;
RequestsDetails(
{this.id,
@ -131,6 +133,8 @@ class RequestsDetails {
this.assetTransferFrom,
this.assetTransferTo,
this.code,
this.siteTransferFrom,
this.siteTransferTo,
this.date});
RequestsDetails.fromJson(Map<String, dynamic> json) {
@ -153,6 +157,8 @@ class RequestsDetails {
assetTransferTo = json['assetTransferTo'];
code = json['code'];
date = json['date'];
siteTransferFrom = json['siteTransferFrom'];
siteTransferTo = json['siteTransferTo'];
}
Map<String, dynamic> toJson() {
@ -176,6 +182,8 @@ class RequestsDetails {
data['assetTransferTo'] = assetTransferTo;
data['code'] = code;
data['date'] = date;
data['siteTransferFrom'] = siteTransferFrom;
data['siteTransferTo'] = siteTransferTo;
return data;
}
}

@ -77,18 +77,19 @@ class _DashboardPageState extends State<DashboardPage> {
color: Color(0xff767676),
size: 30,
).paddingOnly(top: 6, end: 0),
Positioned(
top: 0,
right: 0,
child: Container(
padding: const EdgeInsets.all(4),
decoration: const ShapeDecoration(
color: Color(0xFFD02127),
shape: CircleBorder(),
),
child: Text("3", style: AppTextStyles.bodyText),
),
)
// todo @sikander will add count for unread notifications
// Positioned(
// top: 0,
// right: 0,
// child: Container(
// padding: const EdgeInsets.all(4),
// decoration: const ShapeDecoration(
// color: Color(0xFFD02127),
// shape: CircleBorder(),
// ),
// child: Text("", style: AppTextStyles.bodyText),
// ),
// )
],
).onPress(() {
Navigator.of(context).pushNamed(NotificationsPage.id);

@ -46,7 +46,7 @@ class _LandPageState extends State<LandPage> {
})),
// const old_page.LandPage(),
MyRequestsPage(),
const SingleDevicePicker(),
const MyAssetsPage(fromBottomBar: true),
if (_userProvider.user.type == UsersTypes.engineer) const CalendarPage(),
];
}

@ -49,11 +49,15 @@ class AssetItemView extends StatelessWidget {
style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)),
),
Text(
"${context.translation.from} : ${request.assetTransferFrom}",
"${context.translation.from} : ${request.siteTransferFrom}",
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
"${context.translation.to} : ${request.assetTransferTo}",
"${context.translation.to} : ${request.siteTransferTo}",
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
"${request.status.replaceAll("=", ":")}",
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
],

@ -37,7 +37,7 @@ class _CommentsBottomSheetState extends State<CommentsBottomSheet> {
@override
Widget build(BuildContext context) {
final commentsProvider = Provider.of<CommentsProvider>(context);
final commentsProvider = Provider.of<CommentsProvider>(context, listen: false);
final userProvider = Provider.of<UserProvider>(context, listen: false);
return Container(
height: MediaQuery.of(context).size.height * 0.55,
@ -50,78 +50,82 @@ class _CommentsBottomSheetState extends State<CommentsBottomSheet> {
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
child: Form(
key: _formKey,
child: LoadingManager(
isLoading: commentsProvider.isLoading,
isFailedLoading: commentsProvider.comments == null,
stateCode: commentsProvider.stateCode,
onRefresh: () async {
commentsProvider.reset();
await commentsProvider.getComments(callId: widget.requestId);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 40.toScreenWidth,
height: 5.toScreenHeight,
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)),
child: Column(
children: [
LoadingManager(
isLoading: commentsProvider.isLoading,
isFailedLoading: commentsProvider.comments == null,
stateCode: commentsProvider.stateCode,
onRefresh: () async {
commentsProvider.reset();
await commentsProvider.getComments(callId: widget.requestId);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 40.toScreenWidth,
height: 5.toScreenHeight,
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)),
),
16.height,
Align(
alignment: AlignmentDirectional.centerStart,
child: context.translation.comments.heading3(context).custom(fontWeight: FontWeight.w600),
),
commentsProvider.comments.isEmpty
? NoItemFound(message: context.translation.noDataFound).expanded
: LazyLoading(
nextPage: commentsProvider.nextPage,
onLazyLoad: () async => await commentsProvider.getComments(callId: widget.requestId),
child: ListView.separated(
itemCount: commentsProvider.comments.length,
padding: const EdgeInsets.only(top: 16, bottom: 8),
separatorBuilder: (cxt, index) => 8.height,
itemBuilder: (context, itemIndex) {
final model = commentsProvider.comments[itemIndex];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(model?.createdBy?.userName ?? "Nurse").heading6(context),
8.height,
(model?.comment ?? "").bodyText(context),
8.height,
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Text(DateTime.tryParse(model.createdOn).toIso8601String().toServiceRequestDetailsFormat,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50)),
),
],
).toShadowContainer(context);
},
),
).expanded,
],
),
16.height,
Align(
alignment: AlignmentDirectional.centerStart,
child: context.translation.comments.heading3(context).custom(fontWeight: FontWeight.w600),
).expanded,
if (userProvider.user.type == UsersTypes.normal_user) 8.height,
if (userProvider.user.type == UsersTypes.normal_user) // todo its keeps loading when open keyboard or dismiss
AppTextFormField(
labelText: "Type any comment",
backgroundColor: AppColor.neutral30,
alignLabelWithHint: true,
showShadow: false,
validator: (value) => Validator.hasValue(value) ? null : context.translation.requiredField,
textInputType: TextInputType.multiline,
suffixIcon: "comment_send".toSvgAsset().paddingOnly(end: 16).onPress(() {
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
final comment = Comment(id: 0, callRequestId: num.tryParse(widget.requestId ?? ""), comment: text);
commentsProvider.addComment(context, comment: comment);
}
}),
onSaved: (value) {
text = value;
},
),
commentsProvider.comments.isEmpty
? NoItemFound(message: context.translation.noDataFound).expanded
: LazyLoading(
nextPage: commentsProvider.nextPage,
onLazyLoad: () async => await commentsProvider.getComments(callId: widget.requestId),
child: ListView.separated(
itemCount: commentsProvider.comments.length,
padding: const EdgeInsets.only(top: 16, bottom: 8),
separatorBuilder: (cxt, index) => 8.height,
itemBuilder: (context, itemIndex) {
final model = commentsProvider.comments[itemIndex];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(model?.createdBy?.userName ?? "Nurse").heading6(context),
8.height,
(model?.comment ?? "").bodyText(context),
8.height,
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Text(DateTime.tryParse(model.createdOn).toIso8601String().toServiceRequestDetailsFormat,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50)),
),
],
).toShadowContainer(context);
},
),
).expanded,
if (userProvider.user.type == UsersTypes.normal_user) 8.height,
if (userProvider.user.type == UsersTypes.normal_user)
AppTextFormField(
labelText: "Type any comment",
backgroundColor: AppColor.neutral30,
alignLabelWithHint: true,
showShadow: false,
validator: (value) => Validator.hasValue(value) ? null : context.translation.requiredField,
textInputType: TextInputType.multiline,
suffixIcon: "comment_send".toSvgAsset().paddingOnly(end: 16).onPress(() {
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
final comment = Comment(id: 0, callRequestId: num.tryParse(widget.requestId ?? ""), comment: text);
commentsProvider.addComment(context, comment: comment);
}
}),
onSaved: (value) {
text = value;
},
),
16.height,
],
),
16.height,
],
),
),
);

@ -37,7 +37,7 @@ class PickAsset extends StatelessWidget {
context.translation.pickAsset.bodyText(context).custom(color: context.isDark ? AppColor.neutral40 : AppColor.neutral50),
],
).onPress(() async {
Asset device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Asset;
Asset device = await Navigator.of(context).pushNamed(MyAssetsPage.id) as Asset;
onPickAsset(device);
}).expanded,
"qr".toSvgAsset(height: 24, fit: BoxFit.fitHeight, color: context.isDark ? AppColor.primary40 : AppColor.primary70),

@ -20,16 +20,17 @@ import '../../pages/device_transfer/asset_filter_screen.dart';
import '../../pages/device_transfer/asset_search_screen.dart';
import '../qr/scan_qr.dart';
class SingleDevicePicker extends StatefulWidget {
class MyAssetsPage extends StatefulWidget {
static final String id = "/single-device-Picker";
final bool fromBottomBar;
const SingleDevicePicker({Key key}) : super(key: key);
const MyAssetsPage({Key key, this.fromBottomBar = false}) : super(key: key);
@override
_SingleDevicePickerState createState() => _SingleDevicePickerState();
_MyAssetsPageState createState() => _MyAssetsPageState();
}
class _SingleDevicePickerState extends State<SingleDevicePicker> {
class _MyAssetsPageState extends State<MyAssetsPage> {
AssetProvider _devicesProvider;
UserProvider _userProvider;
SettingProvider _settingProvider;
@ -195,16 +196,18 @@ class _SingleDevicePickerState extends State<SingleDevicePicker> {
),
),
),
floatingActionButton: FloatingActionButton(
heroTag: "some tag 2",
child: "qr".toSvgAsset(height: 32, fit: BoxFit.fitHeight, color: Theme.of(context).scaffoldBackgroundColor),
onPressed: () async {
String result = await Navigator.of(context).push(
MaterialPageRoute(builder: (_) => const ScanQr()),
) as String;
_getDevice(result, isQr: true);
},
),
floatingActionButton: widget.fromBottomBar
? null
: FloatingActionButton(
heroTag: "some tag 2",
child: "qr".toSvgAsset(height: 32, fit: BoxFit.fitHeight, color: Theme.of(context).scaffoldBackgroundColor),
onPressed: () async {
String result = await Navigator.of(context).push(
MaterialPageRoute(builder: (_) => const ScanQr()),
) as String;
_getDevice(result, isQr: true);
},
),
);
}
}

Loading…
Cancel
Save