如何使gridview中的选定项目显示在新页面中?

时间:2020-05-13 18:34:15

标签: flutter gridview

我已经在第1页中创建了一个网格,其中包含12个类别,用户可以从中选择(都可以选择)。第2页应在行或列中展示所选类别,这无关紧要。我想知道是否有办法吗?

For example how would I make this category be showcased in the next page if selected? Should something like $ be used?

```selectedInterest(int interestID){
    switch(interestID){
      case 1:
        if(foodSelected){
          foodSelected = false;
          foodOpacity = 1;
        } else {
          foodSelected = true;
          foodOpacity= 0.3;
        }
        break;

   GestureDetector(
                onTap: () {
                  selectedInterest(1);
                  _changeState();
                },
                child: Container(
                  //foregroundDecoration: const BoxDecoration(image: DecorationImage(image: AssetImage('assets/fooddrinks.png'), fit: BoxFit.fitWidth),),
                  padding: const EdgeInsets.all(8),
                  child: Center(
                    child: const Text(
                      'Food & Drinks',
                      style: TextStyle(
                          fontSize: 20.0,
                          color: Colors.white,
                          fontWeight: FontWeight.w700,
                          fontStyle: FontStyle.italic,
                          letterSpacing: 2),
                    ),
                  ),
                  decoration: BoxDecoration(
                      shape: shape,
                      image: DecorationImage(
                          colorFilter:
                          ColorFilter.mode(Colors.black.withOpacity(foodOpacity),
                              BlendMode.dstATop),
                          image: AssetImage('assets/fooddrinks.png'),
                          fit: BoxFit.fitWidth)),
                ),), ```

0 个答案:

没有答案