Modify cards for approval related view:

Features

Accept Approval, Pdf click and so on.

Getting started

Nothing is pre requisit.

Usage

you can use in in all kind of approval

class Form926View extends GetView<Form926Controller> {
  const Form926View({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppThemes.bgColor,
      appBar: AppBar(
        title: Obx(
          () => Row(
            children: [
              controller.isSearching.value
                  ? Expanded(
                      child: TextFormField(
                        controller: controller.searchController,
                        style: const TextStyle(color: Colors.white),
                        decoration: const InputDecoration(
                          fillColor: Colors.transparent,
                          hintText: 'Search',
                          hintStyle: TextStyle(color: Colors.white),
                        ),
                        onChanged: controller.onChangeWhenTypeSearch,
                      ),
                    )
                  : Expanded(
                      child: GestureDetector(
                        onTap: () => controller.isSearching.value = !controller.isSearching.value,
                        child: const Text('Bill Approval'),
                      ),
                    ),
            ],
          ),
        ),
        actions: [
          Obx(
            () => IconButton(
              onPressed: () {
                if (controller.isSearching.value) {
                  controller.searchController.clear();
                  controller.searchList.value = null;
                }
                controller.isSearching.value = !controller.isSearching.value;
              },
              icon: Icon(controller.isSearching.value ? Icons.close : Icons.search),
            ),
          ),
        ],
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          Card(
            margin: EdgeInsets.zero,
            child: Padding(
              padding: const EdgeInsets.all(10),
              child: Column(
                children: [
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Expanded(
                        child: InkWell(
                          onTap: () => controller.onTapStartDateTime(context),
                          child: Container(
                            height: 50,
                            padding: const EdgeInsets.all(10),
                            decoration: BoxDecoration(color: AppThemes.bgColor, border: Border.all()),
                            alignment: Alignment.center,
                            child: Obx(
                              () => Text(
                                getFormatedDate(controller.startDate.value),
                                textAlign: TextAlign.center,
                                style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
                              ),
                            ),
                          ),
                        ),
                      ),
                      Expanded(
                        child: InkWell(
                          onTap: () => controller.onTapEndDateTime(context),
                          child: Container(
                            height: 50,
                            alignment: Alignment.center,
                            padding: const EdgeInsets.all(10),
                            decoration: BoxDecoration(color: AppThemes.bgColor, border: Border.all()),
                            child: Obx(
                              () => Text(
                                getFormatedDate(controller.endDate.value),
                                textAlign: TextAlign.center,
                                style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
                              ),
                            ),
                          ),
                        ),
                      ),
                      Container(
                        height: 50,
                        decoration: BoxDecoration(border: Border.all(color: Colors.black), color: Colors.green),
                        child: IconButton(onPressed: controller.getSupplierBillApprovalList, icon: const Icon(Icons.search, color: Colors.white)),
                      ),
                    ],
                  ),
                  Obx(
                    () => Row(
                      children: [
                        Radio<String>(
                          value: 'W',
                          groupValue: controller.statusGroupValue.value,
                          onChanged: controller.setStatusGroupValue,
                        ),
                        const Text('Pending'),
                        Radio<String>(
                          value: 'A',
                          groupValue: controller.statusGroupValue.value,
                          onChanged: controller.setStatusGroupValue,
                        ),
                        const Text('Approved'),
                        Radio<String>(
                          value: 'H',
                          groupValue: controller.statusGroupValue.value,
                          onChanged: controller.setStatusGroupValue,
                        ),
                        const Text('Denied'),
                        const Spacer(),
                        Text(
                          '${(controller.isSearching.value) ? (controller.searchList.value?.length ?? 0) : controller.approvalList.value.length}',
                          style: const TextStyle(color: Colors.grey, fontSize: 12, fontWeight: FontWeight.bold),
                        ),
                      ],
                    ),
                  )
                ],
              ),
            ),
          ),
          const SizedBox(height: 10),
          Expanded(
            child: Obx(
              () => (controller.approvalList.value.isEmpty)
                  ? Center(child: LottieBuilder.asset(AppAssets.ASSET_LOTTIE_NO_DATA_FOLDER))
                  : controller.searchList.value == null
                      ? ListView.builder(
                          padding: const EdgeInsets.symmetric(horizontal: 10),
                          itemCount: controller.approvalList.value.length,
                          itemBuilder: (BuildContext context, int index) {
                            final approval = controller.approvalList.value[index];
                            return ApprovalSummaryCard(
                              titles: const [
                                'Bill No',
                                'Supplier',
                                'Prepared By',
                                'Status',
                              ],
                              values: [
                                approval.BILL_ID ?? '',
                                approval.SUPPLIER ?? '',
                                approval.PREPARED_BY_NAME ?? '',
                                approval.TASK_NAME ?? '',
                              ],
                              onTapFunction: () => Get.to(() => Form926DetailsView(approval: approval)),
                              acceptTap: () => controller.showApprovalForm(approval),
                              pdfTap: () => controller.showReport(approval),
                            );
                          },
                        )
                      : controller.searchList.value!.isEmpty
                          ? Center(child: LottieBuilder.asset(AppAssets.ASSET_LOTTIE_NO_DATA_SEARCH))
                          : ListView.builder(
                              padding: const EdgeInsets.symmetric(horizontal: 10),
                              itemCount: controller.searchList.value?.length,
                              itemBuilder: (BuildContext context, int index) {
                                final approval = controller.searchList.value![index];
                                return ApprovalSummaryCard(
                                  titles: const [
                                    'Bill No',
                                    'Supplier',
                                    'Prepared By',
                                    'Status',
                                  ],
                                  values: [
                                    approval.BILL_ID ?? '',
                                    approval.SUPPLIER ?? '',
                                    approval.PREPARED_BY_NAME ?? '',
                                    approval.TASK_NAME ?? '',
                                  ],
                                  onTapFunction: () => Get.to(() => Form926DetailsView(approval: approval)),
                                  acceptTap: () => controller.showApprovalForm(approval),
                                  pdfTap: () => controller.showReport(approval),
                                );
                              },
                            ),
            ),
          ),
        ],
      ),
    );
  }
}

## Additional information

to contribute this project email me dev.nizamuddin@gmail.com