import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatefulWidget { const MyApp({super.key}); @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { TextEditingController sayi1 = TextEditingController(); TextEditingController sayi2 = TextEditingController(); double sonuc = 0; @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: Center( child: Column( children: [ TextField( controller: sayi1, keyboardType: TextInputType.number, decoration: InputDecoration( labelText: 'Sayı 1', hintText: "Sayi 1", )), TextField( controller: sayi2, keyboardType: TextInputType.number, decoration: InputDecoration( labelText: 'Sayı 2', hintText: "Sayi 2", ), ), ElevatedButton(onPressed: () { setState(() { double s1 = double.tryParse(sayi1.text) ?? 0; double s2 = double.tryParse(sayi2.text) ?? 0; sonuc = s1 + s2; }); }, child: Text('Topla'), style: ElevatedButton.styleFrom(backgroundColor: Colors.red),), Text("data: $sonuc", style: TextStyle(fontSize: 20, color: Colors.blue),), ], ), ), ), ); } }