状态数据与界面更新 -2

This commit is contained in:
toly
2023-04-18 12:43:39 +08:00
parent 6c72e7fb8f
commit e674423ab1
2 changed files with 28 additions and 5 deletions

View File

@@ -20,6 +20,13 @@ class _GuessPageState extends State<GuessPage> {
Random _random = Random();
bool _guessing = false;
@override
void dispose() {
_guessCtrl.dispose();
super.dispose();
}
void _generateRandomValue() {
setState(() {
_guessing = true;
@@ -28,10 +35,19 @@ class _GuessPageState extends State<GuessPage> {
});
}
TextEditingController _guessCtrl = TextEditingController();
void _onCheck(){
print("=====Check:目标数值:$_value=====${_guessCtrl.text}============");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: GuessAppBar(),
appBar: GuessAppBar(
controller: _guessCtrl,
onCheck: _onCheck,
),
body: Stack(
children: [
// Column(