使用GestureDetector更改窗口小部件及其父窗口小部件的状态

时间:2019-01-19 14:15:13

标签: dart flutter

我正在使用library(tidyverse) obj%>% pull(data)%>% map(~summarise_if(.,is.numeric,sum)) [[1]] # A tibble: 1 x 6 V1 V2 V3 V4 V5 V6 <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 12865. 11787. 12864. 13443. 12548. 13170. [[2]] # A tibble: 1 x 6 V1 V2 V3 V4 V5 V6 <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 11655. 12197. 11379. 10023. 10659. 11154. [[3]] # A tibble: 1 x 6 V1 V2 V3 V4 V5 V6 <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 5175. 6053. 6855. 6130. 6504. 5967. 创建一个自定义有状态小部件,并更新需要拥有AnimatedContainer的状态,但其父小部件也需要一个GestureDetector

我试图用GestureDetector包裹两个小部件,

GestureDetector

但是当我点击窗口小部件时,唯一起作用的功能是Tap部分中的那个,我点击了窗口小部件

              new GestureDetector(
                onTap:(){
                  controller.animateTo(0);
                  onPressed(); //on pressed will change the _currentState and also using the callback GestureDetector to use it with the AnimatedContainer
                print("this is tapped")
                } ,
                child: MyWidget(_currentState, onPressed), 
              ),
          ],

我想在父级中使用AnimatedContainer( height: _height, width: _width, duration: Duration(seconds: 1), child: new GestureDetector( onTap: () { widget.onPresssed; _width = 55.0; print("my Widget tapped"); }, )) 并将布尔值传递给我的自定义小部件,并使用它来更改GestureDetector的状态

0 个答案:

没有答案