-
Notifications
You must be signed in to change notification settings - Fork 151
Test #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Test #13
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d776542
AspectRatio
DIVINER-only 091fad8
ConstrainedBox
DIVINER-only d6fb391
Wrap
DIVINER-only d9c7a2c
Table
DIVINER-only d1a4965
引入屏幕适配
DIVINER-only e9dd717
flow
DIVINER-only afcebfc
flow
DIVINER-only 3d87d8d
refactor:优化主题包功能
ckken cf76656
Stack
DIVINER-only 85c8f5f
docs:增加git提交规范文档
ckken 61f0575
Merge pull request #11 from efoxTeam/dev-ken
ckken e53da52
优化底部导航
ckken 3c0cae5
Merge pull request #12 from efoxTeam/dev-ken
ckken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ConstrainedBox
- Loading branch information
commit 091fad851c66ae8f02a3355aa7fcdb3320cf57c3
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
docs/widget/regular/constrainedbox/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| ## **ConstrainedBox** | ||
|
|
||
| > | ||
| 一个基础布局控件,添加额外的限制条件(constraints)到child上 | ||
|
|
||
| ### 构造方法 | ||
| ``` dart | ||
| ConstrainedBox({ | ||
| Key key, | ||
| @required this.constraints, | ||
| Widget child | ||
| }) | ||
| ``` | ||
|
|
||
| ### 属性介绍 | ||
| * constraints: 添加到child上的额外限制条件,其类型为BoxConstraints,限制各种最大最小宽高 | ||
| * child: ConstrainedBox中的内容Widget | ||
|
|
||
| ### 其他用法 | ||
| * constraints值为BoxConstraints.expand时,提供width或者height,那么限制(Constraints)将严格使用给出的width或者height值 |
63 changes: 63 additions & 0 deletions
lib/widget/regular/constrainedbox/demo.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| class Index extends StatefulWidget { | ||
| @override | ||
| _IndexState createState() => _IndexState(); | ||
| } | ||
|
|
||
| class _IndexState extends State<Index> { | ||
| var maxWidth = 200.0; | ||
| var maxHeight = 200.0; | ||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Scaffold( | ||
| appBar: AppBar(title: Text('ConstrainedBox'),), | ||
| body: ListView( | ||
| children: <Widget>[ | ||
| SizedBox( | ||
| child: Text('修改maxWidth maxHeight 值'), | ||
| ), | ||
| Row( | ||
| children: <Widget>[ | ||
| FlatButton( | ||
| child: Text('maxWidth: $maxWidth', style: TextStyle(fontSize: 14.0),), | ||
| onPressed: (){ | ||
| setState(() { | ||
| maxWidth == 200.0 ? maxWidth = 150.0 : maxWidth = 200.0; | ||
| }); | ||
| }, | ||
| ), | ||
| FlatButton( | ||
| child: Text('maxHeight: $maxHeight', style: TextStyle(fontSize: 14.0),), | ||
| onPressed: (){ | ||
| setState(() { | ||
| maxHeight == 200.0 ? maxHeight = 150.0 : maxHeight = 200.0; | ||
| }); | ||
| }, | ||
| ) | ||
| ], | ||
| ), | ||
| Center( | ||
| child: ConstrainedBox( | ||
| constraints: BoxConstraints( | ||
| minWidth: 100.0, | ||
| minHeight: 100.0, | ||
| maxWidth: maxWidth, | ||
| maxHeight: maxHeight | ||
| ), | ||
| child: Container( | ||
| margin: EdgeInsets.all(10.0), | ||
| decoration: BoxDecoration( | ||
| image: DecorationImage( | ||
| image: NetworkImage('http://sucimg.itc.cn/avatarimg/55d21fdc4b8d4838bef0da94ada78cab_1501139484387') | ||
| ), | ||
| color: Theme.of(context).primaryColor, | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ); | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
lib/widget/regular/constrainedbox/demo_expand.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| class Index extends StatelessWidget { | ||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Scaffold( | ||
| appBar: AppBar(title: Text('Expand'),), | ||
| body: Center( | ||
| child: ConstrainedBox( | ||
| constraints: BoxConstraints.expand( | ||
| width: 150.0, | ||
| height: 150.0 | ||
| ), | ||
| child: Container( | ||
| alignment: Alignment.center, | ||
| color: Theme.of(context).primaryColor, | ||
| child: Text( | ||
| 'Hello World', | ||
| style: TextStyle(fontSize: 20.0, color: Colors.white, fontWeight: FontWeight.bold) | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
lib/widget/regular/constrainedbox/index.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:efox_flutter/components/widgetComp.dart' as WidgetComp; | ||
| import 'demo.dart' as Demo; | ||
| import 'demo_expand.dart' as DemoExpand; | ||
|
|
||
| class Index extends StatefulWidget { | ||
| static String title = 'ConstrainedBox'; | ||
| static String originCodeUrl = ''; | ||
| static String mdUrl = 'docs/widget/regular/constrainedbox/index.md'; | ||
| @override | ||
| _IndexState createState() => _IndexState(); | ||
| } | ||
|
|
||
| class _IndexState extends State<Index> { | ||
| @override | ||
| Widget build(BuildContext context) { | ||
| return WidgetComp.Index( | ||
| title: Index.title, | ||
| originCodeUrl: Index.originCodeUrl, | ||
| mdUrl: Index.mdUrl, | ||
| demoChild: <Widget>[ | ||
| Demo.Index(), | ||
| DemoExpand.Index() | ||
| ], | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.