Размер видео: 1280 X 720853 X 480640 X 360
Показать панель управления
Автовоспроизведение
Автоповтор
bom video
simple code import 'package:connect_to_sql_server_directly/connect_to_sql_server_directly.dart';import 'package:flutter/material.dart';class dnm extends StatefulWidget { const dnm({super.key}); @override State createState() => _dnmState();}class _dnmState extends State { List ilkliste = []; // ignore: non_constant_identifier_names List Gelenliste = []; bool hidePassword = true; var selectedValue; String sfr = ""; String fll = ""; final _connectToSqlServerDirectlyPlugin = ConnectToSqlServerDirectly(); @override void initState() { getStudentsTableData(); super.initState(); } void getStudentsTableData() { ilkliste.clear(); _connectToSqlServerDirectlyPlugin .initializeConnection( //serverIp '192.168.1.10', //databaseName 'Paket', //username 'oa', //password 'oa5665', //instance instance: 'node', ) .then((value) { if (value) { try { _connectToSqlServerDirectlyPlugin .getRowsOfQueryResult("select distinct isim from kategori ") .then((value) { fll = value.toString(); if (value.runtimeType == String) { onError(value.toString()); } else { for (var element in value) { ilkliste.add( TestModel( sifre: element['isim'].toString(), ), ); } Gelenliste.clear(); for (var element in ilkliste) { Gelenliste.add( element.sifre.toString(), ); sfr = element.sifre.toString(); } setState(() {}); onError(Gelenliste.toString()); } }); } catch (error) { onError(error.toString()); } } else { onError('Bağlanamadım!'); } }); } void onError(String message) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( backgroundColor: Colors.red, duration: const Duration(seconds: 6), padding: const EdgeInsets.all(8.0), content: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Text( message, style: const TextStyle( color: Colors.white, fontWeight: FontWeight.bold), ), ), ], ), ), ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.black, ), body: SingleChildScrollView( child: Center( child: Column( children: [ ElevatedButton( onPressed: () { getStudentsTableData(); }, style: ElevatedButton.styleFrom( padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 145), backgroundColor: Colors.black, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), ), child: const Text( 'Giriş Yap', style: TextStyle(color: Colors.white), ), ), DropdownButton( hint: const Text('Kategori Seç'), value: selectedValue, isExpanded: true, itemHeight: 60.0, items: Gelenliste.map((String value) { return DropdownMenuItem( value: value, child: Text(value), ); }).toList(), onChanged: (newValue) { selectedValue = newValue!; selectedValue = newValue!; setState(() { selectedValue = newValue!; print(selectedValue); }); }, ), Text(Gelenliste.toString()), ], ), ), ), ); }}class TestModel { final String sifre; TestModel({ required this.sifre, });}
4 gündür bu sorunu çözmeye çalışıyorum ama bir türlü beceremedim. size nasıl ulaşabilirim
omrdes@hotmail.com
Could you please send me this code?
pub.dev/packages/connect_to_sql_server_directly
bom video
simple code
import 'package:connect_to_sql_server_directly/connect_to_sql_server_directly.dart';
import 'package:flutter/material.dart';
class dnm extends StatefulWidget {
const dnm({super.key});
@override
State createState() => _dnmState();
}
class _dnmState extends State {
List ilkliste = [];
// ignore: non_constant_identifier_names
List Gelenliste = [];
bool hidePassword = true;
var selectedValue;
String sfr = "";
String fll = "";
final _connectToSqlServerDirectlyPlugin = ConnectToSqlServerDirectly();
@override
void initState() {
getStudentsTableData();
super.initState();
}
void getStudentsTableData() {
ilkliste.clear();
_connectToSqlServerDirectlyPlugin
.initializeConnection(
//serverIp
'192.168.1.10',
//databaseName
'Paket',
//username
'oa',
//password
'oa5665',
//instance
instance: 'node',
)
.then((value) {
if (value) {
try {
_connectToSqlServerDirectlyPlugin
.getRowsOfQueryResult("select distinct isim from kategori ")
.then((value) {
fll = value.toString();
if (value.runtimeType == String) {
onError(value.toString());
} else {
for (var element in value) {
ilkliste.add(
TestModel(
sifre: element['isim'].toString(),
),
);
}
Gelenliste.clear();
for (var element in ilkliste) {
Gelenliste.add(
element.sifre.toString(),
);
sfr = element.sifre.toString();
}
setState(() {});
onError(Gelenliste.toString());
}
});
} catch (error) {
onError(error.toString());
}
} else {
onError('Bağlanamadım!');
}
});
}
void onError(String message) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
backgroundColor: Colors.red,
duration: const Duration(seconds: 6),
padding: const EdgeInsets.all(8.0),
content: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Text(
message,
style: const TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
),
],
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
),
body: SingleChildScrollView(
child: Center(
child: Column(
children: [
ElevatedButton(
onPressed: () {
getStudentsTableData();
},
style: ElevatedButton.styleFrom(
padding:
const EdgeInsets.symmetric(vertical: 20, horizontal: 145),
backgroundColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: const Text(
'Giriş Yap',
style: TextStyle(color: Colors.white),
),
),
DropdownButton(
hint: const Text('Kategori Seç'),
value: selectedValue,
isExpanded: true,
itemHeight: 60.0,
items: Gelenliste.map((String value) {
return DropdownMenuItem(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (newValue) {
selectedValue = newValue!;
selectedValue = newValue!;
setState(() {
selectedValue = newValue!;
print(selectedValue);
});
},
),
Text(Gelenliste.toString()),
],
),
),
),
);
}
}
class TestModel {
final String sifre;
TestModel({
required this.sifre,
});
}
4 gündür bu sorunu çözmeye çalışıyorum ama bir türlü beceremedim. size nasıl ulaşabilirim
omrdes@hotmail.com
Could you please send me this code?
pub.dev/packages/connect_to_sql_server_directly