Skip to content

Commit 25e593c

Browse files
authored
Feat/custom pop handler (#91)
* custom pop handler * Update README.md
1 parent 7d80a83 commit 25e593c

File tree

5 files changed

+686
-331
lines changed

5 files changed

+686
-331
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 3.0.2
2+
* Add custom pop handler
3+
14
# 3.0.2
25
* Dispose drawer animation when DrawerScaffold call dispose()
36
* make `drawers` required.

README.md

Lines changed: 40 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ https://github.com/matthew-carroll/flutter_ui_challenge_zoom_menu
3939
- [Drawer with Footer](#drawer-with-footer)
4040
- [Drawer with Header and Custom Builder](#drawer-with-header-and-custom-builder)
4141
- [Peek Drawer](#peek-drawer)
42-
- [Customize](#customize)
42+
- [⚙️ Customization Options](#️-customization-options)
43+
- [`DrawerScaffold` Parameters:](#drawerscaffold-parameters)
44+
- [`SideDrawer` Parameters:](#sidedrawer-parameters)
4345
- [Contributors](#contributors)
4446

4547

@@ -372,74 +374,45 @@ new DrawerScaffold(
372374
...
373375
);
374376
```
375-
---
376-
377-
## Customize
378-
379-
*DrawerScaffold*
380-
```dart
381-
List<SideDrawer> drawers; //required
382-
DrawerScaffoldController controller;
383-
ScreenBuilder builder;
384-
bool enableGestures; // default: true
385-
PreferredSizeWidget appBar;
386-
double cornerRadius; // default: 16
387-
double bacgroundColor; // default: Theme.of(context).scaffoldBackgroundColor
388-
Widget floatingActionButton;
389-
Widget bottomNavigationBar;
390-
FloatingActionButtonLocation floatingActionButtonLocation;
391-
FloatingActionButtonAnimator floatingActionButtonAnimator;
392-
List<BoxShadow> contentShadow;
393-
Widget bottomSheet;
394-
bool closeOnPopInvoked; // [IOS] default: true
395-
bool extendBodyBehindAppBar;
396-
List<Widget> persistentFooterButtons;
397-
bool primary;
398-
bool resizeToAvoidBottomInset;
399-
bool resizeToAvoidBottomPadding;
400-
401-
/// Listen to offset value on slide event for which [SideDrawer]
402-
Function(SideDrawer, double) onSlide;
403-
/// Listen to which [SideDrawer] is opened (offset=1)
404-
Function(SideDrawer) onOpened;
405-
/// Listen to which [SideDrawer] is closed (offset=0)
406-
Function(SideDrawer) onClosed;
407-
```
408-
*SideDrawer*
409-
```dart
410-
double percentage; // default: 0.8
411-
double elevation; // default: 4
412-
double cornerRadius;
413-
double degree; // 15-45 degree
414-
double peekSize; // 56px
415-
Menu menu;
416-
String selectedItemId;
417-
Direction direction;
418-
Duration duration;
419-
Curve curve;
420-
bool animation; //default: false
421-
bool slide; //default: false
422-
bool peekMenu; //default: false
423-
bool hideOnItemPressed; //default: true
424-
Function(String) onMenuItemSelected;
425-
Widget headerView;
426-
Widget footerView;
427-
DecorationImage background;
428-
Color color;
429-
Color selectorColor;
430-
TextStyle textStyle;
431-
Alignment alignment;
432-
EdgeInsets padding;
433-
Function(BuildContext, MenuItem, bool) itemBuilder;
434377

435-
```
378+
---
379+
## ⚙️ Customization Options
380+
381+
You can fine-tune the behavior and appearance of your drawers using various parameters available for both `DrawerScaffold` and `SideDrawer`.
382+
383+
### `DrawerScaffold` Parameters:
384+
385+
* **`drawers`**: A list of `SideDrawer` widgets, allowing you to define multiple drawers (e.g., left and right).
386+
* **`appBar`**: Provides a custom `AppBar` for your main content.
387+
* **`body` / `builder`**: Defines the main content area of your application. You should use either `body` for static content or `builder` if your content needs to react to drawer states (e.g., selected menu item).
388+
* **`contentShadow`**: Controls the shadow cast by the main content panel when a drawer is open.
389+
* **`cornerRadius`**: Sets the corner radius for the main content panel, giving it rounded edges.
390+
* **`controller`**: An optional `DrawerScaffoldController` for programmatic control over opening, closing, and toggling drawers.
391+
* **`enableGestures`**: A boolean flag to enable or disable horizontal drag gestures for opening/closing drawers.
392+
* **`defaultDirection`**: Specifies the initial drawer direction (e.g., `Direction.left`) that will be primarily controlled by `toggle()`.
393+
* **`onSlide`, `onOpened`, `onClosed`**: Callbacks that fire when the drawer slides, fully opens, or fully closes, respectively.
394+
* **`backgroundColor`**: The background color of the scaffold that sits behind your main content and drawers.
395+
396+
### `SideDrawer` Parameters:
397+
398+
* **`menu`**: If you're building a menu-driven drawer, pass a `Menu` object containing your `MenuItem`s.
399+
* **`child`**: Alternatively, you can provide a single, fully custom `Widget` to be the content of the drawer.
400+
* **`itemBuilder`**: For highly customized or dynamically generated lists of items within the drawer, you can provide a `SideDrawerItemBuilder`.
401+
* **`direction`**: Determines whether the drawer slides from `Direction.left` or `Direction.right`.
402+
* **`drawerWidth`**: Sets the fixed width of the drawer in pixels.
403+
* **`peekSize`**: When `peekMenu` is enabled, this defines the visible width of the drawer when it's in its "peek" state.
404+
* **`percentage`**: If `slide` is true, this controls how much the main content scales down (e.g., `0.8` for 80% size) when the drawer opens.
405+
* **`degree`**: If a rotation animation is desired, this sets the degree of 3D rotation for the main content (clamped between 15 and 45 degrees).
406+
* **`slide`**: A boolean that, when true, makes the main content slide horizontally along with the drawer.
407+
* **`animation`**: Enables or disables subtle animation effects on individual menu items as the drawer opens.
408+
* **`peekMenu`**: If true, the drawer will remain partially visible (at `peekSize`) even when "closed."
409+
* **`hideOnItemPressed`**: When true, the drawer automatically closes after a menu item is tapped.
410+
* **`headerView`, `footerView`**: Custom widgets that can be placed at the top and bottom of the drawer content, respectively.
411+
* **`color`, `background`**: Control the background `Color` or `DecorationImage` of the drawer itself.
412+
* **`selectorColor`**: Sets the color of the visual indicator that highlights the currently selected menu item.
413+
* **`duration`, `curve`**: Define the `Duration` and `Curve` for the drawer's opening and closing animations.
436414

437-
*MenuItem*
438-
```dart
439-
String id;
440-
String title;
441-
IconData icon;
442-
```
415+
---
443416

444417
## Contributors
445418

0 commit comments

Comments
 (0)