Untitled

mail@pastecode.io avatar
unknown
dart
a month ago
7.7 kB
4
Indexable
Never
import 'package:evogate/app/modules/requests/new_create_request/controller/create_new_invitation_controller.dart';
import 'package:evogate/app/server/models/buildings.dart';
import 'package:evogate/app/server/models/rooms.dart';
import 'package:evogate/app/widgets/custom_input.dart';
import 'package:evogate/app/widgets/custom_text.dart';
import 'package:evogate/app/widgets/custom_text_field_with_lable.dart';
import 'package:evogate/app/widgets/loading_widget.dart';
import 'package:evogate/app/widgets/title_widget.dart';
import 'package:evogate/resources/strings_generated.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../../../server/models/floors.dart';

class InvitationDetails extends StatelessWidget {
  const InvitationDetails({super.key});

  @override
  Widget build(BuildContext context) {
    return GetBuilder<CreateNewInvitationController>(builder: (c) {
      Get.log(c.rooms.length.toString());
      return GestureDetector(
        onTap: () {
          FocusManager.instance.primaryFocus?.unfocus();
        },
        child: Form(
          key: c.keyOfForm,
          child: Column(
            children: [
              SizedBox(height: 20.h),
              TitleWidget(
                title: AppStrings.invitationDetails,
              ),
              SizedBox(height: 10.h),
              CustomTextFieldWithLabel(
                fillColor: Colors.transparent,
                controller: c.subjectController,
                label: AppStrings.subject,
                validator: (value) {
                  if (value?.isEmpty == true) {
                    return AppStrings.validation;
                  }
                  return null;
                },
              ),
              const SizedBox(height: 10),
              CustomTextFieldWithLabel(
                fillColor: Colors.transparent,
                controller: c.companyController,
                label: AppStrings.companyName,
              ),
              const SizedBox(height: 10),
              Row(
                children: [
                  Flexible(child: Note(AppStrings.buildings)),
                  if (c.gettingBuildings) ...[
                    const SizedBox(width: 10),
                    const Flexible(
                      child: Note(
                        "( ...",
                        italic: true,
                        fontSize: 10,
                      ),
                    ),
                    const SizedBox(width: 5),
                    const LoadingWidget(
                      dimension: 10,
                      thickness: 1,
                      color: Colors.black54,
                    ),
                    const Flexible(
                      child: Note(
                        " )",
                        italic: true,
                        fontSize: 10,
                      ),
                    ),
                  ],
                ],
              ),
              SizedBox(height: 5.h),
              CustomDropDown<Building>(
                fillColor: Colors.transparent,
                items: c.buildings,
                hintText: '',
                value: c.isEdit == true ? c.building : null,
                onChanged: c.buildingSetter,
                validator: (value) {
                  if (value == null) {
                    return AppStrings.validation;
                  }
                  return null;
                },
              ),
              const SizedBox(height: 10),
              Row(
                children: [
                  Flexible(child: Note(AppStrings.floor)),
                  if (c.gettingFloors) ...[
                    const SizedBox(width: 10),
                    const Flexible(
                      child: Note(
                        "( ...",
                        italic: true,
                        fontSize: 10,
                      ),
                    ),
                    const SizedBox(width: 5),
                    const LoadingWidget(
                      dimension: 10,
                      thickness: 1,
                      color: Colors.black54,
                    ),
                    const Flexible(
                      child: Note(
                        " )",
                        italic: true,
                        fontSize: 10,
                      ),
                    ),
                  ],
                ],
              ),
              SizedBox(height: 5.h),
              CustomDropDown<Floor>(
                fillColor: Colors.transparent,
                items: c.floors,
                hintText: '',
                value: c.isEdit == true ? c.floor : null,
                onChanged: c.floorSetter,
                validator: (value) {
                  if (value == null) {
                    return AppStrings.validation;
                  }
                  return null;
                },
              ),
              const SizedBox(height: 10),
              Row(
                children: [
                  Flexible(
                      child: Note(
                    AppStrings.room,
                    color: Theme.of(context)
                        .textTheme
                        .titleMedium
                        ?.color
                        ?.withOpacity(
                          c.rooms.isEmpty ? 0.5 : 0.9,
                        ),
                  )),
                  if (c.gettingRooms) ...[
                    const SizedBox(width: 10),
                    const Flexible(
                      child: Note(
                        "( ...",
                        italic: true,
                        fontSize: 10,
                      ),
                    ),
                    const SizedBox(width: 5),
                    const LoadingWidget(
                      dimension: 10,
                      thickness: 1,
                      color: Colors.black54,
                    ),
                    const Flexible(
                      child: Note(
                        " )",
                        italic: true,
                        fontSize: 10,
                      ),
                    ),
                  ],
                ],
              ),
              SizedBox(height: 5.h),
              IgnorePointer(
                ignoring: c.rooms.isEmpty,
                child: CustomDropDown<Room>(
                  fillColor: Colors.transparent,
                  items: c.rooms,
                  hintText: '',
                  value: c.isEdit == true ? c.room : null,
                  onChanged: c.roomNumberSetter,
                  iconColor: c.rooms.isEmpty
                      ? Theme.of(context).colorScheme.outline
                      : Theme.of(context).colorScheme.primary,
                  validator: (value) {
                    if (value == null) {
                      return AppStrings.validation;
                    }
                    return null;
                  },
                ),
              ),
              SizedBox(height: 10.h),
              CustomTextFieldWithLabel(
                fillColor: Colors.transparent,
                controller: c.notesController,
                label: AppStrings.notes,
                maximumLines: 3,
              ),
              SizedBox(height: 15.h),
            ],
          ),
        ),
      );
    });
  }
}
Leave a Comment