improvements

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

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

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

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

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

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

@ -49,11 +49,15 @@ class AssetItemView extends StatelessWidget {
style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)), style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)),
), ),
Text( Text(
"${context.translation.from} : ${request.assetTransferFrom}", "${context.translation.from} : ${request.siteTransferFrom}",
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)), style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
), ),
Text( 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)), style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
), ),
], ],

@ -37,7 +37,7 @@ class _CommentsBottomSheetState extends State<CommentsBottomSheet> {
@override @override
Widget build(BuildContext context) { 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); final userProvider = Provider.of<UserProvider>(context, listen: false);
return Container( return Container(
height: MediaQuery.of(context).size.height * 0.55, 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), padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
child: Form( child: Form(
key: _formKey, key: _formKey,
child: LoadingManager( child: Column(
isLoading: commentsProvider.isLoading, children: [
isFailedLoading: commentsProvider.comments == null, LoadingManager(
stateCode: commentsProvider.stateCode, isLoading: commentsProvider.isLoading,
onRefresh: () async { isFailedLoading: commentsProvider.comments == null,
commentsProvider.reset(); stateCode: commentsProvider.stateCode,
await commentsProvider.getComments(callId: widget.requestId); onRefresh: () async {
}, commentsProvider.reset();
child: Column( await commentsProvider.getComments(callId: widget.requestId);
crossAxisAlignment: CrossAxisAlignment.center, },
children: [ child: Column(
Container( crossAxisAlignment: CrossAxisAlignment.center,
width: 40.toScreenWidth, children: [
height: 5.toScreenHeight, Container(
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)), 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, ).expanded,
Align( if (userProvider.user.type == UsersTypes.normal_user) 8.height,
alignment: AlignmentDirectional.centerStart, if (userProvider.user.type == UsersTypes.normal_user) // todo its keeps loading when open keyboard or dismiss
child: context.translation.comments.heading3(context).custom(fontWeight: FontWeight.w600), 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 16.height,
? 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,
],
),
), ),
), ),
); );

@ -37,7 +37,7 @@ class PickAsset extends StatelessWidget {
context.translation.pickAsset.bodyText(context).custom(color: context.isDark ? AppColor.neutral40 : AppColor.neutral50), context.translation.pickAsset.bodyText(context).custom(color: context.isDark ? AppColor.neutral40 : AppColor.neutral50),
], ],
).onPress(() async { ).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); onPickAsset(device);
}).expanded, }).expanded,
"qr".toSvgAsset(height: 24, fit: BoxFit.fitHeight, color: context.isDark ? AppColor.primary40 : AppColor.primary70), "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 '../../pages/device_transfer/asset_search_screen.dart';
import '../qr/scan_qr.dart'; import '../qr/scan_qr.dart';
class SingleDevicePicker extends StatefulWidget { class MyAssetsPage extends StatefulWidget {
static final String id = "/single-device-Picker"; 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 @override
_SingleDevicePickerState createState() => _SingleDevicePickerState(); _MyAssetsPageState createState() => _MyAssetsPageState();
} }
class _SingleDevicePickerState extends State<SingleDevicePicker> { class _MyAssetsPageState extends State<MyAssetsPage> {
AssetProvider _devicesProvider; AssetProvider _devicesProvider;
UserProvider _userProvider; UserProvider _userProvider;
SettingProvider _settingProvider; SettingProvider _settingProvider;
@ -195,16 +196,18 @@ class _SingleDevicePickerState extends State<SingleDevicePicker> {
), ),
), ),
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: widget.fromBottomBar
heroTag: "some tag 2", ? null
child: "qr".toSvgAsset(height: 32, fit: BoxFit.fitHeight, color: Theme.of(context).scaffoldBackgroundColor), : FloatingActionButton(
onPressed: () async { heroTag: "some tag 2",
String result = await Navigator.of(context).push( child: "qr".toSvgAsset(height: 32, fit: BoxFit.fitHeight, color: Theme.of(context).scaffoldBackgroundColor),
MaterialPageRoute(builder: (_) => const ScanQr()), onPressed: () async {
) as String; String result = await Navigator.of(context).push(
_getDevice(result, isQr: true); MaterialPageRoute(builder: (_) => const ScanQr()),
}, ) as String;
), _getDevice(result, isQr: true);
},
),
); );
} }
} }

Loading…
Cancel
Save