0
class CategoryViewDetail extends StatefulWidget {
  const CategoryViewDetail({Key? key, required bool tabbarenable})
      : super(key: key);
@override
  Widget build(BuildContext context) {
    List<Tab> tabs = <Tab>[];

    return FutureBuilder<Categories>(
      future: _futureCategories,
      builder: (BuildContext context, AsyncSnapshot<Categories> snapshot) {
        if (snapshot.hasData) {
          final name = snapshot.data?.data;
          var filteredList = name
              ?.where((name) =>
                  name.name == 'Spor' ||
                  
              .toList();
//here I want to hide tabbar if the page comes with CategoryViewDetail(tabbarenable: false)
          for (int i = 0; i < filteredList!.length; i++) {
            tabs.add(
              Tab(
                child: Text(
                  ' ${filteredList[i].name}',
                  style: const TextStyle(
                      fontWeight: FontWeight.w700,
                      fontSize: 15.0,
                      fontFamily: 'Manrope',
                      color: Colors.black54),
                ),
              ),
            );
          }

I want to bypass tabbar if page comes with tabbareanble = false but in this way Build Widget does not recognise tabbarenable variable.

ayn help?

2
  • I'm not getting this line name.name == 'Spor' || .toList(); is there any typing mistakes or maybe I'm not aware of it. Commented Oct 23, 2021 at 16:35
  • the correct is: name.name == 'Spor'.toList();the problem I can not get the value of tabbarenable Commented Oct 23, 2021 at 16:37

1 Answer 1

2

Because this is a StatefulWidget, to access the parameter supplied to the widget in the State's build method you'll need to access the parameter through the State's widget property: widget.tabbarenable

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.