자식 위젯이 보무 위젯 state를 변경하려면
1. 부모에 수정함수 만든다
2. 자식에게 보낸다
addOne() {
setState(() {
plus++;
});
}
DialogUI({Key? key , this.state, this.addOne})
TextButton(onPressed: (){
addOne();
},
'앱 > Flutter(Dart)' 카테고리의 다른 글
[Dart] var, dynamic 차이점 (0) | 2023.01.04 |
---|---|
[Flutter] BuildContext, Of (0) | 2023.01.04 |
[Flutter] floatingActionButton (0) | 2022.04.12 |
[Flutter] ListView.builder (0) | 2022.04.12 |
[Flutter] Column 대신 ListView (0) | 2022.04.11 |
댓글