Skip to content

Commit

Permalink
added lazyItems and onStateChanged parameters to addStarMenu extension
Browse files Browse the repository at this point in the history
  • Loading branch information
deimos committed Dec 12, 2022
1 parent a693427 commit 49e6b56
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 27 deletions.
6 changes: 0 additions & 6 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [3.1.1] - 12 Dec 2022
* added [lazyItems] and [onStateChanged] parameters to [addStarMenu] extension

## [3.1.0+1] - 26 Oct 2022
* it's now possible to open a menu programmatically with [StarMenuController].
* it's now possible to open a menu programmatically by passing [parentContext] to [StarMenu].
Expand Down
35 changes: 16 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ FloatingActionButton(
onPressed: () {print('FloatingActionButton tapped');},
child: Icon(Icons.looks_one),
).addStarMenu(
items,
StarMenuParameters(),
items,
StarMenuParameters(),
controller,
onItemTapped: (index, controller) {}),
onItemTapped: (index, controller) {}),
```

<br/>
<br/>

Expand Down Expand Up @@ -163,11 +164,11 @@ ElevatedButton(
),
```

<br/>
<br/>


### ***StarMenu***
Only [items] or [lazyItems] can be passed, not both.

|Name|Type|Defaults|Description|
|:-------|:----------|:----------|:-----------|
|***params***|class|StarMenuParameters|See below.|
Expand All @@ -178,8 +179,7 @@ Only [items] or [lazyItems] can be passed, not both.
|***controller***|StarMenuController|-|context of the Widget where the menu will be opened. Only [child] or [parentContext] is allowed|
|***onStateChanged***|Function(MenuState state)?|-|Return current menu state.|

<br/>
<br/>


### ***StarMenuParameters***
Class to define all the parameters for the shape, animation and menu behavior.
Expand All @@ -206,8 +206,7 @@ Class to define all the parameters for the shape, animation and menu behavior.
|***longPressDuration***|Duration|500 ms|The timing to trigger long press.|
|***onHoverScale***|double|1.0|Scale item when mouse is hover (desktop only)|

<br/>
<br/>


There are some ***StarMenuParameters*** factory presets with which you can set *StarMenu.params*

Expand All @@ -232,8 +231,8 @@ There are some ***StarMenuParameters*** factory presets with which you can set *


---
<br/>
<br/>



### ***BoundaryBackground***

Expand All @@ -244,8 +243,8 @@ There are some ***StarMenuParameters*** factory presets with which you can set *
|***decoration***|Decoration|BorderRadius.circular(8)| background Container widget decoration.|

---
<br/>
<br/>



### ***LinearShapeParams***

Expand All @@ -256,8 +255,7 @@ There are some ***StarMenuParameters*** factory presets with which you can set *
|***alignment***|LinearAlignment|center| *left*, *center*, *right*, *top*, *bottom*. Useful when the linear shape is vertical or horizontal.|

---
<br/>
<br/>


### ***CircleShapeParams***

Expand All @@ -269,8 +267,8 @@ There are some ***StarMenuParameters*** factory presets with which you can set *
|***endAngle***|double|360.0|Ending angle for the 1st item. Anticlockwise with 0° on the right.|

---
<br/>
<br/>



### ***GridShapeParams***

Expand All @@ -281,8 +279,7 @@ There are some ***StarMenuParameters*** factory presets with which you can set *
|***columnsSpaceV***|int|0|Vertical space between items.|

---
<br/>
<br/>


### ***BackgroundParams***

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.1.0+1"
version: "3.1.1"
stream_channel:
dependency: transitive
description:
Expand Down
4 changes: 4 additions & 0 deletions lib/src/star_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ enum ArcType {
extension AddStarMenu on Widget {
addStarMenu(
List<Widget> items,
Future<List<Widget>> Function()? lazyItems,
Function(MenuState state)? onStateChanged,
StarMenuParameters params, {
StarMenuController? controller,
Function(int index, StarMenuController controller)? onItemTapped,
}) {
return StarMenu(
params: params,
items: items,
lazyItems: lazyItems,
onStateChanged: onStateChanged,
controller: controller,
onItemTapped: onItemTapped,
child: this,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: star_menu
description: Contextual popup menu with different shapes and multiple ways to fine-tune animation and position. The menu entries can be almost any kind of widgets.
version: 3.1.0+1
version: 3.1.1
homepage: https://github.com/alnitak/flutter_star_menu
issue_tracker: https://github.com/alnitak/flutter_star_menu/issues
repository: https://github.com/alnitak/flutter_star_menu
Expand Down

0 comments on commit 49e6b56

Please sign in to comment.