eSignature fixed,

main_design2.0
Sikander Saleem 2 years ago
parent 322403f23d
commit 09f24edb35

@ -64,53 +64,52 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
onRefresh: () async {},
child: Column(
children: [
_buildDetailsCard(
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
context.translation.transferDetails.heading5(context),
8.height,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTextWidget('${context.translation.assetName} : ${_model?.assetName ??""}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber??""}'),
_buildTextWidget('${context.translation.model} : ${_model?.modelName??""}'),
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo??""}'),
],
),
8.height,
],
).expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
/// TBD
// Row(
// children: [
// /// TBD
// // StatusLabel(
// // label: "",
// // id: 0,
// // textColor: AColors.getPriorityStatusTextColor(0),
// // backgroundColor: AColors.getPriorityStatusColor(0)),
// 8.width,
//
// /// TBD
// //StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
// ],
// ),
1.width,
Text(_model?.createdOn != null ? _model.createdOn.toServiceRequestCardFormat : "",
textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF3B3D4A))),
],
),
],
).paddingAll(14),
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
context.translation.transferDetails.heading5(context),
8.height,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTextWidget('${context.translation.assetName} : ${_model?.assetName ?? ""}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'),
_buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'),
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
],
),
8.height,
],
).expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
/// TBD
// Row(
// children: [
// /// TBD
// // StatusLabel(
// // label: "",
// // id: 0,
// // textColor: AColors.getPriorityStatusTextColor(0),
// // backgroundColor: AColors.getPriorityStatusColor(0)),
// 8.width,
//
// /// TBD
// //StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
// ],
// ),
1.width,
Text(_model?.createdOn != null ? _model.createdOn.toServiceRequestCardFormat : "",
textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF3B3D4A))),
],
),
],
).toShadowContainer(context),
8.height,
// sender card
_buildCard(
isSender: true,
@ -129,6 +128,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.senderMachineStatusName)))
: null,
),
8.height,
// receiver card
_buildCard(
isSender: false,
@ -148,7 +148,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
: null,
),
],
),
).paddingAll(16),
),
);
}
@ -182,42 +182,39 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
],
),
if ((_userProvider.user?.type == UsersTypes.engineer))
if(isSender ? (_model?.senderMachineStatusName?.toLowerCase() != "closed" && _model?.senderMachineStatusName?.toLowerCase() != "completed")
: (_model?.receiverMachineStatusName?.toLowerCase() != "closed" && _model?.receiverMachineStatusName?.toLowerCase() != "completed"))
CircleAvatar(
radius: 25,
backgroundColor: AppColor.neutral30,
child: CircleAvatar(
radius: 24,
backgroundColor: Colors.white,
child: Padding(
padding: const EdgeInsets.only(left: 3.0),
child: SvgPicture.asset('assets/images/update.svg'),
if (isSender
? (_model?.senderMachineStatusName?.toLowerCase() != "closed" && _model?.senderMachineStatusName?.toLowerCase() != "completed")
: (_model?.receiverMachineStatusName?.toLowerCase() != "closed" && _model?.receiverMachineStatusName?.toLowerCase() != "completed"))
CircleAvatar(
radius: 25,
backgroundColor: AppColor.neutral30,
child: CircleAvatar(
radius: 24,
backgroundColor: Colors.white,
child: Padding(
padding: const EdgeInsets.only(left: 3.0),
child: SvgPicture.asset('assets/images/update.svg'),
),
),
),
).onPress(isSender
? () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));
}
: () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));
}),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTextWidget('${context.translation.site} : $site'),
_buildTextWidget('${context.translation.unite} : $unit'),
8.height,
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
8.height,
_buildTextWidget(comment),
).onPress(isSender
? () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));
}
: () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));
}),
],
),
8.height,
_buildTextWidget('${context.translation.site} : $site'),
_buildTextWidget('${context.translation.unite} : $unit'),
if (comment != null && comment.isNotEmpty) ...[
8.height,
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
8.height,
_buildTextWidget(comment),
]
],
).toShadowContainer(context).paddingOnly(top: 14, start: 14, end: 14);
).toShadowContainer(context);
}
int getIdstatus(String status) {

@ -174,7 +174,6 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
),
8.height,
ESignature(
title: "Signature",
oldSignature: widget.isSender ? widget.model.senderEngSignature : widget.model.receiverEngSignature,
newSignature: _signature,
@ -184,8 +183,6 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
widget.isSender
? _formModel.senderEngSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"
: _formModel.receiverEngSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
base64Encode(signature);
},
),
],

