// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; class Deneme extends StatefulWidget { const Deneme({Key? key}) : super(key: key); @override State createState() => _DenemeState(); } class _DenemeState extends State { bool kontrol1 = false; bool kontrol2 = false; bool kontrol3 = false; bool kontrol4 = false; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Container deneme'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ ElevatedButton( onPressed: () { setState(() { kontrol3 = false; kontrol4 = false; kontrol2 = false; kontrol1 = true; }); }, child: Text('2\'ye bölünüyor mu?')), ElevatedButton( onPressed: () { setState(() { kontrol3 = false; kontrol4 = false; kontrol1 = false; kontrol2 = true; }); }, child: Text('3\'e bölünüyor mu?')), ElevatedButton( onPressed: () { setState(() { kontrol2 = false; kontrol4 = false; kontrol1 = false; kontrol3 = true; }); }, child: Text('Son Basamak?')), ElevatedButton( onPressed: () { setState(() { kontrol1 = false; kontrol3 = false; kontrol4 = true; kontrol2 = false; }); }, child: Text('Rakamları toplamı?')), Visibility( visible: boolMethodu(), child: Text( kontrolMetodu(), ), ) ], ), ), ); } bool boolMethodu() { if (kontrol1 == true) { return true; } if (kontrol2 == true) { return true; } if (kontrol3 == true) { return true; } if (kontrol4 == true) { return true; } return false; } String kontrolMetodu() { if (kontrol1 == true) { return 'İpucu: Sayı 2\'ye tam bölünmüyor.'; } if (kontrol2 == true) { return 'İpucu: Sayı 3\'e tam bölünmüyor.'; } if (kontrol3 == true) { return 'İpucu: Sayının son basamağı 5'; } if (kontrol4 == true) { return 'İpucu: Sayının rakamları toplamı : 7'; } else { return ''; } } }