layerx 1.0.0
layerx: ^1.0.0 copied to clipboard
A powerful overlay and dialog system for Flutter. Manage dialogs, toasts, loading, and sheets globally — no BuildContext required.
🚀 LayerX #
A powerful, lightweight, and flexible Flutter overlay & dialog management system
✨ Features #
-
🔥 Global overlay control (no BuildContext required)
-
🧠 Modal stack management (auto back button handling)
-
⚡ Future-based API (await everything)
-
🧩 Fully customizable dialogs
-
📦 Built-in:
- Dialog / Confirm / Alert
- Input dialog
- BottomSheet / ActionSheet
- Toast / Notification
- Loading / Progress
-
🎯 Smooth animations & minimal boilerplate
📦 Installation #
Add this to your pubspec.yaml:
dependencies:
layerx: ^1.0.0
⚡ Quick Start #
1️⃣ Initialize #
MaterialApp(
builder: LayerX.init(),
)
2️⃣ Use anywhere (NO context!) #
LayerX.toast("Hello World");
await LayerX.show("Done");
final ok = await LayerX.confirm("Are you sure?");
🧩 Examples #
✅ Dialog #
await LayerX.show("Operation completed");
❓ Confirm #
final result = await LayerX.confirm("Delete this item?");
✏️ Input #
final text = await LayerX.input(
title: "Input",
hint: "Enter something",
);
🧱 Custom Dialog #
final result = await LayerX.custom<String>(
Builder(
builder: (context) {
return Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text("Custom Dialog"),
ElevatedButton(
onPressed: () => LayerX.dismiss(context, "OK"),
child: const Text("Close"),
),
],
),
);
},
),
);
🍞 Toast #
LayerX.toast("Hello");
LayerX.toast(
"From center",
fromBottom: false,
);
🍞 Simple Toast (legacy) #
LayerX.toastSimple("Simple message");
🔔 Notification #
LayerX.notification(
title: "Success",
message: "Saved successfully",
);
📥 Bottom Sheet #
await LayerX.bottomSheet(
Container(height: 200, child: Center(child: Text("Sheet"))),
);
📋 Action Sheet #
final index = await LayerX.actionSheet(
options: ["A", "B", "C"],
);
⏳ Loading #
LayerX.loading();
// do something...
LayerX.dismissLoading();
🔄 Wrap with Loading #
await LayerX.wrapLoading(() async {
await Future.delayed(Duration(seconds: 2));
});
📊 Progress #
LayerX.progress(0.6);
LayerX.dismissProgress();
⚙️ Configuration #
LayerX.config(
delay: Duration(milliseconds: 200),
minShow: Duration(milliseconds: 400),
);
🧠 Why LayerX? #
Most dialog solutions in Flutter:
- ❌ Require
BuildContext - ❌ Hard to manage multiple overlays
- ❌ No unified API
LayerX solves all of them:
- ✅ Global control
- ✅ Stack-based modal system
- ✅ Clean & consistent API
- ✅ Works anywhere
🏗 Architecture #
LayerX is built on top of:
Overlay- Global modal stack
- Animation wrappers
This enables:
- Precise control
- Better UX
- Cleaner code
📱 Example App #
See /example folder for full demo.
🤝 Contributing #
PRs are welcome! If you find a bug or have suggestions, feel free to open an issue.
📄 License #
MIT License