flutter_toastify 1.0.4
flutter_toastify: ^1.0.4 copied to clipboard
A Flutter package for showing toast notifications - Bildirimleri göstermek için bir Flutter paketi
Güncellenmiş readme dosyası aşağıdaki gibidir:
FlutterToastify #
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.
Kullanım #
- İlk olarak, projenize
flutter_toastifypaketini ekleyin.pubspec.yamldosyası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 getkomutunu ç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.
Özellikler #
FlutterToastify, kullanıcı bildirimlerini özelleştirilebilir bir şekilde göstermek için bir dizi özellik sunar:
FlutterToastifySı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 olaraknullve görüntülenmez.description: Bildirim açıklama metni (zorunlu).type: Bildirim tipi (FlutterToastifyTypeenumundan). 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.
Lisans #
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 #
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.
Usage #
- First, add the
flutter_toastifypackage to your project. Edit thepubspec.yamlfile as follows:
dependencies:
flutter:
sdk: flutter
flutter_toastify: ^1.0.4
-
Next, run
flutter pub getto 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.
Features #
FlutterToastify provides a set of features to display user notifications in a customizable way:
FlutterToastifyClass:
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'snulland won't be displayed.description: The description text of the notification (required).type: The type of notification (fromFlutterToastifyTypeenum). 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.
License #
This project is licensed under the MIT License. For more information, see the LICENSE file.