Skip to content

Commit

Permalink
Merge pull request #19 from shiburagi/Version-1.0.0
Browse files Browse the repository at this point in the history
Version 1.0.0
  • Loading branch information
shiburagi authored Jun 9, 2020
2 parents 03f877d + 67e7720 commit 76637b3
Show file tree
Hide file tree
Showing 18 changed files with 207 additions and 61 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.0.2
* 3D-effect

# 1.0.1
* add more **Scaffold** config

Expand Down
55 changes: 46 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ https://github.com/matthew-carroll/flutter_ui_challenge_zoom_menu
- [Migration](#migration)
- [Preview](#preview)
- [Customize](#customize)
- [Contibutor](#contibutor)
- [Contributor](#contributor)


## Usage
Expand Down Expand Up @@ -92,12 +92,12 @@ class _DrawerScaleState extends State<DrawerScale> {
@override
Widget build(BuildContext context) {
return DrawerScaffold(
percentage: 0.6,
appBar: AppBar(
title: Text("Drawer - Scale"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
percentage: 0.6,
menu: menu,
direction: Direction.left,
animation: true,
Expand Down Expand Up @@ -177,6 +177,29 @@ drawers: [
)
],
```



---
### percentage (DrawerScaffold -> drawers (List<SideDrawer>))
```dart
DrawerScaffold(
percentage: 0.6,
...
);
```
**to**
```dart
DrawerScaffold(
drawers: [
SideDrawer(
percentage: 0.6,
...
)
]
...
);
```
---


Expand All @@ -188,8 +211,12 @@ drawers: [

```dart
new DrawerScaffold(
percentage: 0.6,
...
drawers: [
SideDrawer(
percentage: 0.6,
...
)
] ...
);
```
---
Expand All @@ -198,8 +225,13 @@ new DrawerScaffold(

```dart
new DrawerScaffold(
percentage: 0.6,
headerView: headerView(context),
drawers: [
SideDrawer(
percentage: 0.6,
...
)
]
...
);
```
Expand All @@ -210,7 +242,12 @@ new DrawerScaffold(

```dart
new DrawerScaffold(
percentage: 0.6,
drawers: [
SideDrawer(
percentage: 0.6,
...
)
]
...
);
```
Expand Down Expand Up @@ -269,8 +306,6 @@ List<SideDrawer> drawers;
ScreenBuilder builder;
bool enableGestures;
AppBar appBar;
bool showAppBar;
double percentage;
double cornerRadius;
Widget floatingActionButton;
Widget bottomNavigationBar;
Expand All @@ -279,6 +314,8 @@ FloatingActionButtonAnimator floatingActionButtonAnimator;
```
*SideDrawer*
```dart
double percentage;
double degree; // 15-45 degree
Menu menu;
String selectedItemId;
Direction direction;
Expand All @@ -303,6 +340,6 @@ String title;
IconData icon;
```

## Contibutor
## Contributor
- [Vladimir Vlach](https://github.com/vladaman)
- [trademunch](https://github.com/trademunch)
6 changes: 6 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:drawerbehavior_example/pages/drawer_3d.dart';
import 'package:drawerbehavior_example/pages/drawer_custom_item.dart';
import 'package:drawerbehavior_example/pages/drawer_scale.dart';
import 'package:drawerbehavior_example/pages/drawer_scale_icon.dart';
Expand Down Expand Up @@ -52,6 +53,10 @@ class _MyAppState extends State<MyApp> {
text: "Scale - no animation",
navigate: "/drawer2",
color: Theme.of(context).accentColor),
createButton(context,
text: "3D",
navigate: "/drawer12",
color: Theme.of(context).accentColor),
Divider(height: 16, color: Theme.of(context).dividerColor),
Text("Align Top"),
Divider(height: 16, color: Theme.of(context).dividerColor),
Expand Down Expand Up @@ -117,6 +122,7 @@ class _MyAppState extends State<MyApp> {
"/drawer9": (context) => DrawerLeftAndRight(),
"/drawer10": (context) => DrawerRight(),
"/drawer11": (context) => DrawerLeftAndRightInverse(),
"/drawer12": (context) => Drawer3d(),

},
);
Expand Down
50 changes: 50 additions & 0 deletions example/lib/pages/drawer_3d.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import 'package:drawerbehavior/drawerbehavior.dart';
import 'package:drawerbehavior_example/menus/main.dart';
import 'package:flutter/material.dart';

class Drawer3d extends StatefulWidget {
@override
_Drawer3dState createState() => _Drawer3dState();
}

class _Drawer3dState extends State<Drawer3d> {
int selectedMenuItemId;

@override
void initState() {
selectedMenuItemId = menu.items[0].id;
super.initState();
}

@override
Widget build(BuildContext context) {
return DrawerScaffold(
appBar: AppBar(
title: Text("Drawer - Scale"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
degree:180,
menu: menu,
direction: Direction.left,
animation: true,
color: Theme.of(context).primaryColor,
selectedItemId: selectedMenuItemId,
onMenuItemSelected: (itemId) {
setState(() {
selectedMenuItemId = itemId;
});
},
)
],
builder: (context, id) => IndexedStack(
index: id,
children: menu.items
.map((e) => Center(
child: Text("Page~${e.title}"),
))
.toList(),
),
);
}
}
2 changes: 1 addition & 1 deletion example/lib/pages/drawer_custom_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class _DrawerCustomItemState extends State<DrawerCustomItem> {
@override
Widget build(BuildContext context) {
return DrawerScaffold(
percentage: 1,
cornerRadius: 0,
appBar: AppBar(
title: Text("Drawer - Custom Item"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
percentage: 1,
menu: menu,
headerView: headerView(context),
animation: false,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/drawer_scale.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class _DrawerScaleState extends State<DrawerScale> {
@override
Widget build(BuildContext context) {
return DrawerScaffold(
percentage: 0.6,
appBar: AppBar(
title: Text("Drawer - Scale"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
percentage: 0.6,
menu: menu,
direction: Direction.left,
animation: true,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/drawer_scale_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class _DrawerScaleIconState extends State<DrawerScaleIcon> {
@override
Widget build(BuildContext context) {
return DrawerScaffold(
percentage: 0.6,
appBar: AppBar(
title: Text("Drawer - Scale with Icon"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
percentage: 0.6,
menu: menuWithIcon,
animation: true,
color: Theme.of(context).primaryColor,
Expand Down
17 changes: 9 additions & 8 deletions example/lib/pages/drawer_scale_left_right.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DrawerLeftAndRight extends StatefulWidget {

class _DrawerLeftAndRightState extends State<DrawerLeftAndRight> {
int selectedMenuItemId;
DrawerScaffoldController controller = DrawerScaffoldController();
DrawerScaffoldController controller = DrawerScaffoldController();
@override
void initState() {
selectedMenuItemId = menu.items[0].id;
Expand All @@ -20,15 +20,16 @@ class _DrawerLeftAndRightState extends State<DrawerLeftAndRight> {
Widget build(BuildContext context) {
return DrawerScaffold(
controller: controller,
percentage: 0.6,
appBar: AppBar(
title: Text("Drawer - Left & Right"),
actions: [IconButton(icon: Icon(Icons.notifications_none), onPressed: () {
controller.toggle(Direction.right);

})]),
appBar: AppBar(title: Text("Drawer - Left & Right"), actions: [
IconButton(
icon: Icon(Icons.notifications_none),
onPressed: () {
controller.toggle(Direction.right);
})
]),
drawers: [
SideDrawer(
percentage: 0.6,
menu: menu,
direction: Direction.left,
animation: true,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/drawer_scale_left_right_inverse.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class _DrawerLeftAndRightInverseState extends State<DrawerLeftAndRightInverse> {
Widget build(BuildContext context) {
return DrawerScaffold(
controller: controller,
percentage: 0.6,
appBar: AppBar(title: Text("Drawer - Left & Right"), actions: [
IconButton(
icon: Icon(Icons.notifications_none),
Expand All @@ -32,6 +31,7 @@ class _DrawerLeftAndRightInverseState extends State<DrawerLeftAndRightInverse> {
mainDrawer: Direction.right,
drawers: [
SideDrawer(
percentage: 0.6,
menu: menu,
direction: Direction.left,
animation: true,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/drawer_scale_no_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ class _DrawerScaleNoAnimationState extends State<DrawerScaleNoAnimation> {
@override
Widget build(BuildContext context) {
return DrawerScaffold(
percentage: 0.6,
appBar: AppBar(
title: Text("Drawer - Scale No Animaton"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
percentage: 0.6,
menu: menu,
animation: false,
color: Theme.of(context).primaryColor,
Expand Down
17 changes: 9 additions & 8 deletions example/lib/pages/drawer_scale_right.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DrawerRight extends StatefulWidget {

class _DrawerRightState extends State<DrawerRight> {
int selectedMenuItemId;
DrawerScaffoldController controller = DrawerScaffoldController();
DrawerScaffoldController controller = DrawerScaffoldController();
@override
void initState() {
selectedMenuItemId = menu.items[0].id;
Expand All @@ -20,15 +20,16 @@ class _DrawerRightState extends State<DrawerRight> {
Widget build(BuildContext context) {
return DrawerScaffold(
controller: controller,
percentage: 0.6,
appBar: AppBar(
title: Text("Drawer - Right"),
actions: [IconButton(icon: Icon(Icons.notifications_none), onPressed: () {
controller.toggle(Direction.right);

})]),
appBar: AppBar(title: Text("Drawer - Right"), actions: [
IconButton(
icon: Icon(Icons.notifications_none),
onPressed: () {
controller.toggle(Direction.right);
})
]),
drawers: [
SideDrawer(
percentage: 0.6,
menu: menu,
direction: Direction.right,
animation: true,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/drawer_slide.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class _DrawerSlideState extends State<DrawerSlide> {
@override
Widget build(BuildContext context) {
return DrawerScaffold(
percentage: 1,
appBar: AppBar(
title: Text("Drawer - Slide"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
percentage: 1,
textStyle: TextStyle(color: Colors.white, fontSize: 24.0),
menu: menu,
animation: false,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/drawer_slide_custom_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ class _DrawerSlideCustomAppBarState extends State<DrawerSlideCustomAppBar> {
buildDrawer(BuildContext context) {
return DrawerScaffold(
controller: controller,
percentage: 1,
cornerRadius: 0,
appBar: AppBar(
title: Text("Drawer - Slide with Custom AppBar"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
percentage: 1,
menu: menu,
headerView: headerView(context),
animation: false,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/drawer_slide_with_footer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class _DrawerSlideWithFooterState extends State<DrawerSlideWithFooter> {
@override
Widget build(BuildContext context) {
return DrawerScaffold(
percentage: 1,
cornerRadius: 0,
appBar: AppBar(
title: Text("Drawer - with Footer"),
actions: [IconButton(icon: Icon(Icons.add), onPressed: () {})]),
drawers: [
SideDrawer(
percentage: 1,
menu: menu,
footerView: footerView(context),
animation: false,
Expand Down
Loading

0 comments on commit 76637b3

Please sign in to comment.