showWeighingDiffDialog method

void showWeighingDiffDialog()

Implementation

void showWeighingDiffDialog() {
  Get.dialog(
    GenericDialogBox(
      headerText: 'Weighing Difference',
      content: Column(
        children: [
          Container(
            padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
            decoration: BoxDecoration(
              color: AppColors.blue,
              borderRadius: RadiusUtils.borderRadiusForButtons,
            ),
            child: Row(
              children: [
                Expanded(
                    child: AppText('Weight(KG)',
                        style: TextStyles.medium(Get.context!,
                            textColor: Colors.white))),
                Expanded(
                    child: AppText('Source',
                        style: TextStyles.medium(Get.context!,
                            textColor: Colors.white))),
                Expanded(
                    child: AppText('Destination',
                        style: TextStyles.medium(Get.context!,
                            textColor: Colors.white))),
                Expanded(
                    child: AppText('Difference',
                        style: TextStyles.medium(Get.context!,
                            textColor: Colors.white))),
              ],
            ),
          ),
          Container(
            padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
            decoration: BoxDecoration(
              borderRadius: RadiusUtils.borderRadiusForButtons,
            ),
            child: Row(
              children: [
                Expanded(
                    child: AppText('Gross',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        loadingWeightTO.value.grossWeight?.toString() ?? '0',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        unloadingWeightTO.value.grossWeight?.toString() ??
                            '0',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        diffWeightTO.value.grossWeight?.toString() ?? '0',
                        style: TextStyles.medium(Get.context!))),
              ],
            ),
          ),
          buildDivider(),
          Container(
            padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
            decoration: BoxDecoration(
              borderRadius: RadiusUtils.borderRadiusForButtons,
            ),
            child: Row(
              children: [
                Expanded(
                    child: AppText('Tare',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        loadingWeightTO.value.tareWeight?.toString() ?? '0',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        unloadingWeightTO.value.tareWeight?.toString() ?? '0',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        diffWeightTO.value.tareWeight?.toString() ?? '0',
                        style: TextStyles.medium(Get.context!))),
              ],
            ),
          ),
          buildDivider(),
          Container(
            padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
            decoration: BoxDecoration(
              borderRadius: RadiusUtils.borderRadiusForButtons,
            ),
            child: Row(
              children: [
                Expanded(
                    child: AppText('Net',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        loadingWeightTO.value.netWeight?.toString() ?? '0',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        unloadingWeightTO.value.netWeight?.toString() ?? '0',
                        style: TextStyles.medium(Get.context!))),
                Expanded(
                    child: AppText(
                        diffWeightTO.value.netWeight?.toString() ?? '0',
                        style: TextStyles.medium(Get.context!))),
              ],
            ),
          ),
          buildDivider(),
          buildSizeHeight(20),
          Align(
            alignment: Alignment.centerLeft,
            child: SizedBox(
              width: double.infinity,
              child: buildHeaderBoldWithHash(Get.context!, 'Remark',
                  isMandatory: true),
            ),
          ),
          buildSizeHeight(10.0),
          Align(
            alignment: Alignment.centerLeft,
            child: SizedBox(
              width: double.infinity,
              child: AppTextFieldFormWidget(
                isValidator: true,
                hint: 'Remark',
                validationMessage: 'Enter Remark',
                maxLines: 3,
                maxLength: 100,
                controller: TextEditingController(
                  text: tempTblTRLoadingTO.value.weighingRemark ?? '',
                ),
                onChanged: (value) {
                  tempTblTRLoadingTO.update((val) {
                    val?.weighingRemark = value;
                  });
                },
              ),
            ),
          )
        ],
      ),
      primaryButtonText: AppStrings.submit,
      secondaryButtonText: AppStrings.close,
      onPrimaryButtonPressed: () {
        if (tempTblTRLoadingTO.value.weighingRemark?.isNotEmpty ?? false) {
          updateWeighingRemark();
        } else {
          AppUtils.showSnackBar('Please enter a remark');
        }
      },
      onSecondaryButtonPressed: Get.back,
    ),
  );
}