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
| var maskColor = Colors.black.withOpacity(0.4); | |
| ColorFiltered( | |
| colorFilter: ColorFilter.mode(maskColor, | |
| BlendMode.srcOut), // This mean: the child's opacity part will be transparent, but the transparent will render with maskColor | |
| child: Container( | |
| color: Colors.transparent, | |
| child: Center( // Any shape you like, but make sure the widget is opacity | |
| child: Container( | |
| width: 200, |
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
| List<int> list = [1, 2, 3]; | |
| List<String> result = list.asMap().entries.map((entry) { | |
| int idx = entry.key; | |
| int val = entry.value; | |
| return "$idx: $val"; | |
| }).toList(); | |
| // or | |
| List<String> result = list | |
| .asMap() |
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
| extension UIView { | |
| func animateUpdateConstraints(duration: TimeInterval, animation: @escaping ()->Void) { | |
| animation() | |
| setNeedsUpdateConstraints() | |
| Self.animate(withDuration: duration) { | |
| self.layoutIfNeeded() | |
| } | |
| } | |
| } |
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
| import UIKit | |
| enum UserDefaultKey: String { | |
| case id | |
| case token = "access_token" // special name | |
| // Add your keys here | |
| // ... | |
| var prefix: String { "Milo" } | |
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
| # 目前只支持 Mac OS X | |
| # 需要先安装 HBuilderX,并且能够正常从 HBuilderX 界面中导出本地打包资源。 | |
| # 使用方法: sh export_uni_app_native_resoures.sh /path/to/uni_app_project | |
| # 导出的资源在 /path/to/uni_app_project/unpackage/dist/build/app-plus | |
| PROJECT_PATH=`realpath ${1}` | |
| echo "工程路径: ${PROJECT_PATH}" | |
| EXPORT_PATH="${PROJECT_PATH}/unpackage/dist/build/app-plus" | |
| echo "导出到: ${EXPORT_PATH}" |
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
| - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView { | |
| // contentSize 高度小于 scrollView 控件的高度,说明内容不足一页,不需要加载更多 | |
| CGFloat offset = scrollView.contentSize.height-scrollView.height; | |
| if (offset > 0 && scrollView.contentOffset.y > offset) { | |
| // 加载更多 | |
| } | |
| if (scrollView.contentOffset.y < 0) { | |
| // 刷新 | |
| } |