console.log(0.1+0.2);
# 输出 0.30000000000000004
对于 js 浮点数计算不正确问题,请参考下边:
console.log(0.1+0.2);
# 输出 0.30000000000000004
对于 js 浮点数计算不正确问题,请参考下边:
领离药房
https://github.com/vjiedan/shwinking.git
万敬
https://github.com/vjiedan/shwinking.git
高锶
git@gitlab.com:vinish/gaosi.com.git
ssl 证书
https://github.com/prispace/sslcer.git
溯源码
https://github.com/vjiedan/suyuanma.git
约拍宝-v2服务端
https://gitlab.com/vinish/yuepaibao.git
约拍宝-v1服务端
https://gitlab.com/yuepaibao/www.yuepaibao.com.git
1205 – Lock wait timeout exceeded; try restarting transaction, Time: 51.0570
mysql 事务里,没有使用 commit。导致该资源被长期占用,其他事务在抢占该资源时,因上一个事务的锁而导致抢占失败。
方法一
- 查看事物表,找出被锁线程的id:SELECT * FROM information_schema.INNODB_TRX;
- 根据 id(trx_mysql_thread_id),kill掉被锁住的线程:kill 121212
方法二
- 执行MySQL命令:SHOW FULL PROCESSLIST; 找到被锁住的线程ID
- 根据id,kill掉被锁住的线程:kill 4
一套完善编码规范很重要。 php-cs-fixer 可一键把代码格式化为 PSR-2 标准。 php-cs-fixer 可单独使用,也可以结合编辑器使用。
github: https://github.com/FriendsOfPHP/PHP-CS-Fixer
下载并设置权限
cd /usr/local/bin
wget https://cs.symfony.com/download/php-cs-fixer-v2.phar -O php-cs-fixer
chmod +x php-cs-fixer
使用
# 格式化当前目录下代码
php-cs-fixer fix .
https://blog.csdn.net/mengks1987/article/details/109480289
http://events.jianshu.io/p/ad231ab22cee
https://www.jianshu.com/p/5d24fd29ab8b
style: ButtonStyle(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: MaterialStateProperty.all(Size(0, 0)),
padding: MaterialStateProperty.all(EdgeInsets.zero),
)
style: ButtonStyle(
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)))
)
style: ButtonStyle(
shadowColor: MaterialStateProperty.all(Colors.transparent),
)
style: ButtonStyle(
splashFactory: NoSplash.splashFactory
)
style: ButtonStyle(
textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16.0, color: Colors.white)),
)
整体啰嗦一遍:
const ButtonStyle({
this.textStyle, //字体
this.backgroundColor, //背景色
this.foregroundColor, //前景色
this.overlayColor, // 高亮色,按钮处于focused, hovered, or pressed时的颜色
this.shadowColor, // 阴影颜色
this.elevation, // 阴影值
this.padding, // padding
this.minimumSize, //最小尺寸
this.side, //边框
this.shape, //形状
this.mouseCursor, //鼠标指针的光标进入或悬停在此按钮的[InkWell]上时。
this.visualDensity, // 按钮布局的紧凑程度
this.tapTargetSize, // 响应触摸的区域
this.animationDuration, //[shape]和[elevation]的动画更改的持续时间。
this.enableFeedback, // 检测到的手势是否应提供声音和/或触觉反馈。例如,在Android上,点击会产生咔哒声,启用反馈后,长按会产生短暂的振动。通常,组件默认值为true。
});
常规的配置就这样了:
style: ButtonStyle(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: MaterialStateProperty.all(Size(0, 0)),
padding: MaterialStateProperty.all(EdgeInsets.zero),
shadowColor: MaterialStateProperty.all(Colors.transparent),
backgroundColor: MaterialStateProperty.all(Color(0xFFECB34D)),
textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16.0, color: Colors.white)),
// elevation: MaterialStateProperty.all(0),
// splashFactory: NoSplash.splashFactory
)
但是,通常,我们并不单独配,我们要配到主题里。这样,在逻辑的其他地方,只需要简单的使用 button 就可以了。先配置在主题里。
ThemeData lightTheme = ThemeData.light().copyWith(
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: MaterialStateProperty.all(Size(0, 0)),
padding: MaterialStateProperty.all(EdgeInsets.zero),
shadowColor: MaterialStateProperty.all(Colors.transparent),
backgroundColor: MaterialStateProperty.all(Color(0xFFECB34D)),
textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16.0, color: Colors.white)),
// elevation: MaterialStateProperty.all(0),
// splashFactory: NoSplash.splashFactory
))
);
使用的时候:
SizedBox(
width: 120,
height: 40,
child: ElevatedButton(
onPressed: () {
},
child: Text(
"我是按钮",
),
))
如果想覆盖或增加主题的设置:
比如,这里加了一个 borderradius 。
SizedBox(
width: 120,
height: 40,
child: ElevatedButton(
style: ButtonStyle()
.copyWith(shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)))),
onPressed: () {
},
child: Text(
"我是按钮",
),
))
最后加一条。想让按钮自适应父容器。可以这个弄。
Container(
width: 750,
child: SizedBox(
width: double.infinity,
height: 92,
child: ElevatedButton()
)
)
SizedBox 能具体定义按钮的宽高,而 double.infinity 又不能突破 Container 的宽高。通常 Container 不是具体的宽高才会用到这种自适应的方式。
ios:
<key>NSCameraUsageDescription</key>
<string>Example usage description</string>
<key>NSMicrophoneUsageDescription</key>
<string>Example usage description</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Example usage description</string>
android:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
用Flutter创建一个简单的SnackBar,你必须获得Scaffold的context,或者你必须使用一个GlobalKey附加到你的Scaffold上。
final snackBar = SnackBar(
content: Text('Hi!'),
action: SnackBarAction(
label: 'I am a old and ugly snackbar :(',
onPressed: (){}
),
);
// 在小组件树中找到脚手架并使用它显示一个SnackBars。
Scaffold.of(context).showSnackBar(snackBar);