Güncellenmiş readme
dosyası aşağıdaki gibidir:
FlutterToastify, özelleştirilebilir toast benzeri mesajlarla kullanıcı bildirimleri göstermek için kullanılan bir Flutter paketidir. Bu paket, başarı, hata ve bilgi bildirimlerini isteğe bağlı ilerleme göstergeleri ve özel animasyonlarla göstermenizi sağlar.
- İlk olarak, projenize
flutter_toastify
paketini ekleyin.pubspec.yaml
dosyasını aşağıdaki gibi düzenleyin:
dependencies:
flutter:
sdk: flutter
flutter_toastify: ^1.0.4
-
Daha sonra, paketi projenize eklemek için
flutter pub get
komutunu çalıştırın. -
İşte bir örnek kod:
import 'package:flutter/material.dart';
import 'package:flutter_toastify/flutter_toastify.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('FlutterToastify Demo'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
FlutterToastify.success(
width: 360,
notificationPosition: NotificationPosition.topLeft,
animation: AnimationType.fromTop,
title: const Text('Güncelleme'),
description: const Text('Verileriniz güncellendi'),
onDismiss: () {},
).show(context);
},
child: Text('Bildirim Göster'),
),
),
);
}
}
Bu örnekte, FlutterToastify.showToast
fonksiyonu, başarı bildirimi göstermek için kullanılmıştır. Bildirimde ilerleme göstergesi ve otomatik kapanma özelliği bulunmaktadır.
FlutterToastify, kullanıcı bildirimlerini özelleştirilebilir bir şekilde göstermek için bir dizi özellik sunar:
FlutterToastify
Sınıfı:
class FlutterToastify {
FlutterToastify({
this.title,
@required this.description,
this.type = FlutterToastifyType.custom,
this.showProgressIndicator = true,
this.duration = const Duration(milliseconds: 3000),
this.autoDismiss = true,
this.onCloseButtonPressed,
});
final Widget title;
final Widget description;
final FlutterToastifyType type;
final bool showProgressIndicator;
final Duration duration;
final bool autoDismiss;
final VoidCallback onCloseButtonPressed;
}
title
: Bildirim başlığı. Varsayılan olaraknull
ve görüntülenmez.description
: Bildirim açıklama metni (zorunlu).type
: Bildirim tipi (FlutterToastifyType
enumundan). Varsayılan değerFlutterToastifyType.custom
.showProgressIndicator
: Bildirimde ilerleme göstergesi gösterilsin mi? Varsayılan değertrue
.duration
: Bildirimin gösterileceği süre. Varsayılan değerDuration(milliseconds: 3000)
(3 saniye).autoDismiss
: Bildirimin belirtilen süre sonra otomatik olarak kapanıp kapanmayacağını belirtir. Varsayılan değertrue
.onCloseButtonPressed
: Bildirimin kapatma düğmesine basıldığında çağrılacak geri çağırma fonksiyonu.
Bu proje MIT Lisansı altında lisanslanmıştır. Daha fazla bilgi için LICENSE dosyasını inceleyebilirsiniz.
Sure! Here's the English version of the readme
file:
FlutterToastify is a Flutter package used to display user notifications with customizable toast-like messages. This package provides an easy way to show success, error, and info notifications with optional progress indicators and custom animations.
- First, add the
flutter_toastify
package to your project. Edit thepubspec.yaml
file as follows:
dependencies:
flutter:
sdk: flutter
flutter_toastify: ^1.0.4
-
Next, run
flutter pub get
to fetch the package. -
Here's an example code:
import 'package:flutter/material.dart';
import 'package:flutter_toastify/flutter_toastify.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('FlutterToastify Demo'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
FlutterToastify.success(
width: 360,
notificationPosition: NotificationPosition.topLeft,
animation: AnimationType.fromTop,
title: const Text('Update'),
description: const Text('Your data has been updated'),
onDismiss: () {},
).show(context);
},
child: Text('Show Notification'),
),
),
);
}
}
In this example, the FlutterToastify.showToast
function is used to show a success notification with a progress indicator and auto-dismiss feature.
FlutterToastify provides a set of features to display user notifications in a customizable way:
FlutterToastify
Class:
class FlutterToastify {
FlutterToastify({
this.title,
@required this.description,
this.type = FlutterToastifyType.custom,
this.showProgressIndicator = true,
this.duration = const Duration(milliseconds: 3000),
this.autoDismiss = true,
this.onCloseButtonPressed,
});
final Widget title;
final Widget description;
final FlutterToastifyType type;
final bool showProgressIndicator;
final Duration duration;
final bool autoDismiss;
final VoidCallback onCloseButtonPressed;
}
title
: The title of the notification. By default, it'snull
and won't be displayed.description
: The description text of the notification (required).type
: The type of notification (fromFlutterToastifyType
enum). The default value isFlutterToastifyType.custom
.showProgressIndicator
: Specifies whether to show a progress indicator in the notification. The default value istrue
.duration
: The duration for which the notification will be displayed. The default value isDuration(milliseconds: 3000)
(3 seconds).autoDismiss
: Specifies whether the notification will automatically dismiss after the specified duration. The default value istrue
.onCloseButtonPressed
: A callback function that will be called when the notification's close button is pressed.
This project is licensed under the MIT License. For more information, see the LICENSE file.