Untitled

mail@pastecode.io avatar
unknown
dart
a year ago
2.0 kB
1
Indexable
Never
onTap: () async {
                if (widget.categoryId != null) {
                  if (widget.categoryType == 1) {
                    print(widget.categoryId);
                    categoriesNotifier.selections.type = 'category';
                    categoriesNotifier.selections.id = widget.categoryId;
                    await categoriesNotifier
                        .getAllCategories(categoriesNotifier.selections);

                    categoriesNotifier.setCategoriesTabIndex(
                      categoriesNotifier.mainCategoriesTab.indexWhere(
                        (MainCategoriesTabs element) =>
                            element.id == widget.categoryId,
                      ),
                    );

                    print(
                      categoriesNotifier.mainCategoriesTab.indexWhere(
                          (MainCategoriesTabs element) =>
                              element.id == widget.categoryId),
                    );

                    navBarNotifier.setSelectedIndex(2);
                  } else if (widget.categoryType == 2) {
                    await homeNotifier.getHomeStrips(
                        stripId: widget.categoryId!);
                    await Navigator.of(context).push(
                      MaterialPageRoute(
                        builder: (BuildContext context) => HomeMoreCategoryPage(
                          categoryName: widget.title,
                          moreBooks: homeNotifier.homeStripBooks,
                        ),
                      ),
                    );
                  }
                } else {
                  await Navigator.of(context).push(
                    MaterialPageRoute(
                      builder: (BuildContext context) => HomeMoreCategoryPage(
                        categoryName: widget.title,
                        moreBooks: widget.moreBooks,
                      ),
                    ),
                  );
                }
              },