eSignature fixed,

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

@ -64,7 +64,6 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
onRefresh: () async {}, onRefresh: () async {},
child: Column( child: Column(
children: [ children: [
_buildDetailsCard(
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -76,10 +75,10 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_buildTextWidget('${context.translation.assetName} : ${_model?.assetName ??""}'), _buildTextWidget('${context.translation.assetName} : ${_model?.assetName ?? ""}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber??""}'), _buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'),
_buildTextWidget('${context.translation.model} : ${_model?.modelName??""}'), _buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'),
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo??""}'), _buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
], ],
), ),
8.height, 8.height,
@ -109,8 +108,8 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
], ],
), ),
], ],
).paddingAll(14), ).toShadowContainer(context),
), 8.height,
// sender card // sender card
_buildCard( _buildCard(
isSender: true, isSender: true,
@ -129,6 +128,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.senderMachineStatusName))) backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.senderMachineStatusName)))
: null, : null,
), ),
8.height,
// receiver card // receiver card
_buildCard( _buildCard(
isSender: false, isSender: false,
@ -148,7 +148,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
: null, : null,
), ),
], ],
), ).paddingAll(16),
), ),
); );
} }
@ -182,7 +182,8 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
], ],
), ),
if ((_userProvider.user?.type == UsersTypes.engineer)) if ((_userProvider.user?.type == UsersTypes.engineer))
if(isSender ? (_model?.senderMachineStatusName?.toLowerCase() != "closed" && _model?.senderMachineStatusName?.toLowerCase() != "completed") if (isSender
? (_model?.senderMachineStatusName?.toLowerCase() != "closed" && _model?.senderMachineStatusName?.toLowerCase() != "completed")
: (_model?.receiverMachineStatusName?.toLowerCase() != "closed" && _model?.receiverMachineStatusName?.toLowerCase() != "completed")) : (_model?.receiverMachineStatusName?.toLowerCase() != "closed" && _model?.receiverMachineStatusName?.toLowerCase() != "completed"))
CircleAvatar( CircleAvatar(
radius: 25, radius: 25,
@ -204,20 +205,16 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
}), }),
], ],
), ),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTextWidget('${context.translation.site} : $site'), _buildTextWidget('${context.translation.site} : $site'),
_buildTextWidget('${context.translation.unite} : $unit'), _buildTextWidget('${context.translation.unite} : $unit'),
if (comment != null && comment.isNotEmpty) ...[
8.height, 8.height,
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1), const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
8.height, 8.height,
_buildTextWidget(comment), _buildTextWidget(comment),
]
], ],
), ).toShadowContainer(context);
8.height,
],
).toShadowContainer(context).paddingOnly(top: 14, start: 14, end: 14);
} }
int getIdstatus(String status) { int getIdstatus(String status) {

@ -174,7 +174,6 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
), ),
8.height, 8.height,
ESignature( ESignature(
title: "Signature", title: "Signature",
oldSignature: widget.isSender ? widget.model.senderEngSignature : widget.model.receiverEngSignature, oldSignature: widget.isSender ? widget.model.senderEngSignature : widget.model.receiverEngSignature,
newSignature: _signature, newSignature: _signature,
@ -184,8 +183,6 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
widget.isSender widget.isSender
? _formModel.senderEngSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}" ? _formModel.senderEngSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"
: _formModel.receiverEngSignature = "${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, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
SingleChildScrollView( SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
@ -196,8 +197,8 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
'${context.translation.quantity}: ${widget.gasRefillModel.gazRefillDetails[0].requestedQty}'.bodyText(context), '${context.translation.quantity}: ${widget.gasRefillModel.gazRefillDetails[0].requestedQty}'.bodyText(context),
'${context.translation.site}: ${widget.gasRefillModel.site.name}'.bodyText(context), '${context.translation.site}: ${widget.gasRefillModel.site.name}'.bodyText(context),
], ],
).paddingAll(16), ).toShadowContainer(context),
12.height, 8.height,
AppTimer( AppTimer(
label: context.translation.workingHours, label: context.translation.workingHours,
timer: _formModel.timer, timer: _formModel.timer,
@ -207,7 +208,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
return true; return true;
}, },
), ),
12.height, 8.height,
SingleItemDropDownMenu<Lookup, GasStatusProvider>( SingleItemDropDownMenu<Lookup, GasStatusProvider>(
context: context, context: context,
title: context.translation.reportStatus, title: context.translation.reportStatus,
@ -216,7 +217,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
_formModel.status = value; _formModel.status = value;
}, },
), ),
12.height, 8.height,
AppTextFormField( AppTextFormField(
labelText: context.translation.deliveredQuantity, labelText: context.translation.deliveredQuantity,
onSaved: (value) { onSaved: (value) {
@ -226,7 +227,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
controller: _deliveredQuantityController, controller: _deliveredQuantityController,
validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only", validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
), ),
12.height, 8.height,
/// TBD /// TBD
AppTextFormField( AppTextFormField(
@ -237,7 +238,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
onSaved: (value) {}, onSaved: (value) {},
), ),
], ],
).toShadowContainer(context).paddingAll(16), ),
).expanded, ).expanded,
AppFilledButton( AppFilledButton(
label: widget.gasRefillModel == null ? context.translation.submit : context.translation.update, label: widget.gasRefillModel == null ? context.translation.submit : context.translation.update,

@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:signature/signature.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/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_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) onSaved;
final Function(Uint8List) onChange; final Function(Uint8List) onChange;
final String title; final String title;
const ESignature({Key key, this.title, this.oldSignature, this.onSaved, this.onChange, this.newSignature}) : super(key: key); const ESignature({Key key, this.title, this.oldSignature, this.onSaved, this.onChange, this.newSignature}) : super(key: key);
@override @override
@ -50,6 +52,7 @@ class _ESignatureState extends State<ESignature> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
print(widget.oldSignature);
return FormField<String>(onSaved: (_) async { return FormField<String>(onSaved: (_) async {
widget.onSaved(signature); widget.onSaved(signature);
}, builder: (FormFieldState<String> state) { }, builder: (FormFieldState<String> state) {
@ -59,7 +62,7 @@ class _ESignatureState extends State<ESignature> {
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight), padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
decoration: BoxDecoration( 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), 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)], boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
), ),
@ -98,7 +101,7 @@ class _ESignatureState extends State<ESignature> {
height: 135.toScreenHeight, height: 135.toScreenHeight,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
padding: const EdgeInsets.only(bottom: 8), 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( : AbsorbPointer(
absorbing: !_editable, absorbing: !_editable,

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