@ -181,6 +181,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@ -196,8 +197,8 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
'${context.translation.quantity}: ${widget.gasRefillModel.gazRefillDetails[0].requestedQty}'.bodyText(context),
'${context.translation.site}: ${widget.gasRefillModel.site.name}'.bodyText(context),
],
).paddingAll(16),
12.height,
).toShadowContainer(context),
8.height,
AppTimer(
label: context.translation.workingHours,
timer: _formModel.timer,
@ -207,7 +208,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
return true;
},
),
12.height,
8.height,
SingleItemDropDownMenu<Lookup, GasStatusProvider>(
context: context,
title: context.translation.reportStatus,
@ -216,7 +217,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
_formModel.status = value;
},
),
12.height,
8.height,
AppTextFormField(
labelText: context.translation.deliveredQuantity,
onSaved: (value) {
@ -226,7 +227,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
controller: _deliveredQuantityController,
validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
),
12.height,
8.height,
/// TBD
AppTextFormField(
@ -237,7 +238,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
onSaved: (value) {},
),
],
).toShadowContainer(context).paddingAll(16),
),
).expanded,
AppFilledButton(
label: widget.gasRefillModel == null ? context.translation.submit : context.translation.update,

@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:signature/signature.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
@ -15,6 +16,7 @@ class ESignature extends StatefulWidget {
final Function(Uint8List) onSaved;
final Function(Uint8List) onChange;
final String title;
const ESignature({Key key, this.title, this.oldSignature, this.onSaved, this.onChange, this.newSignature}) : super(key: key);
@override
@ -50,6 +52,7 @@ class _ESignatureState extends State<ESignature> {
@override
Widget build(BuildContext context) {
print(widget.oldSignature);
return FormField<String>(onSaved: (_) async {
widget.onSaved(signature);
}, builder: (FormFieldState<String> state) {
@ -59,7 +62,7 @@ class _ESignatureState extends State<ESignature> {
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
decoration: BoxDecoration(
color: context.isDark?Theme.of(context).cardColor:Colors.white,
color: context.isDark ? Theme.of(context).cardColor : Colors.white,
borderRadius: _editable ? const BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10)) : BorderRadius.circular(10),
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
),
@ -98,7 +101,7 @@ class _ESignatureState extends State<ESignature> {
height: 135.toScreenHeight,
width: MediaQuery.of(context).size.width,
padding: const EdgeInsets.only(bottom: 8),
child: signature != null ? Image.memory(signature) : ImageLoader(boxFit: BoxFit.contain, url: widget.oldSignature),
child: signature != null ? Image.memory(signature) : ImageLoader(boxFit: BoxFit.contain, url: URLs.getFileUrl(widget.oldSignature)),
)
: AbsorbPointer(
absorbing: !_editable,

@ -108,7 +108,7 @@ class _AppTimerState extends State<AppTimer> {
height: 56.toScreenHeight,
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth),
decoration: BoxDecoration(
color: context.isDark?AppColor.neutral50:Theme.of(context).cardColor,
color: context.isDark ? AppColor.neutral50 : Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
),
@ -125,7 +125,7 @@ class _AppTimerState extends State<AppTimer> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
(widget.label ?? "Timer").tinyFont(context),
value.bodyText(context).custom(color: AppColor.neutral50),
value.bodyText(context).custom(color: widget.enabled ? AppColor.neutral50 : AppColor.neutral20),
],
);
},

Loading…
Cancel
Save