Skip to content

Commit

Permalink
CupertionPopoverButton添加了CupertionPopoverButton参数,用于设置最大最小宽度,取消必填的高宽
Browse files Browse the repository at this point in the history
  • Loading branch information
Im-Kevin committed Nov 6, 2018
1 parent afcfaa1 commit 7fd8f60
Show file tree
Hide file tree
Showing 7 changed files with 280 additions and 106 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [0.1.5] - TODO:添加了popoverConstraints参数
* TODO: CupertionPopoverButton添加了CupertionPopoverButton参数,用于设置最大最小宽度,取消必填的高宽

## [0.1.4] - TODO:修改了onTap事件
* TODO: CupertionPopoverButton添加了onTap事件,返回True不打开Popover
* TODO: CupertinoPopoverMenuItem修改了onTap事件,返回True不关闭Popover
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Usage
Add this to your package's pubspec.yaml file:
``` yaml
dependencies:
cool_ui: "^0.1.4"
cool_ui: "^0.1.5"
```
# 控件
Expand All @@ -31,6 +31,7 @@ CupertinoPopoverButton({
this.popoverColor=Colors.white,
@required this.popoverWidth,
@required this.popoverHeight,
BoxConstraints popoverConstraints,
this.onTap,
this.transitionDuration=const Duration(milliseconds: 200),
this.radius=8.0});
Expand All @@ -41,8 +42,9 @@ CupertinoPopoverButton({
| --- | --- | --- | --- |
| child | <code>Widget</code> | | 按钮的内容 |
| popoverBuild | <code>WidgetBuilder</code> | | 生成弹出框的内容 |
| popoverWidth | <code>double</code> | | 弹出框的宽度 |
| popoverHeight | <code>double</code> | | 弹出框的高度 |
| [popoverWidth] | <code>double</code> | | 弹出框的宽度 |
| [popoverHeight] | <code>double</code> | | 弹出框的高度 |
| [popoverConstraints] | <code>BoxConstraints</code> | maxHeight:123.0 maxWidth:150.0 | 弹出框的最大最小高宽|
| [onTap] | <code>BoolCallback</code> | | 按钮点击事件,返回true取消默认反应(不打开Popover) |
| [popoverColor] | <code>Color</code> | 白色 | 弹出框的背景颜色 |
| [transitionDuration] | <code>Duration</code> | 0.2s | 过度动画时间 |
Expand Down Expand Up @@ -70,9 +72,7 @@ CupertinoPopoverButton(
height: 100.0,
child: Text('左上角内容'),
)
},
popoverWidth: 100.0,
popoverHeight: 100.0);
});
```

![Image text](./images/popover_demo.gif)
Expand Down
6 changes: 2 additions & 4 deletions example/lib/pages/popover_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class PopoverDemoState extends State<PopoverDemo>{
return Padding(
padding: EdgeInsets.all(20.0),
child:CupertinoPopoverButton(

child: Container(
width: 80.0,
height: 40.0,
Expand All @@ -72,16 +71,15 @@ class PopoverDemoState extends State<PopoverDemo>{
child: Center(child:Text(btnTitle)),
),
popoverBuild: (context) {
// return Text("satatastas");
return CupertinoPopoverMenuList(
children: <Widget>[
CupertinoPopoverMenuItem(leading: Icon(Icons.add),child: Text("新增"),),
CupertinoPopoverMenuItem(leading: Icon(Icons.edit),child: Text("修改"),),
CupertinoPopoverMenuItem(leading: Icon(Icons.delete),child: Text("删除"),)
],
);
},
popoverWidth: 150.0,
popoverHeight: 123.0)
})

);

Expand Down
Loading

0 comments on commit 7fd8f60

Please sign in to comment.