今日重要的三件事
记录
遇到一个问题 :ReacNative:报错Cannot add a child that doesn’t have a YogaNode to a parent without a measure function!
完美被这个解决:
JS 保留小数点后面2位小数 - Jacklovely - 博客园
- 最笨的办法… [我就怎么干的…]
function get()
{
var s = 22.127456 + “”;
var str = s.substring(0,s.indexOf(".") + 3);
alert(str);
}
- 正则表达式效果不错
1. 最笨的办法… [我就怎么干的…]
function get()
{
var s = 22.127456 + "";
var str = s.substring(0,s.indexOf(".") + 3);
alert(str);
}
2. 正则表达式效果不错
<script type="text/javascript">
onload = function(){
var a = "23.456322";
var aNew;
var re = /([0-9]+\.[0-9]{2})[0-9]*/;
aNew = a.replace(re,"$1");
alert(aNew);
}
</script>
3. 他就比较聪明了…
<script>
var num=22.127456;
alert( Math.round(num*100)/100);
</script>
4.会用新鲜东西的朋友… 但是需要 IE5.5+才支持。
<script>
var num=22.127456;
alert( num.toFixed(2));
</script>
关于腾讯的X5内核
- Android 项目引入腾讯X5内核 - 韩小呆的博客 - CSDN博客
- 强改微信内置浏览器——让x5内核滚粗 - feisher - CSDN博客
- Android 抛弃原生WebView,使用腾讯X5内核、并加入广告拦截。 - WL-鬼 - CSDN博客
Flutter UI APP 低调上线 - 掘金
efoxTeam/flutter-ui: Flutter 开发组件库中文社区
Flutter打Release或Debug包
Preparing an Android App for Release - Flutter
Flutter-Build An Android Release Apk - 简书
第一步:签名
和设置android签名一样在Android项目目录下的build.gradle里面设置好签名。
第二步:执行打包命令
-
在flutter项目目录下执行下面的命令
-
打Release包:执行
flutter build apk --release或直接flutter build apk(默认打release包) -
打Debug包: 执行
flutter build apk --debug
记录全程fork一个flutter项目的过程
Panda-MBP:flutter-ui panda8z$ flutter get-packages
Could not find a command named "get-packages".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
Panda-MBP:flutter-ui panda8z$ flutter -h
Manage your Flutter app development.
Common commands:
flutter create <output directory>
Create a new Flutter project in the specified directory.
flutter run [options]
Run your Flutter application on an attached device or in an emulator.
Usage: flutter <command> [arguments]
Global options:
-h, --help Print this usage information.
-v, --verbose Noisy logging, including all shell commands executed.
If used with --help, shows hidden options.
-d, --device-id Target device id or name (prefixes allowed).
--version Reports the version of this tool.
--suppress-analytics Suppress analytics reporting when this command runs.
--bug-report Captures a bug report file to submit to the Flutter team.
Contains local paths, device identifiers, and log snippets.
--packages Path to your ".packages" file.
(required, since the current directory does not contain a ".packages" file)
Available commands:
analyze Analyze the project's Dart code.
attach Attach to a running application.
bash-completion Output command line shell completion setup scripts.
build Flutter build commands.
channel List or switch flutter channels.
clean Delete the build/ and .dart_tool/ directories.
config Configure Flutter settings.
create Create a new Flutter project.
devices List all connected devices.
doctor Show information about the installed tooling.
drive Runs Flutter Driver tests for the current project.
emulators List, launch and create emulators.
format Format one or more dart files.
help Display help information for flutter.
install Install a Flutter app on an attached device.
logs Show log output for running Flutter apps.
make-host-app-editable Moves host apps from generated directories to non-generated directories so that they can be edited by developers.
packages Commands for managing Flutter packages.
precache Populates the Flutter tool's cache of binary artifacts.
run Run your Flutter app on an attached device.
screenshot Take a screenshot from a connected device.
stop Stop your Flutter app on an attached device.
test Run Flutter unit tests for the current project.
trace Start and stop tracing for a running Flutter app.
upgrade Upgrade your copy of Flutter.
version List or switch flutter versions.
Run "flutter help <command>" for more information about a command.
Run "flutter help -v" for verbose help output, including less commonly used options.
Panda-MBP:flutter-ui panda8z$ flutter packages get
Running "flutter packages get" in flutter-ui... 19.8s
Panda-MBP:flutter-ui panda8z$ flutter run -h
Run your Flutter app on an attached device.
Usage: flutter run [arguments]
-h, --help Print this usage information.
--debug Build a debug version of your app (default mode).
--profile Build a version of your app specialized for performance profiling.
--release Build a release version of your app.
--flavor Build a custom app flavor as defined by platform-specific build setup.
Supports the use of product flavors in Android Gradle scripts.
Supports the use of custom Xcode schemes.
--trace-startup Trace application startup, then exit, saving the trace to a file.
--route Which route to load when running the app.
--target-platform Specify the target platform when building the app for an Android device.
Ignored on iOS.
[default (default), android-arm, android-arm64, android-x86, android-x64]
-t, --target=<path> The main entry-point file of the application, as run on the device.
If the --target option is omitted, but a file name is provided on the command line, then that is used instead.
(defaults to "lib/main.dart")
--observatory-port Listen to the given port for an observatory debugger connection.
Specifying port 0 (the default) will find a random free port.
--[no-]pub Whether to run "flutter packages get" before executing this command.
(defaults to on)
--start-paused Start in a paused mode and wait for a debugger to connect.
--enable-software-rendering Enable rendering using the Skia software backend. This is useful when testing Flutter on emulators. By default, Flutter will attempt to either use OpenGL or Vulkan and fall back to software when neither is available.
--skia-deterministic-rendering When combined with --enable-software-rendering, provides 100% deterministic Skia rendering.
--trace-skia Enable tracing of Skia code. This is useful when debugging the GPU thread. By default, Flutter will not log skia code.
--trace-systrace Enable tracing to the system tracer. This is only useful on platforms where such a tracer is available (Android and Fuchsia).
--[no-]await-first-frame-when-tracing Whether to wait for the first frame when tracing startup ("--trace-startup"), or just dump the trace as soon as the application is running. The first frame is detected by looking for a Timeline event with the name "Widgets completed first useful frame". By default, the widgets library's binding takes care of sending this event.
(defaults to on)
--[no-]use-test-fonts Enable (and default to) the "Ahem" font. This is a special font used in tests to remove any dependencies on the font metrics. It is enabled when you use "flutter test". Set this flag when running a test using "flutter run" for debugging purposes. This flag is only available when running in debug mode.
--[no-]build If necessary, build the app before running.
(defaults to on)
--[no-]hot Run with support for hot reloading. Only available for debug mode. Not available with "--trace-startup".
(defaults to on)
--pid-file Specify a file to write the process id to. You can send SIGUSR1 to trigger a hot reload and SIGUSR2 to trigger a hot restart.
Run "flutter help" to see global options.
Panda-MBP:flutter-ui panda8z$ flutter run
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
MHA AL00 • GWY0216A22013956 • android-arm64 • Android 8.0.0 (API 26)
iPhone 6 Plus • 9CDD2015-49D1-44EB-B771-9A6C91F209AF • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)
iPhone X • 4A55271A-66AA-49BC-8960-67AA48349FDB • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)
Panda-MBP:flutter-ui panda8z$ flutter run -d 4A55271A-66AA-49BC-8960-67AA48349FDB
Launching lib/main.dart on iPhone X in debug mode...
Running pod install... 64.3s
├─Assembling Flutter resources... 2.2s
└─Compiling, linking and signing... 13.2s
Xcode build done. 27.4s
5.16.0 - [Firebase/Analytics][I-ACS023007] Analytics v.50500000 started
5.16.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
database path: /Users/panda8z/Library/Developer/CoreSimulator/Devices/4A55271A-66AA-49BC-8960-67AA48349FDB/data/Containers/Bundle/Application/EE0F1012-D28C-4C95-9085-8566D9435210/Runner.app/FlutterDownloaderDatabase.bundle/download_tasks.sql
create DB successfully
MAXIMUM_CONCURRENT_TASKS = 3
init NSURLSession with id: com.flutter.beer.download.background.1553673527.186623
AllFilesDownloadedMessage: All files have been downloaded
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: widgetsItem Instance of 'ItemListInfo'
flutter: payload= null
flutter: builder=Closure: (dynamic, dynamic, dynamic) => MaterialApp
flutter: deviceLocale=null supportedLocales=[zh_CH, en_US]
flutter: deviceLocale=en_US supportedLocales=[zh_CH, en_US]
flutter: zh
flutter: en
flutter: 当前语言: en_US
flutter: Json数据: {nav_title_0: 组件, nav_title_1: 我的, title_component: 组件, title_my: 我的, widgetType: {regularLayout: 常规布局}, common: {changeLanguage: Switch to English, changeVersion: 更新版本, compProgress: 组件进度}, common_mine_1: {cn: 中文, en: 英文, language: 选择语言, environment: 选择环境, compProgress: 组件进度, success: 切换成功, theme: 选择主题, version: 版本}, mine: {loadNetwork: 网络优良,可选择加载线上文档资源, loadLocal: 网络较差时,可选择加载本地文档资源}, loading: 加载中, ScrollComponents: 滚动, Common: 通用, Form: 表单, Regular: 布局, Navigator: 导航, BulletBox: 窗口, Animate: 动画, Gestures: 手势, Vision: 视觉}
flutter: 当前语言: en_US
flutter: Json数据: {nav_title_0: Components, nav_title_1: My, title_component: Components, title_my: My, widgetType: {regularLayout: common layout}, common: {changeLanguage: 显示中文, changeVersion: checkVersion, compProgress: Components Progress}, common_mine_1: {cn: CN, en: EN, language: Select Language, environment: Select Environment, compProgress: Components Progress, success: Success To Change , theme: Select Theme, version: Version}, mine: {loadNetwork: Load Network Document Resources, loadLocal: Load Local Document Resources}, loading: Loading, ScrollComponents: ScrollComponents, Common: Common, Form: Form, Regular: Regular, Navigator: Navigator, BulletBox: BulletBox, Animate: Animate, Gestures: Gestures, Vision: Vision}
flutter: _delegate = AppLocalizationsDelegate[AppLocalizations]
flutter: payload= null
flutter: version https://raw.githubusercontent.com/efoxTeam/flutter-ui/master/assets/config.json
flutter: builder=Closure: (dynamic, dynamic, dynamic) => Scaffold
flutter: _delegate = AppLocalizationsDelegate[AppLocalizations]
flutter: builder=Closure: (dynamic, dynamic, dynamic) => Scaffold
flutter: _version 1.0
flutter: _delegate = AppLocalizationsDelegate[AppLocalizations]
flutter: builder=Closure: (dynamic, dynamic, dynamic) => Scaffold
2,881ms (!)
???? To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
An Observatory debugger and profiler on iPhone X is available at: http://127.0.0.1:61248/
For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".
[C1.1 02DEE454-EA28-4FCA-8988-35B397AC9F2C 127.0.0.1:61284<->127.0.0.1:1080]
Connected Path: satisfied (Path is satisfied), interface: lo0
Duration: 6.462s, , TCP @4.547s took 0.000s, TLS took 1.659s
bytes in/out: 4598/1064, packets in/out: 7/11, rtt: 0.000s, retransmitted packets: 0, out-of-order packets: 0
flutter: builder=Closure: (dynamic, dynamic, dynamic) => Scaffold
[C2.1.1 97C3C8EE-12E3-43F1-894C-FC1FD3C3DC45 192.168.0.134:61346<->203.208.40.46:443]
Connected Path: satisfied (Path is satisfied), interface: en0
Duration: 0.642s, DNS @0.029s took 0.004s, TCP @0.035s took 0.221s, TLS took 0.271s
bytes in/out: 3881/766, packets in/out: 9/8, rtt: 0.119s, retransmitted packets: 0, out-of-order packets: 0
[C3.1.1 9C668457-84CC-460A-AD8C-4A6E45D64C6C 192.168.0.134:61353<->203.208.40.46:443]
Connected Path: satisfied (Path is satisfied), interface: en0
Duration: 0.338s, DNS @0.002s took 0.004s, TCP @0.008s took 0.046s, TLS took 0.192s
bytes in/out: 3595/1214, packets in/out: 8/9, rtt: 0.048s, retransmitted packets: 0, out-of-order packets: 0
[C4.1 B4EBA96B-C345-4502-9878-ACEB3C2288B5 127.0.0.1:50078<->127.0.0.1:1080]
Connected Path: satisfied (Path is satisfied), interface: lo0
Duration: 6.618s, , TCP @0.633s took 0.000s, TLS took 5.764s
bytes in/out: 4585/1062, packets in/out: 9/11, rtt: 0.000s, retransmitted packets: 0, out-of-order packets: 0