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.
		
		
		
		
		
			
		
			
				
	
	
		
			114 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			114 lines
		
	
	
		
			4.1 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/widgets/button/default_button.dart';
 | 
						|
import 'package:mohem_flutter_app/widgets/input_widget.dart';
 | 
						|
 | 
						|
class ITGCommentsDialog extends StatelessWidget {
 | 
						|
  final String? title;
 | 
						|
  final String? message;
 | 
						|
  final String? okTitle;
 | 
						|
  final String? actionMode;
 | 
						|
  final Function(String) onTap;
 | 
						|
 | 
						|
  ITGCommentsDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap, 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",
 | 
						|
              LocaleKeys.comments.tr(),
 | 
						|
              TextEditingController(),
 | 
						|
              isBackgroundEnable: true,
 | 
						|
              isInputTypeNum: false,
 | 
						|
              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" ? LocaleKeys.reject.tr() : LocaleKeys.approve.tr(),
 | 
						|
                  () {
 | 
						|
                    if (actionMode == "REJECTED" && note.isEmpty) {
 | 
						|
                      Utils.showToast(LocaleKeys.pleaseEnterComments.tr());
 | 
						|
                    } else {
 | 
						|
                      Navigator.pop(context);
 | 
						|
                      onTap(note);
 | 
						|
                    }
 | 
						|
                  },
 | 
						|
                  colors: actionMode == "REJECTED"
 | 
						|
                      ? const [
 | 
						|
                          Color(0xffE47A7E),
 | 
						|
                          Color(0xffE47A7E),
 | 
						|
                        ]
 | 
						|
                      : const [
 | 
						|
                          Color(0xff28C884),
 | 
						|
                          Color(0xff1BB271),
 | 
						|
                        ],
 | 
						|
                ).expanded,
 | 
						|
              ],
 | 
						|
            ),
 | 
						|
          ],
 | 
						|
        ),
 | 
						|
      ),
 | 
						|
    );
 | 
						|
  }
 | 
						|
}
 |