history method

Widget history()

Implementation

Widget history() {
  return Obx(
    () => controller.list.isEmpty
        ? const SizedBox()
        : Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(12),
              color: Colors.grey.shade200,
            ),
            child: Column(
              children: [
                ListView.builder(
                  reverse: true,
                  shrinkWrap: true,
                  physics: const NeverScrollableScrollPhysics(),
                  padding: const EdgeInsets.all(12),
                  itemBuilder: (context, index) => Padding(
                    padding: const EdgeInsets.only(bottom: 12),
                    child: Row(
                      children: [
                        const Padding(
                          padding: EdgeInsets.only(right: 12),
                          child: Icon(
                            Icons.timer_outlined,
                            color: Colors.grey,
                            size: 20,
                          ),
                        ),
                        Expanded(
                          child: InkWell(
                            onTap: () {
                              controller.getTransactionTrack(
                                billing: controller.list[index]['id_billing'],
                              );
                            },
                            child: Container(
                              color: Colors.grey.shade200,
                              child: Text(
                                controller.list[index]['id_billing'],
                                style: textCaption(color: Colors.grey),
                              ),
                            ),
                          ),
                        ),
                        GestureDetector(
                          onTap: () => controller.deleteHistoryTracking(
                              controller.list[index]['id']),
                          child: Container(
                            color: Colors.grey.shade200,
                            child: const Icon(
                              Icons.close,
                              color: Colors.grey,
                              size: 16,
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                  itemCount: controller.list.length,
                ),
                Container(
                  width: double.maxFinite,
                  height: 0.5,
                  color: Colors.grey,
                ),
                Padding(
                  padding: const EdgeInsets.symmetric(vertical: 12),
                  child: Center(
                    child: GestureDetector(
                      onTap: () => controller.deleteAllHistoryTracking(),
                      child: Container(
                        color: Colors.grey.shade200,
                        child: Text(
                          'Hapus riwayat pencarian',
                          style: textCustom(color: Colors.grey),
                        ),
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
  );
}