對於已經認識Android的人:
UI- Android需要XML集成,而所有內容都是flutter中的小部件,可以在一個文件中製作
聽眾沒有更多的聽眾來on Clicks,請致電方法,更改狀態並享受視野
findView-不再使用FindViewById() - 只需在widget(){}內完成所有操作,然後將發現留給Android
gradle-不再有Gradle問題 - 在PubSpec.yaml文件中添加依賴項,並刷新使用新庫的應用程序
資產- 必須分別管理撲朔迷離,您必須聲明所使用的所有內容 - 例如:圖像,字體。在Android中,您可以將其添加到“文件”部分中並使用它們。
動畫要容易得多,並且在顫動中得到很好的支持 - 基本用途 - 例如:飛濺活動,刷卡,結果,分析頁面,導航
運行該應用程序- 在顫音中進行熱重新加載 - 只需重新加載'r',然後重新啟動應用程序。 Android Studio每次重新加載最多需要20-30秒,如果有Gradle問題,則每次彈出了更多
API - 可以使用不同的庫(例如使用GSON的改造)來完成api -android API,而在撲朔迷離中可以進行撲來而不會疼痛。常見的提取函數可用於撲動,並具有異步等待的方法來調用API。
回收器/列表視圖- 回收器視圖在Android中用於在屏幕上創建不同的列表。我們需要一個具有接口的適配器,我們需要知道各種不同的功能才能完全實施它。 Flutter只有一個用於ListView的小部件,我們可以在其中定義不同的listilites或動態添加內容。容易得多,看起來更簡單。
學習曲線- 一旦您知道DART,就可以輕鬆地在撲朔迷離中工作,這類似於JavaScript,並了解有關小部件的基本概念。 Android允許您在設計師的幫助下進行佈局,可用於製作約束佈局。在Android中,製作基本應用程序絕對更容易學習,但是隨著我們在碎片和其他內容中的深度,它開始變得複雜
片段與組件(窗口小部件) - 我們可以在任何需要的地方簡單地使用小部件組件,而與我們在Android中製作的片段不同,在使用如何使用捆綁包,適配器,XML佈局和其他方法(例如OnCreateview和layoutinflator)的方法之前,我們需要一些知識。
SQL數據庫- 這兩種技術都非常相似。唯一的區別是,如果您試圖連續添加某些內容,則狀態管理可以到位,您將必須在狀態中存儲密鑰並使用setState(){_ key+= 1} - >僅使用用例。 Android中的房間庫是相當廣泛的,也易於實現
體系結構模式- 一切都歸結為Android中的MVP/ MVVM/ MVC,而我們在Flutter中有bloc和提供商,它們的作用類似於MVC,通過創建水槽和流來分開業務邏輯
代碼編輯器- VSCODE/ANDROID Studio -Android的Flutter和Android Studio
入門指南- 對於Android來說非常直截了當,下載錄音室並開始,而您必須做很多事情來撲朔迷離 - 可能很煩人
firebase-撲面而為的資源: -
https://firebase.google.com/docs/flutter/setup
https://flutter.dev/docs/development/data-and-backend/firebase
https://www.youtube.com/watch?v=8m-fa239hy4
https://www.youtube.com/channel/ucftm1fgjzskospdzgtbp7ha/search?query=fireBase
https://codelabs.developers.google.com/codelabs/flutter-firebase/#0
FIREBASE連接- 絕對易於實現飛行,您可以根據您製作的列表視圖在20行代碼中進行操作。基礎知識是相同的,您需要.json文件,並且必須將其添加到Firebase控制台中。在顫抖中進行編碼有助於您以更好的方式理解它。總體而言,這是相似的。
Lists + Firebase- Android具有瘋狂的回收器視圖,使一切變得如此艱難,並且集成Firebase + Recycler View有大約200篇文章,而您無法掌握它。沒有教程,我無法在Android中實施某些內容
獲取,推動數據- 在flutter Firebase中也更容易推動數據,實際上有一個ontap()方法,它允許您發送數據快照
機器學習- 集成機器學習
UI -Flutter和RN具有一個一個文件系統,您可以在其中定義規則和UI。我個人喜歡Flutter應用程序的接口,因為它的定義更為明確。它也由Google維護,該Google擁有Android,並且可以與Google進行更好的集成。
類- Flutter使用小部件來實現所有內容,從文本視圖到TabViews - 它們稱為“小部件”。 Flutter使用DART,而React Antive使用Typescript或JavaScript。
組件-RN具有組件,我們必須從“反應原始”中導入它們才能使用它們。 Flutter具有可以在類似空間中使用的小部件。兩者都相似,除了樣式和渲染部分。
造型顫動 - 內部小部件 - 因此,如果您想要填充=>將小部件包裹在padding()窗口小部件中,請用一些填充,反應本機:定義const樣式:樣式表並在此處添加樣式 - 類似於擁有CSS的Web樣式。因此,React Native具有CSS樣式,而Flutter具有“小部件”樣式
動畫- 顫動更容易抓取,而React Antial具有更廣泛的方面
學習曲線- 反應天然和顫動的相似之處。
庫-NPM有助於對本機進行反應,而對於flutter,我們只將其添加到PubSpec.yaml文件中
API-他們倆對使用API都有清晰的願景。 RN的好文章-https://medium.com/better-programming/handling-api-like-a-boss-boss-inct-natt-native-364abd92dc3d
代碼編輯器- vs代碼都很受歡迎
入門- 就個人而言,與Windows上的React Native一起工作真的很難。如果您使用Mac,那會好多了,但是總體而言,紅屏會讓您煩惱很多。 Flutter沒有最簡單的入門指南,但是那裡有幫助您的支持。
總的來說- 兩者都可以製作交叉本地應用程序,我會在任何一天選擇顫抖 - 黑客馬拉松/快速項目/學習Android,並進行反應本機 - Web/ Learn react.js/ - >如果您想強調自己:P



