Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelectedCategoryPage Error #20

Open
MarioCastle opened this issue Jun 10, 2022 · 4 comments
Open

SelectedCategoryPage Error #20

MarioCastle opened this issue Jun 10, 2022 · 4 comments

Comments

@MarioCastle
Copy link

import 'package:boss111/models/category.dart';
import 'package:boss111/pages/detailspage.dart';
import 'package:boss111/widgets/categoryicon.dart';
import 'package:flutter/material.dart';

import '../../../widgets/mainappbar.dart';

class SelectedCategoryPage extends StatelessWidget {
Category? selectedCategory;
SelectedCategoryPage({this.selectedCategory});

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: MainAppBar(),
body: Container(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CategoryIcon(
color: this.selectedCategory!.color!,
iconName: this.selectedCategory!.icon!),
SizedBox(width: 10),
Text(
this.selectedCategory!.name!,
style: TextStyle(
color: this.selectedCategory!.color!, fontSize: 20),
),
],
),
SizedBox(height: 30),
Expanded(
child: GridView.count(
crossAxisCount: 2,
children: List.generate(
this.selectedCategory!.subCategories!.length,
(index) {
return GestureDetector(
onTap: () {
// NAVIGATE to the details page
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DetailsPage(

                              subCategory:
                              this.selectedCategory!.subCategories![index], <<<<<---------------
                              ),
                        ));
                  },
                  child: Container(
                    child: Column(
                      children: [
                        ClipOval(
                          child: Image.asset(
                              'assets/images/drink/' +
                                  this
                                      .selectedCategory!
                                      .subCategories![index]
                                      .imgName! +
                                  '.png',
                              fit: BoxFit.cover,
                              width: 100,
                              height: 100),
                        ),
                        SizedBox(height: 10),
                        Text(
                          this
                              .selectedCategory!
                              .subCategories![index]
                              .name!,
                          style: TextStyle(
                              color: this.selectedCategory!.color),
                        ),
                      ],
                    ),
                  ),
                );
              },
            ),
          ),
        ),
      ],
    ),
  ),
);

}
}

@MarioCastle
Copy link
Author

dont know why keep error ..
i alredy put this ! or ? nulll safe still ..error

@thyagosouza
Copy link

dont know why keep error .. i alredy put this ! or ? nulll safe still ..error

the same problem here! =(

@romanejaquez
Copy link
Owner

hey @thyagosouza @MarioCastle what's the precise error you're getting so I can help? thanks

@thyagosouza
Copy link

hey @thyagosouza @MarioCastle what's the precise error you're getting so I can help? thanks

hey master... the problem for this question I found in the other topic .. it was just adding the SubCategory at the end of the code. As is in the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants