You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
class DemoButtons extends StatefulWidget {
const DemoButtons({super.key});
@override
State<StatefulWidget> createState() {
return _DemoButtonsState();
}
}
class _DemoButtonsState extends State<DemoButtons> {
var _isUnderstood = false;
@override
Widget build(BuildContext context) {
print('DemoButtons BUILD called');
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {
setState(() {
_isUnderstood = false;
});
},
child: const Text('No'),
),
TextButton(
onPressed: () {
setState(() {
_isUnderstood = true;
});
},
child: const Text('Yes'),
),
],
),
if (_isUnderstood) const Text('Awesome!'),
],
);
}
}