import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/container.dart'; import 'package:flutter/src/widgets/framework.dart'; class ikinciSayfa extends StatefulWidget { const ikinciSayfa({super.key}); @override State createState() => _ikinciSayfaState(); } class _ikinciSayfaState extends State { var tf1 = TextEditingController(); var tf2 = TextEditingController(); var sonuc = 0.0; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Hesap Makinesi"), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ SizedBox( width: 200, child: TextField( controller: tf1, ), ), SizedBox( width: 200, child: TextField( controller: tf2, ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ ElevatedButton( onPressed: () { setState(() { var sayi1 = double.parse(tf1.text); var sayi2 = double.parse(tf2.text); sonuc = sayi1 + sayi2; }); }, child: Text("+")), ElevatedButton( onPressed: () { setState(() { var sayi1 = double.parse(tf1.text); var sayi2 = double.parse(tf2.text); sonuc = sayi1 - sayi2; }); }, child: Text("-")), ElevatedButton( onPressed: () { setState(() { var sayi1 = double.parse(tf1.text); var sayi2 = double.parse(tf2.text); sonuc = sayi1 * sayi2; }); }, child: Text("*")), ElevatedButton( onPressed: () { setState(() { var sayi1 = double.parse(tf1.text); var sayi2 = double.parse(tf2.text); sonuc = sayi1 / sayi2; }); }, child: Text("/")), ElevatedButton( onPressed: () { Navigator.pop(context); }, child: Text("Geri dön")), ], ), Text(sonuc.toString()), ], ), ), ); } }