You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			123 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			123 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Dart
		
	
import 'package:easy_localization/src/public_ext.dart';
 | 
						|
import 'package:flutter/cupertino.dart';
 | 
						|
import 'package:flutter/material.dart';
 | 
						|
import 'package:mohem_flutter_app/classes/colors.dart';
 | 
						|
import 'package:mohem_flutter_app/classes/utils.dart';
 | 
						|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
 | 
						|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
 | 
						|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
 | 
						|
import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart';
 | 
						|
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
 | 
						|
import 'package:mohem_flutter_app/widgets/input_widget.dart';
 | 
						|
 | 
						|
class AcceptRejectInputDialog extends StatelessWidget {
 | 
						|
  final String? title;
 | 
						|
  final String? message;
 | 
						|
  final String? okTitle;
 | 
						|
  final String? actionMode;
 | 
						|
  final NotificationGetRespondAttributesList? notificationGetRespond;
 | 
						|
  final Function(String) onTap;
 | 
						|
 | 
						|
  // final TextEditingController textEditingController;
 | 
						|
 | 
						|
  AcceptRejectInputDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap, this.notificationGetRespond, this.actionMode}) : super(key: key);
 | 
						|
 | 
						|
  String note = "";
 | 
						|
 | 
						|
  @override
 | 
						|
  Widget build(BuildContext context) {
 | 
						|
    return Dialog(
 | 
						|
      backgroundColor: Colors.white,
 | 
						|
      shape: const RoundedRectangleBorder(),
 | 
						|
      insetPadding: const EdgeInsets.only(left: 21, right: 21),
 | 
						|
      child: Padding(
 | 
						|
        padding: const EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28),
 | 
						|
        child: Column(
 | 
						|
          crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
          mainAxisSize: MainAxisSize.min,
 | 
						|
          children: [
 | 
						|
            Row(
 | 
						|
              crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
              children: [
 | 
						|
                Expanded(
 | 
						|
                  child: Padding(
 | 
						|
                    padding: const EdgeInsets.only(top: 16.0),
 | 
						|
                    child: Text(
 | 
						|
                      title ?? LocaleKeys.confirm.tr(),
 | 
						|
                      style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96),
 | 
						|
                    ),
 | 
						|
                  ),
 | 
						|
                ),
 | 
						|
                IconButton(
 | 
						|
                  padding: EdgeInsets.zero,
 | 
						|
                  icon: const Icon(Icons.close),
 | 
						|
                  color: const Color(0xff2B353E),
 | 
						|
                  constraints: const BoxConstraints(),
 | 
						|
                  onPressed: () {
 | 
						|
                    Navigator.pop(context);
 | 
						|
                  },
 | 
						|
                )
 | 
						|
              ],
 | 
						|
            ),
 | 
						|
            Text(
 | 
						|
              message ?? "",
 | 
						|
              style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48),
 | 
						|
            ),
 | 
						|
            if (notificationGetRespond != null) ...[
 | 
						|
              14.height,
 | 
						|
              InputWidget(
 | 
						|
                "Enter a Note",
 | 
						|
                notificationGetRespond!.attributeDisplayName!,
 | 
						|
                TextEditingController(),
 | 
						|
                isBackgroundEnable: true,
 | 
						|
                isInputTypeNum: notificationGetRespond!.attributeType == "number",
 | 
						|
                lines: 3,
 | 
						|
                onChange: (String note) {
 | 
						|
                  this.note = note;
 | 
						|
                },
 | 
						|
              ),
 | 
						|
            ],
 | 
						|
            28.height,
 | 
						|
            Row(
 | 
						|
              children: [
 | 
						|
                DefaultButton(
 | 
						|
                  LocaleKeys.cancel.tr(),
 | 
						|
                  () => Navigator.pop(context),
 | 
						|
                  colors: const [MyColors.lightGreyEAColor, MyColors.lightGreyEAColor],
 | 
						|
                  textColor: MyColors.darkTextColor,
 | 
						|
                ).expanded,
 | 
						|
                10.width,
 | 
						|
                DefaultButton(
 | 
						|
                  (actionMode == "REJECTED" || actionMode == "REJECT") ? LocaleKeys.reject.tr() : LocaleKeys.ok.tr(),
 | 
						|
                  () {
 | 
						|
                    if (note.isEmpty) {
 | 
						|
                      if ((actionMode != "REJECTED" && actionMode != "REJECT") && actionMode != "ANSWER_INFO" && actionMode != "RFC") {
 | 
						|
                        Navigator.pop(context);
 | 
						|
                        onTap(note);
 | 
						|
                      } else {
 | 
						|
                        Utils.showToast(LocaleKeys.pleaseEnterComments.tr());
 | 
						|
                      }
 | 
						|
                    } else {
 | 
						|
                      Navigator.pop(context);
 | 
						|
                      onTap(note);
 | 
						|
                    }
 | 
						|
                  },
 | 
						|
                  colors: (actionMode == "REJECTED" || actionMode == "REJECT")
 | 
						|
                      ? const [
 | 
						|
                          Color(0xffE47A7E),
 | 
						|
                          Color(0xffE47A7E),
 | 
						|
                        ]
 | 
						|
                      : const [
 | 
						|
                          Color(0xff28C884),
 | 
						|
                          Color(0xff1BB271),
 | 
						|
                        ],
 | 
						|
                ).expanded,
 | 
						|
              ],
 | 
						|
            ),
 | 
						|
          ],
 | 
						|
        ),
 | 
						|
      ),
 | 
						|
    );
 | 
						|
  }
 | 
						|
}
 |