Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
25 kB
2
Indexable
Never
Row(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              //Scroll button
              BlocBuilder<AllClaimListBloc, AllClaimListState>(
                builder: (context, state) {
                  if (context.read<AllClaimListBloc>().selectedPaginationIndex >
                      0)
                    return Visibility(
                      visible: context
                              .read<AllClaimListBloc>()
                              .selectedPaginationIndex >
                          0,
                      child: InkWell(
                        onTap: () {
                          context
                              .read<AllClaimListBloc>()
                              .selectedPaginationIndex = context
                                  .read<AllClaimListBloc>()
                                  .selectedPaginationIndex -
                              1;
                          int limits = state.limit;
                          if (state.allClaimListModel?.results != null) {
                            context.loaderOverlay.show();
                            if (context
                                        .read<AllClaimListBloc>()
                                        .state
                                        .claimStatus ==
                                    null &&
                                context
                                        .read<AllClaimListBloc>()
                                        .state
                                        .isSorting ==
                                    null &&
                                context
                                        .read<AllClaimListBloc>()
                                        .state
                                        .searchController
                                        ?.text
                                        .trim() ==
                                    null &&
                                context
                                    .read<AllClaimListBloc>()
                                    .state
                                    .searchController!
                                    .text
                                    .isNotEmpty) {
                              context.read<AllClaimListBloc>().add(
                                    AllClaimListInitialEvent(
                                      limit: limits,
                                      index: context
                                          .read<AllClaimListBloc>()
                                          .selectedPaginationIndex,
                                      isSorting: context
                                          .read<AllClaimListBloc>()
                                          .state
                                          .isSorting,
                                    ),
                                  );
                            } else {
                              context.read<AllClaimListBloc>().add(
                                    GetSearchListEvent(
                                      limit: limits,
                                      index: context
                                          .read<AllClaimListBloc>()
                                          .selectedPaginationIndex,
                                      claimStatus: context
                                          .read<AllClaimListBloc>()
                                          .state
                                          .claimStatus,
                                      isSorting: context
                                          .read<AllClaimListBloc>()
                                          .state
                                          .isSorting,
                                      searchText: context
                                          .read<AllClaimListBloc>()
                                          .state
                                          .searchController
                                          ?.text
                                          .trim(),
                                    ),
                                  );
                            }
                          }
                        },
                        child: Container(
                          height: CommonUtils.isSmallScreen(context) == true
                              ? 40
                              : 50,
                          width: CommonUtils.isSmallScreen(context) == true
                              ? 40
                              : 50,
                          decoration: BoxDecoration(
                            border: Border.all(
                              color: ColorConstant.black90026,
                              width: getHorizontalSize(1.00),
                            ),
                            borderRadius: BorderRadius.circular(
                              getHorizontalSize(2.00),
                            ),
                          ),
                          child: Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: CustomImageView(
                              svgPath: ImageConstant.imgIconleftoutlined,
                              height: CommonUtils.isSmallScreen(context) == true
                                  ? 12
                                  : CommonUtils.isMediumScreen(context) == true
                                      ? 14
                                      : 18,
                              width: CommonUtils.isSmallScreen(context) == true
                                  ? 12
                                  : CommonUtils.isMediumScreen(context) == true
                                      ? 14
                                      : 18,
                            ),
                          ),
                        ),
                      ),
                    );
                  return Container(
                    height:
                        CommonUtils.isSmallScreen(context) == true ? 40 : 50,
                    width: CommonUtils.isSmallScreen(context) == true ? 40 : 50,
                    decoration: BoxDecoration(
                      border: Border.all(
                        color: ColorConstant.gray100,
                        width: getHorizontalSize(1.00),
                      ),
                      borderRadius: BorderRadius.circular(
                        getHorizontalSize(2.00),
                      ),
                    ),
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: CustomImageView(
                        svgPath: ImageConstant.imgIconleftoutlined,
                        color: ColorConstant.black90026,
                        height: CommonUtils.isSmallScreen(context) == true
                            ? 12
                            : CommonUtils.isMediumScreen(context) == true
                                ? 14
                                : 18,
                        width: CommonUtils.isSmallScreen(context) == true
                            ? 12
                            : CommonUtils.isMediumScreen(context) == true
                                ? 14
                                : 18,
                      ),
                    ),
                  );
                },
              ),
              Builder(
                builder: (context) {
                  return Flexible(
                    child: Container(
                      height: CommonUtils.isSmallScreen(context) == true
                          ? 40
                          : CommonUtils.isMediumScreen(context) == true
                              ? 48
                              : 50,
                      width: CommonUtils.isSmallScreen(context) == true
                          ? getSize(220)
                          : CommonUtils.isMediumScreen(context) == true
                              ? getSize(270)
                              : getSize(360),
                      child: BlocBuilder<AllClaimListBloc, AllClaimListState>(
                        builder: (context, state) {
                          /*for item count on data load page*/
                          final int count = state.allClaimListModel?.count ?? 0;
                          int limits = state.limit;
                          int itemCount = (count % limits > 0
                                  ? (count / limits) + 1
                                  : count / limits)
                              .floor();
                          return ListView.builder(
                            scrollDirection: Axis.horizontal,
                            itemCount: itemCount,
                            itemBuilder: (BuildContext context, int index) {
                              return Padding(
                                padding: const EdgeInsets.only(left: 10.0),
                                child: Container(
                                  height: 35,
                                  width: CommonUtils.isSmallScreen(context) ==
                                          true
                                      ? 40
                                      : CommonUtils.isMediumScreen(context) ==
                                              true
                                          ? 60
                                          : 80,
                                  child: CustomButton(
                                    onTap: () {
                                      if (context
                                              .read<AllClaimListBloc>()
                                              .selectedPaginationIndex !=
                                          index) {
                                        context.loaderOverlay.show();
                                        context
                                            .read<AllClaimListBloc>()
                                            .selectedPaginationIndex = index;
                                        if (state.allClaimListModel?.results !=
                                            null) {
                                          if (context
                                                      .read<AllClaimListBloc>()
                                                      .state
                                                      .claimStatus ==
                                                  null &&
                                              context
                                                      .read<AllClaimListBloc>()
                                                      .state
                                                      .isSorting ==
                                                  null &&
                                              context
                                                      .read<AllClaimListBloc>()
                                                      .state
                                                      .searchController
                                                      ?.text
                                                      .trim() ==
                                                  null &&
                                              context
                                                  .read<AllClaimListBloc>()
                                                  .state
                                                  .searchController!
                                                  .text
                                                  .isNotEmpty) {
                                            context
                                                .read<AllClaimListBloc>()
                                                .add(
                                                  AllClaimListInitialEvent(
                                                    limit: limits,
                                                    index: context
                                                        .read<
                                                            AllClaimListBloc>()
                                                        .selectedPaginationIndex,
                                                    isSorting: context
                                                        .read<
                                                            AllClaimListBloc>()
                                                        .state
                                                        .isSorting,
                                                  ),
                                                );
                                          } else {
                                            context
                                                .read<AllClaimListBloc>()
                                                .add(
                                                  GetSearchListEvent(
                                                    limit: limits,
                                                    index: context
                                                        .read<
                                                            AllClaimListBloc>()
                                                        .selectedPaginationIndex,
                                                    claimStatus: context
                                                        .read<
                                                            AllClaimListBloc>()
                                                        .state
                                                        .claimStatus,
                                                    isSorting: context
                                                        .read<
                                                            AllClaimListBloc>()
                                                        .state
                                                        .isSorting,
                                                    searchText: context
                                                        .read<
                                                            AllClaimListBloc>()
                                                        .state
                                                        .searchController
                                                        ?.text
                                                        .trim(),
                                                  ),
                                                );
                                          }
                                        }
                                      }
                                    },
                                    text: (index + 1).toString(),
                                    variant: context
                                                .read<AllClaimListBloc>()
                                                .selectedPaginationIndex ==
                                            index
                                        ? ButtonVariant.OutlineBlue
                                        : ButtonVariant.OutlineBlack90026_1,
                                  ),
                                ),
                              );
                            },
                          );
                        },
                      ),
                    ),
                  );
                },
              ),
              BlocBuilder<AllClaimListBloc, AllClaimListState>(
                builder: (context, state) {
                  int limits = state.limit;
                  final int count = state.allClaimListModel?.count ??
                      /*state.getSearchListModelObj?.count ??*/
                      0;
                  int itemCount = (count % limits > 0
                          ? (count / limits) + 1
                          : count / limits)
                      .floor();
                  if (context.read<AllClaimListBloc>().selectedPaginationIndex <
                      itemCount - 1) {
                    return Visibility(
                      visible: context
                              .read<AllClaimListBloc>()
                              .selectedPaginationIndex <
                          itemCount - 1,
                      child: Padding(
                        padding: const EdgeInsets.only(
                          left: 8.0,
                        ),
                        child: InkWell(
                          onTap: () {
                            context.loaderOverlay.show();
                            context
                                .read<AllClaimListBloc>()
                                .selectedPaginationIndex = context
                                    .read<AllClaimListBloc>()
                                    .selectedPaginationIndex +
                                1;
                            if (state.allClaimListModel?.results != null) {
                              context.loaderOverlay.show();
                              if (context
                                          .read<AllClaimListBloc>()
                                          .state
                                          .claimStatus ==
                                      null &&
                                  context
                                          .read<AllClaimListBloc>()
                                          .state
                                          .isSorting ==
                                      null &&
                                  context
                                          .read<AllClaimListBloc>()
                                          .state
                                          .searchController
                                          ?.text
                                          .trim() ==
                                      null &&
                                  context
                                      .read<AllClaimListBloc>()
                                      .state
                                      .searchController!
                                      .text
                                      .isNotEmpty) {
                                context.read<AllClaimListBloc>().add(
                                      AllClaimListInitialEvent(
                                        limit: limits,
                                        index: context
                                            .read<AllClaimListBloc>()
                                            .selectedPaginationIndex,
                                        isSorting: context
                                            .read<AllClaimListBloc>()
                                            .state
                                            .isSorting,
                                      ),
                                    );
                              } else {
                                context.read<AllClaimListBloc>().add(
                                      GetSearchListEvent(
                                        limit: limits,
                                        index: context
                                            .read<AllClaimListBloc>()
                                            .selectedPaginationIndex,
                                        claimStatus: context
                                            .read<AllClaimListBloc>()
                                            .state
                                            .claimStatus,
                                        isSorting: context
                                            .read<AllClaimListBloc>()
                                            .state
                                            .isSorting,
                                        searchText: context
                                            .read<AllClaimListBloc>()
                                            .state
                                            .searchController
                                            ?.text
                                            .trim(),
                                      ),
                                    );
                              }
                            }
                          },
                          child: Container(
                            height: CommonUtils.isSmallScreen(context) == true
                                ? 40
                                : 50,
                            width: CommonUtils.isSmallScreen(context) == true
                                ? 40
                                : 50,
                            decoration: BoxDecoration(
                              border: context
                                          .read<AllClaimListBloc>()
                                          .selectedPaginationIndex <
                                      itemCount - 1
                                  ? Border.all(
                                      color: ColorConstant.black90026,
                                      width: getHorizontalSize(1.00),
                                    )
                                  : Border.all(
                                      color: ColorConstant.black90026,
                                      width: getHorizontalSize(1.00),
                                    ),
                              borderRadius: BorderRadius.circular(
                                getHorizontalSize(2.00),
                              ),
                            ),
                            child: Padding(
                              padding: const EdgeInsets.all(8.0),
                              child: CustomImageView(
                                svgPath:
                                    ImageConstant.imgIconrightoutlinedBlack900,
                                height:
                                    CommonUtils.isSmallScreen(context) == true
                                        ? 12
                                        : CommonUtils.isMediumScreen(context) ==
                                                true
                                            ? 14
                                            : 18,
                                width:
                                    CommonUtils.isSmallScreen(context) == true
                                        ? 12
                                        : CommonUtils.isMediumScreen(context) ==
                                                true
                                            ? 14
                                            : 18,
                              ),
                            ),
                          ),
                        ),
                      ),
                    );
                  }
                  return Padding(
                    padding: const EdgeInsets.only(left: 8.0),
                    child: Container(
                      height:
                          CommonUtils.isSmallScreen(context) == true ? 40 : 50,
                      width:
                          CommonUtils.isSmallScreen(context) == true ? 40 : 50,
                      decoration: BoxDecoration(
                        border: Border.all(
                          color: ColorConstant.black9001e,
                          width: getHorizontalSize(1.00),
                        ),
                        borderRadius: BorderRadius.circular(
                          getHorizontalSize(2.00),
                        ),
                      ),
                      child: Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: CustomImageView(
                          svgPath: ImageConstant.imgIconrightoutlinedBlack900,
                          color: ColorConstant.black9001e,
                          height: CommonUtils.isSmallScreen(context) == true
                              ? 12
                              : CommonUtils.isMediumScreen(context) == true
                                  ? 14
                                  : 18,
                          width: CommonUtils.isSmallScreen(context) == true
                              ? 12
                              : CommonUtils.isMediumScreen(context) == true
                                  ? 14
                                  : 18,
                        ),
                      ),
                    ),
                  );
                },
              ),
            ],
          ),