Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yelmuratoff/slidable_drawer
This package was created to implement a Custom Drawer that could be opened with a simple swipe.
https://github.com/yelmuratoff/slidable_drawer
dart drawer flutter slidable slidable-drawer
Last synced: 6 days ago
JSON representation
This package was created to implement a Custom Drawer that could be opened with a simple swipe.
- Host: GitHub
- URL: https://github.com/yelmuratoff/slidable_drawer
- Owner: yelmuratoff
- License: mit
- Created: 2023-08-03T17:54:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-19T18:13:57.000Z (11 months ago)
- Last Synced: 2024-12-20T18:49:56.502Z (16 days ago)
- Topics: dart, drawer, flutter, slidable, slidable-drawer
- Language: Dart
- Homepage:
- Size: 464 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
This package was created to implement a Custom Drawer that could be opened with a simple swipe. 🚀
Included SlidableDrawerController for animated open/close drawer 😊
Show some ❤️ and star the repo to support the project!
## 📌 Features
- ✅ Simple open/close drawer with swipe to right
- ✅ Open/close drawer using SlidableDrawerController## 📌 Getting Started
Follow these steps to use this package### Add dependency
```yaml
dependencies:
slidable_drawer: ^1.0.6
```### Add import package
```dart
import 'package:slidable_drawer/slidable_drawer.dart';
```### Easy to use
Simple example of use `SlidableDrawer`
Put this code in your project at an screen and learn how it works 😊
Widget part:
```dart
import 'package:flutter/material.dart';
import 'package:slidable_drawer/slidable_drawer.dart';void main() {
runApp(MaterialApp(
theme: ThemeData.dark(),
home: const MyApp(),
));
}class MyApp extends StatefulWidget {
const MyApp({super.key});// Create and return the state associated with MyApp.
@override
State createState() => _MyAppState();
}// The state of the MyApp widget.
class _MyAppState extends State {
final SlidableDrawerController _slidableDrawer = SlidableDrawerController();// initState is called when this object is inserted into the tree.
@override
void initState() {
super.initState();
}// This method builds the widget that this state represents.
@override
Widget build(BuildContext context) {
return Scaffold(
body: SlidableDrawer(
drawerBody: _SlidableDraweBody(
controller: _slidableDrawer,
),
innerDrawerController: _slidableDrawer,
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: Center(
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.blue),
),
onPressed: () {
_slidableDrawer.animateToOpen();
},
child: const Text(
'Open Drawer',
style: TextStyle(color: Colors.white),
),
)),
),
),
);
}
}class _SlidableDraweBody extends StatelessWidget {
final SlidableDrawerController controller;const _SlidableDraweBody({required this.controller});
// This method builds the widget that this stateless widget represents.
@override
Widget build(BuildContext context) {
return Container(
color: const Color.fromARGB(255, 66, 66, 66), // can be any color
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {
controller.animateToClose();
},
child: const Text('Close'),
),
],
),
);
}
}
```