fetch () async {
var url = "API-HERE" ;
var res = await http. get (url);
var body = jsonDecode (res.body);
// body is your API body
}content description類的內容添加到Android中的按鈕,TextView等。 https://steemit.com/utopian-io/@tensor/advanced-flutter-project-- best-practices--基因 - 基因 - 基督 - 哥倫比亞省 - 帕特 - 三者 - part-three
class App extends StatelessWidget {
@override
Widget build ( BuildContext context) {
// TODO: implement build
return MaterialApp (
home : Home (),
theme : ThemeData (primaryColor : PrimaryColor ), //add-your-color here || or remove this
debugShowCheckedModeBanner : false ,
);
}
}
class Home extends StatefulWidget {
@override
State < StatefulWidget > createState () {
// TODO: implement createState
return new _HomeState ();
}
}
class _HomeState extends State < Home >{
@override
Widget build ( BuildContext context) {
return Scaffold (
body : Column ()
);
}child : users.length <= 0
? Center (
child : EmptyState (
title : 'Oops' ,
message : 'Add form by tapping add button below' ,
),
)
: ListView . builder (
addAutomaticKeepAlives : true ,
itemCount : users.length,
itemBuilder : (_, i) => users[i],
),
) fetch () async {
var url = "API-HERE" ;
var res = await http. get (url);
var body = jsonDecode (res.body);
// body is your API body
} for ( int i = 0 ;i < body[ 0 ][ 'staggered_tiles' ].length;i ++ ){
_staggeredTiles. add ( new StaggeredTile . count (
body[ 0 ][ 'staggered_tiles' ][i][ 'cross_axis' ], // body is what we get from the API
body[ 0 ][ 'staggered_tiles' ][i][ 'main_axis' ] // body is what we get from the API
));
}
if (body[i][ 0 ][ 'type' ] == 'donut' ) {
List < LabelPieSales > _d = [];
for ( int j = 0 ; j < body[i][ 0 ][ 'data' ].length; j ++ ) {
_d. add ( new LabelPieSales (
body[i][ 0 ][ 'data' ][j][ 'year' ], body[i][ 0 ][ 'data' ][j][ 'sales' ])); // body is what we get from the API
}
_wid_top. add ( new Container (
height : 200 ,
width : 200 ,
child : DonutChartWidget . withSampleData (_d),
));
}
else if (body[i][ 0 ][ 'type' ] == 'label-pie' ) {
List < LabelPieSales > _d = [];
for ( int j = 0 ; j < body[i][ 0 ][ 'data' ].length; j ++ ) {
_d. add ( new LabelPieSales (
body[i][ 0 ][ 'data' ][j][ 'year' ], body[i][ 0 ][ 'data' ][j][ 'sales' ])); // body is what we get from the API
}
_wid_top. add ( new Container (
height : 200 ,
width : 200 ,
child : SimpleBarChart . withSampleData (_d),
));
} return Container (
padding : const EdgeInsets . all ( 4.0 ),
child : appState.isFetching
? CircularProgressIndicator ()
: appState. getResponseJson () != null
? ListView . builder (
primary : false ,
shrinkWrap : true ,
itemCount : appState. getResponseJson ().length,
itemBuilder : (context, index) {
return Container (
height : 100 ,
width : 100 ,
child : graph (appState. getResponseJson ()),
);
},
)
: Text ( "Press Button above to fetch data" ),
); initDB () async {
return await openDatabase (
join ( await getDatabasesPath (), 'graphs_database.db' ),
onCreate : (db, version) {
return db. execute (
"CREATE TABLE graphs(id INTEGER PRIMARY KEY, type TEXT)" ,
);
},
version : 1 ,
);
}floatingActionButton : FloatingActionButton (
child : Icon ( Icons .add),
onPressed : () async {
Dog dog = new Dog (id : _id, name : "name" ,age : 22 );
await insertDog (dog);
setState (() {
_id += 1 ;
});
},
), List < Graph > graphs_sql = await graphs ();
List < String > graphs_sql_types = [];
for ( int i = 0 ;i < graphs_sql.length;i ++ ){
graphs_sql_types. add (graphs_sql[i].type);
}
if (graphs_sql.length != _types.length) {
for ( int i = 0 ; i < _types.length; i ++ ) {
if ( ! graphs_sql_types. contains (_types[i])){ // add only if a new type
await insertGraph ( new Graph (id : i, type : _types[i]));
}
}
} launchUrl () {
setState (() {
urlString = controller.text;
flutterWebviewPlugin. reloadUrl (urlString);
});
} class News {
String dateAdded;
String title;
String body;
String level;
String category;
News ( this .dateAdded, this .title, this .body, this .level, this .category);
}
class Record {
final String name;
final int votes;
final DocumentReference reference;
Record . fromMap ( Map < String , dynamic > map, { this .reference})
: assert (map[ 'name' ] != null ),
assert (map[ 'votes' ] != null ),
name = map[ 'name' ],
votes = map[ 'votes' ];
Record . fromSnapshot ( DocumentSnapshot snapshot)
: this . fromMap (snapshot.data, reference : snapshot.reference);
@override
String toString () => "Record<$ name :$ votes >" ;
} double _height = MediaQuery . of (context).size.height;
double _width = MediaQuery . of (context).size.width; @override
void initState () {
// TODO: implement initState
super . initState ();
_image = {url};
localList1 = globalList1;
localList1 = globalList2;
} export const sendToTopic = functions.firestore
.document( 'recipes/{recipyId}' )
.onCreate(async snapshot => {
// const recipe = snapshot.data();
const payload : admin.messaging.MessagingPayload = {
notification: {
title: 'new recipe added, check it out' ,
body: 'Make it and eat it'
}
};
return fcm. sendToTopic ( 'recipes' , payload);
}); @override
Widget build ( BuildContext context) {
return Scaffold (
appBar : AppBar (title : Text ( 'Recipes for you' )),
body : _buildBody (context),
);
}
Widget _buildBody ( BuildContext context) {
return StreamBuilder < QuerySnapshot >(
stream : Firestore .instance. collection ( 'recipes' ). snapshots (),
builder : (context, snapshot) {
if ( ! snapshot.hasData) return LinearProgressIndicator ();
return _buildList (context, snapshot.data.documents);
},
);
} List<Recipe> recipe_list = [];
// snapshot.map((data) => recipeList(context, data).toList());
for(int i=0;i<snapshot.length;i++){
Recipe recipe = Recipe.fromSnapshot(snapshot[i]);
recipe_list.add(recipe);
}
return AsymmetricView(products: recipe_list,);