Flutter Gallery
Flutter 画廊是一个资源,以帮助开发人员评估和使用颤振。它是一个材料设计的集合&Cupertino小部件、行为和vignette实现了Flutter。我们经常被问到如何才能看到颤振的动作,这个画廊展示了颤振提供了什么,以及它在野外的表现。
克隆代码
git clone https://github.com/flutter/gallery.git
命令集合
如果您想运行Flutter画廊例子,请确保首先切换到主频道:
flutter channel master
flutter upgrade
flutter upgrade 下载需要过程
Downloading Dart SDK from Flutter engine 17737e6fd4ec28d83ecc1f159e50f9330f5befb1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 227M 100 227M 0 0 2357k 0 0:01:38 0:01:38 --:--:-- 3068k
Building flutter tool...
Flutter is already up to date on channel master
Flutter 1.19.0-2.0.pre.193 • channel master • https://github.com/flutter/flutter.git
Framework • revision fed18fc433 (4 hours ago) • 2020-05-29 03:43:01 -0400
Engine • revision 17737e6fd4
Tools • Dart 2.9.0 (build 2.9.0-11.0.dev 6489a0c68d)
Flutter画廊支持的平台
包括:研究后这个例子,比较全,会有收获的。
- Android
- iOS
- web
- macOS
- Linux
- Windows
注意:您可以自己从源代码构建这些平台,请注意必须启用桌面支持。例如,要在Windows上运行应用程序
alue to "true".
You may need to restart any open editors for them to read new settings.
AppledeMacBook-Pro:gallery apple$ flutter create .
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Downloading package sky_engine... 0.6s
Downloading flutter_patched_sdk tools... 4.8s
Downloading flutter_patched_sdk_product tools... 45.5s
Downloading darwin-x64 tools... 10.8s
Downloading darwin-x64/font-subset tools... 1.1s
Recreating project ....
windows/Runner.vcxproj (created)
windows/runner/flutter_window.cpp (created)
windows/runner/utils.h (created)
windows/runner/run_loop.h (created)
windows/runner/utils.cpp (created)
windows/runner/runner.exe.manifest (created)
windows/runner/win32_window.h (created)
windows/runner/win32_window.cpp (created)
windows/runner/resources/app_icon.ico (created)
windows/runner/window_configuration.cpp (created)
windows/runner/resource.h (created)
windows/runner/run_loop.cpp (created)
windows/runner/Runner.rc (created)
windows/runner/main.cpp (created)
windows/runner/window_configuration.h (created)
windows/runner/flutter_window.h (created)
windows/Runner.sln (created)
windows/AppConfiguration.props (created)
windows/flutter/.template_version (created)
windows/.gitignore (created)
windows/Runner.vcxproj.filters (created)
windows/scripts/prepare_dependencies.bat (created)
windows/scripts/bundle_assets_and_deps.bat (created)
windows/FlutterBuild.vcxproj (created)
gallery.iml (created)
web/favicon.png (created)
android/gallery_android.iml (created)
.idea/runConfigurations/main_dart.xml (created)
.idea/libraries/Dart_SDK.xml (created)
.idea/libraries/KotlinJavaRuntime.xml (created)
Running "flutter pub get" in gallery...
All done!
[✓] Flutter: is fully installed. (Channel master, 1.19.0-2.0.pre.193, on Mac OS X 10.14.6 18G4032, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices: is partially installed; more components are available. (Android SDK version 29.0.3)
[!] Xcode - develop for iOS and macOS: is partially installed; more components are available. (Xcode 11.3.1)
[✓] Chrome - develop for the web: is fully installed.
[✓] Android Studio: is fully installed. (version 3.6)
[!] IntelliJ IDEA Ultimate Edition: is partially installed; more components are available. (version 2020.1)
[✓] Connected device: is fully installed. (3 available)
Run "flutter doctor" for information about installing additional components.
In order to run your application, type:
运行$ flutter run
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Downloading android-arm-profile/darwin-x64 tools... 1.0s
Downloading android-arm-release/darwin-x64 tools... 1.0s
Downloading android-arm64-profile/darwin-x64 tools... 1.1s
Downloading android-arm64-release/darwin-x64 tools... 3.3s
Downloading android-x64-profile/darwin-x64 tools... 1.1s
Downloading android-x64-release/darwin-x64 tools... 1.0s
Downloading Web SDK... 3.6s
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'... 注: /Users/apple/tools/flutter/.pub-cache/hosted/pub.flutter-io.n/url_launcher-5.4.10/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
Running Gradle task 'assembleDebug'... (This is taking an unexpectedly long time.) ⣟
要包含新的splash动画,这需要一段出乎意料的长时间。
第一次编译错误了
* What went wrong:
Could not resolve all files for configuration ':package_info:lintClassPath'.
> Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.12)
> Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar'.
> Read timed out
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 8m 28s
第二编译,用AS编译,运行Flutter run提示
flutter run 需要制定具体的device 全部-d all 不现实,毕竟就8G内存,全跑估计就挂啦。
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
iPhone 11 Pro Max • 84F452D0-81AC-41A4-82E2-7238B8031D51 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
Web Server • web-server • web-javascript • Flutter Tools
Chrome • chrome • web-javascript • Google Chrome 83.0.4103.61
重新安装cocoapods,提示下面错误
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200529-79302-hzzped.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out
重新安装cocoapods
先运行android Flutter run -d run-android
编译成功就是比较慢
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
✏️ Creating `android/settings_aar.gradle`...
✓ `android/settings_aar.gradle` created successfully.
Building plugin package_info...
Running Gradle task 'assembleAarRelease'...
✓ Built build/app/outputs/repo.
Building plugin path_provider...
Running Gradle task 'assembleAarRelease'...
✓ Built build/app/outputs/repo.
Building plugin shared_preferences...
Running Gradle task 'assembleAarRelease'...
web的运行起来了。好慢
小结
效果不错里面有全部的例子,都可以跑起来。真的要好好学习一下例子,拆出来学习
来源:oschina
链接:https://my.oschina.net/u/4310950/blog/4298087