showSheetMenuAll method

dynamic showSheetMenuAll({
  1. bool? autoFocus,
})

Implementation

showSheetMenuAll({bool? autoFocus}) {
  showSheetCustom(
    context: Get.context!,
    content: Padding(
      padding: const EdgeInsets.all(24),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              const Text("Pilih Menu"),
              GestureDetector(
                onTap: () {
                  Navigator.pop(Get.context!);
                  controller.resetPaymentGroupFilter();
                },
                child: const Icon(
                  Icons.close,
                  color: Colors.red,
                ),
              ),
            ],
          ),
          Padding(
            padding: const EdgeInsets.symmetric(vertical: 12),
            child: SizedBox(
              height: 40,
              child: TextField(
                autofocus: autoFocus ?? false,
                onChanged: (value) {
                  controller.changePaymentGroupFilter(value);
                },
                decoration: InputDecoration(
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(16),
                    borderSide: BorderSide.none,
                  ),
                  filled: true,
                  fillColor: Colors.grey.shade200,
                  prefixIcon: Icon(
                    Icons.search,
                    color: Strings.primaryColor,
                    size: 16,
                  ),
                  hintText: 'Cari Pembayaran',
                  hintStyle: textCaption(color: Colors.grey.shade400),
                  contentPadding: const EdgeInsets.symmetric(vertical: 10),
                ),
                style: textCaption(),
              ),
            ),
          ),
          Obx(() => Text(
                controller.listPaymentGroupFilter.isEmpty
                    ? 'Menu tidak tersedia'
                    : 'Menu yang tersedia',
                style: textBody2(),
              )),
          Obx(
            () => ListView.builder(
              shrinkWrap: true,
              padding: const EdgeInsets.symmetric(vertical: 12),
              physics: const NeverScrollableScrollPhysics(),
              itemBuilder: (context, index) {
                var data = controller.listPaymentGroupFilter[index];
                return Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    GestureDetector(
                      onTap: () async {
                        Get.back();
                        Get.lazyPut(() => PaymentController());
                        await Get.to(() => PaymentScreen(), arguments: data)
                            ?.then(
                          (value) => controller.getHistory(),
                        );
                        // await Get.toNamed(Strings.paymentRoute,
                        //         arguments: data)
                        //     ?.then(
                        //   (value) => controller.getHistory(),
                        // );
                      },
                      child: Container(
                        color: Colors.transparent,
                        padding: const EdgeInsets.symmetric(
                          vertical: 12,
                          horizontal: 8,
                        ),
                        child: Row(
                          children: [
                            Expanded(
                              child: Row(
                                children: [
                                  Image.network(
                                    data.icon ?? "",
                                    errorBuilder:
                                        (context, error, stackTrace) {
                                      return const Icon(Icons.close);
                                    },
                                    width: 24,
                                  ),
                                  const SizedBox(width: 8),
                                  Text(
                                    data.name ?? "-",
                                    style: textBody2(),
                                  ),
                                ],
                              ),
                            ),
                            const Icon(
                              Icons.arrow_forward_ios,
                              size: 16,
                            ),
                          ],
                        ),
                      ),
                    ),
                    index == (controller.listPaymentGroupFilter.length - 1)
                        ? const SizedBox()
                        : const Divider(
                            color: Colors.grey,
                          ),
                  ],
                );
              },
              itemCount: controller.listPaymentGroupFilter.length,
            ),
          ),
        ],
      ),
    ),
  );
}