Android原生应用通常指使用Java或Kotlin语言直接调用Android SDK开发的应用程序;而iOS原生应用通常指使用Objective-C或Swift语言直接调用iOS SDK开发的应用程序。
主要优势:
可访问平台全部功能(GPS、摄像头);
速度快、性能高、可以实现复杂动画及绘制,整体用户体验好;
主要缺点:
技术类型 | UI渲染方式 | 性能 | 开发效率 | 动态化 | 框架代表 |
---|---|---|---|---|---|
H5+原生 | WebView渲染 | 一般 | 高 | 支持 | Cordova、Ionic |
JavaScript+原生渲染 | 原生控件渲染 | 好 | 中 | 支持 | RN、Weex |
自绘UI+原生 | 调用系统API渲染 | 好 | Flutter高, QT低 | 默认不支持 | QT、Flutter |
下载flutter https://flutter.dev/docs/get-started/install
MacOS下安装和设置环境变量
vi $HOME/.bash_profile
export PUB_HOSTED_URL=https://pub.flutter-io.cn //国内用户需要设置
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn //国内用户需要设置
export PATH=/Users/用户名/flutter/bin:$PATH
source $HOME/.bash_profile
flutter --version
Flutter 1.9.1+hotfix.2 ? channel stable ? https://github.com/flutter/flutter.git
Framework ? revision 2d2a1ffec9 (6 days ago) ? 2019-09-06 18:39:49 -0700
Engine ? revision b863200c37
Tools ? Dart 2.5.0
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.14 18A391, locale zh-Hans-CN)
[?] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[?] Xcode - develop for iOS and macOS
? Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
? CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage
on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
sudo gem install cocoapods
pod setup
[!] Android Studio (version 3.5)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
[?] VS Code (version 1.38.0)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
Flutter是Fuchsia的开发框架,是一套移动UI框架,可以快速在iOS、Android以及Fuchsia上构建高质量的原生用户界面。其官方编程语言为Dart。
Flutter Framework是一个纯 Dart实现的 SDK,它实现了一套基础库,自底向上,我们来简单介绍一下:
dart:ui
包,它是Flutter引擎暴露的底层UI库,提供动画、手势及绘制能力。lib/main.dart
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Welcome to Flutter',
home: new Scaffold(
appBar: new AppBar(
title: new Text('Welcome to Flutter'),
),
body: new Center(
child: new Text('Hello World'),
),
),
);
}
}
MaterialApp
是Material库中提供的Flutter APP框架,通过它可以设置应用的名称、主题、语言、首页及路由列表等。是Material库中提供的页面脚手架,它包含导航栏和Body以及
FloatingActionButton原文:https://www.cnblogs.com/rohmeng/p/11517683.html