Burada nerede hata yapıyorum acaba
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:url_launcher/url_launcher.dart';
class loginEkran extends StatefulWidget {
@override
_loginEkranState createState() => _loginEkranState();
}
class _loginEkranState extends State<loginEkran> {
String username;
String password;
int datauser;
final _formKey = GlobalKey<FormState>();
Future<List> login() async{
final response = await http.get(“https://www.ornekurl.com/test/getAnd.php?ka**$username**&sf=**$password**”);
var datauser = json.decode(response.body);
if(datauser['islem']==0 ){
print(Text("Giriş Başarılı"),
);
}
else{
print(Text("Giriş Başarısız"));
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.grey,
body: Form(
key: _formKey,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Card(
elevation: 4.0,
color: Colors.white,
margin: EdgeInsets.only(left: 20, right: 20, top: 70),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
),
TextFormField(
style: TextStyle(color: Colors.black),
cursorColor: Colors.blue,
keyboardType: TextInputType.text,
obscureText: false,
decoration: InputDecoration(
prefixIcon: Icon(
Icons.email,
color: Colors.grey,
),
labelText: "Kullanıcı Adı",
labelStyle: TextStyle(
color: Color(0xFF9b9b9b),
fontSize: 15,
fontWeight: FontWeight.normal,
),
),
validator: (value) {
if (value.isEmpty) {
return "Kullanıcı Adınızı Griniz";
} else {
return null;
}
},
onSaved: (value) {
username = value;
},
),
TextFormField(
style: TextStyle(color: Colors.black),
cursorColor: Colors.blue,
keyboardType: TextInputType.text,
obscureText: true,
decoration: InputDecoration(
prefixIcon: Icon(
Icons.password,
color: Colors.grey,
),
labelText: "Şifre",
labelStyle: TextStyle(
color: Color(0xFF9b9b9b),
fontSize: 15,
fontWeight: FontWeight.normal,
),
),
validator: (value) {
if (value.isEmpty) {
return "Şifrenizi Giriniz";
} else {
return null;
}
},
onSaved: (value) {
password = value;
},
),
Padding(
padding: const EdgeInsets.all(10),
child: _girisButton(),
),
Padding(
padding: const EdgeInsets.all(10),
child: _anaMenu(),
),
],
),
),
),
],
),
),
),
),
),
);
}
Widget _girisButton() => FlatButton(
onPressed: () {
login();
if(_formKey.currentState.validate()){
_formKey.currentState.save();
if(username == "" && password == "" ){}else{showDialog(context: context, builder: (BuildContext context){return AlertDialog(); } ); }
// debugPrint("username: $username, password: $password");
}
},
child: Padding(
padding: EdgeInsets.only(
top: 12,
bottom: 12,
left: 14,
right: 14,
),
child: Text(
"Giriş",
style: TextStyle(
color: Colors.white,
fontSize: 15,
decoration: TextDecoration.none,
fontWeight: FontWeight.normal,
),
),
),
color: Colors.blue,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
);