1-) FLUTTER - AlertDialog showDialog vs kullanımı
NOT :
Alertdialog da anlık değişiklik olsun dersen GetX kullan. Setstate o zaman işler
DİĞER NOT : setState() or markNeedsBuild called during build BU HATAYI ALIRSAN
WidgetsBinding.instance.addPostFrameCallback((_){
// Add Your Code here.
1-) ekran görüntüsü
2-) kod
showDialog(
|
3-) DİĞER
void alertDialog(BuildContext context) { }
|
|
4-) BU DAHA GÜZEL GİBİ
void teklifVerDialog() {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: Colors.transparent,
insetPadding: EdgeInsets.all(10),
title: null,
content: Material(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(15.0),
)),
child: Container(
width: 450,
height: 285,
child: Column(
children: [
Padding(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10,top: 35),
child: Material(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(15.0),
)),
child: TextFormField(
style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold),
maxLines: 3,
autofocus: true,
decoration: InputDecoration(
icon: Icon(Icons.topic_outlined),
labelText: "Açıklama...",
border: InputBorder.none,
labelStyle: TextStyle(fontSize: 15),
contentPadding:
const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0),
),
),
),
),
Padding(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
child: Material(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(15.0),
)),
child: TextFormField(
style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold),
decoration: InputDecoration(
icon: Icon(Icons.account_balance_wallet_outlined),
labelText: "Fiyat",
border: InputBorder.none,
labelStyle: TextStyle(fontSize: 15),
contentPadding: const EdgeInsets.symmetric(
vertical: 5.0, horizontal: 10.0),
),
keyboardType: TextInputType.number,
inputFormatters: [formatter],
controller: txtTeklifButce,
onChanged: (String deger) {
if (deger != null && deger.contains("-")) {
txtTeklifButce.clear();
}
},
),
),
),
Padding(
padding: EdgeInsets.only(top: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.only(left: 15),
child: MaterialButton(
elevation: 17,
onPressed: () {
Navigator.pop(context);
},
color: ThemeProvider.themeOf(context)
.data
.bottomAppBarColor,
textColor: ThemeProvider.themeOf(context)
.data
.bottomSheetTheme
.backgroundColor,
child: Row(
children: [
Icon(
Icons.close,
size: 17,
color: Colors.red,
),
SizedBox(
width: 5,
),
Text(
"İptal",
style: TextStyle(fontSize: 13),
),
],
),
),
),
Padding(
padding: EdgeInsets.only(right: 15),
child: MaterialButton(
elevation: 17,
onPressed: () {
},
color: ThemeProvider.themeOf(context)
.data
.bottomAppBarColor,
textColor: ThemeProvider.themeOf(context)
.data
.bottomSheetTheme
.backgroundColor,
child: Row(
children: [
Icon(
Icons.offline_pin,
size: 17,
),
SizedBox(
width: 5,
),
Text(
"Teklifi Gönder",
style: TextStyle(fontSize: 13),
),
],
),
),
),
],),
)
],
),
),
),
);
},
);
}
ekran görüntüsü
ALERT DİALOG İÇİNDE GRİDVİEW KULLANIMI
EKRAN GÖRÜNTÜSÜ
class UrunModel {
Widget getAltUrun(){
|