BTC - $70,437.00 -1.24%
ETH - $2,114.20 -0.17%
USDT - $1.00 0.01%
XRP - $1.44 -0.41%
BNB - $638.63 -1.26%
USDC - $1.00 0.00%
SOL - $87.12 -1.03%
TRX - $0.28 0.12%
DOGE - $0.10 -1.18%
FIGR_HELOC - $1.03 1.33%
WBT - $53.23 -1.75%
BCH - $534.45 0.67%
ADA - $0.27 -1.02%
USDS - $1.00 -0.13%
LEO - $8.50 1.61%
HYPE - $31.38 -4.10%
USDE - $1.00 0.02%
CC - $0.17 -2.08%
LINK - $8.89 -0.19%
XMR - $333.15 4.05%

Flutter ShowDialog Kullanımı

showDialog fonksiyonunu kullanarak Flutter’da bir dialog gösterme işlemi şu şekilde gerçekleştirilebilir: import ‘package:flutter/material.dart’; void main() {runApp(MyApp());} Flutter ClipPath Kullanımı × class MyApp extends StatelessWidget {@overrideWidget build(BuildContext context) {return MaterialApp(home: MyHomePage(),);}} class MyHomePage extends StatelessWidget {@overrideWidget build(BuildContext context) {return Scaffold(appBar: AppBar(title: Text(‘Flutter Show Dialog Örneği’),),body: Center(child: ElevatedButton(onPressed: () {_showDialog(context);},child: Text(‘Dialog Göster’),),),);}...

admin
admin tarafından
3 Aralık 2023 yayınlandı / 03 Aralık 2023 20:14 güncellendi
51 sn 51 sn okuma süresi
Flutter ShowDialog Kullanımı
Google News Google News ile Abone Ol 0 Yorum

showDialog fonksiyonunu kullanarak Flutter’da bir dialog gösterme işlemi şu şekilde gerçekleştirilebilir:

import ‘package:flutter/material.dart’;

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}

class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(‘Flutter Show Dialog Örneği’),
),
body: Center(
child: ElevatedButton(
onPressed: () {
_showDialog(context);
},
child: Text(‘Dialog Göster’),
),
),
);
}

void _showDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(‘Dialog Başlığı’),
content: Text(‘Bu, dialog içeriğidir.’),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(); // Dialog’u kapat
},
child: Text(‘Kapat’),
),
],
);
},
);
}
}

Yukarıdaki örnekte, bir ElevatedButton (yükseltilmiş düğme) üzerine tıklandığında _showDialog fonksiyonu çağrılır ve bu fonksiyon içinde showDialog kullanılarak bir AlertDialog gösterilir. AlertDialog, başlık (title), içerik (content) ve eylemler (actions) içerebilir. Eylemler arasında yer alan düğmeye tıklandığında Navigator.of(context).pop() çağrılarak dialog kapatılır.

Bu yazıya tepkin ne?

Yorum Ekle

İLGİNİZİ ÇEKEBİLİR
Flutter RefreshIndicator Kullanımı
14 Şubat 2024

Flutter RefreshIndicator Kullanımı

Flutter ShowDialog Kullanımı

Bu Yazıyı Paylaş

Bize Ulaşın Bildirimler Giriş Yap
2