Skip to content

Commit 648ab87

Browse files
committed
add highlight and remove spaces that breaks formatting
1 parent 94aa07c commit 648ab87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+10165
-10165
lines changed

.DS_Store

-8 KB
Binary file not shown.

manuscript/.DS_Store

-12 KB
Binary file not shown.

manuscript/chapter_1.1.md

+37-37
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ In this section, I'll explain the evolution of mobile development technologies.
88

99
Native development refers to the mobile application development using development tools, SDKs, and languages supported by a particular operating system such as iOS or Android. For example, a native Android app refers to an application developed by using Java or Kotlin using the Android SDK directly; while a native iOS app refers to an application developed by directly using the iOS SDK using languages like Objective-C or Swift.
1010

11-
Advantages of Native Development:
11+
Advantages of Native Development:
1212

1313
- Access to all features of the platform (GPS,Camera,Microphone).
1414
- Flawless performance.
@@ -23,7 +23,7 @@ Disadvantages of Native Development:
2323

2424
In the early days of mobile development, app development for businesses was not complicated, and native development could cope with product demand iterations. However, in recent years, with the advent of the Internet of Things and the rapid advancement of the Internet, in many business scenarios, traditional pure native development can no longer meet the growing needs of businesses.
2525

26-
Mainly manifested in:
26+
Mainly manifested in:
2727

2828
- As the demand for dynamic content surges, when the demand changes, native applications need to update the app through version updates which involve pushing updated build to the play store or app store and going through all the review and release process. Which is difficult to deal with in this fast-changing Internet era. So the necessity of dynamic application updates (application content can be updated without publishing a version) becomes crucial.
2929
- Business requirement changes rapidly, and development cost becomes lofty. As native development requires maintaining two codebases and two development teams for Android and iOS, when the app is updated then both the labor cost and development time increases..
@@ -57,40 +57,40 @@ As mentioned earlier, native development can access all the functions of the pla
5757
Let's take Android as an example to implement a native API for obtaining the phone model for JavaScript calls. In this example, the process of calling native API by JavaScript will be shown. Readers can intuitively experience the process of calling. We use the wendux's open source dsBridge on Github as JsBridge for communication. dsBridge is a cross-platform JsBridge that supports synchronous calling. In this example, only the synchronous calling function is used.
5858

5959
1. First implement the API to get the phone model in the native `getPhoneModel`
60-
61-
```
62-
class JSAPI {
63-
@JavascriptInterface
64-
public Object getPhoneModel(Object msg) {
65-
return Build.MODEL;
66-
}
60+
61+
``` dart
62+
class JSAPI {
63+
@JavascriptInterface
64+
public Object getPhoneModel(Object msg) {
65+
return Build.MODEL;
6766
}
68-
69-
```
70-
67+
}
68+
69+
```
70+
7171
2. Register native API to JsBridge through WebView
72-
73-
```
74-
import wendu.dsbridge.DWebView
75-
...
76-
//DWebView inherits from WebView, provided by dsBridge
77-
DWebView dwebView = (DWebView) findViewById(R.id.dwebview);
78-
//Register native API to JsBridge
79-
dwebView.addJavascriptObject(new JsAPI(), null);
80-
81-
```
82-
72+
73+
``` dart
74+
import wendu.dsbridge.DWebView
75+
...
76+
//DWebView inherits from WebView, provided by dsBridge
77+
DWebView dwebView = (DWebView) findViewById(R.id.dwebview);
78+
//Register native API to JsBridge
79+
dwebView.addJavascriptObject(new JsAPI(), null);
80+
81+
```
82+
8383
3. Call native API in JavaScript
84-
85-
```
86-
var dsBridge = require("dsbridge")
87-
//Directly call the native API `getPhoneModel
88-
var model = dsBridge.call("getPhoneModel");
89-
//print model
90-
console.log(model);
91-
92-
```
93-
84+
85+
``` dart
86+
var dsBridge = require("dsbridge")
87+
//Directly call the native API `getPhoneModel
88+
var model = dsBridge.call("getPhoneModel");
89+
//print model
90+
console.log(model);
91+
92+
```
93+
9494

9595
The above example demonstrates the process of JavaScript calling native API. Similarly, in general, the excellent JsBridge also supports native calling JavaScript, and dsBridge also supports it. If you are interested, you can go to the github dsBridge project homepage to view.
9696

@@ -170,12 +170,12 @@ Disadvantages:
170170

171171
In this article, we look at the last cross-platform technology: self-painted UI + native. The idea of ​​this technology is to draw the UI by implementing a unified interface rendering engine on different platforms without relying on the system's native controls, so the consistency of the UI on different platforms can be achieved. Note that the self-drawing engine solves the cross-platform problem of the UI. If it involves calling other system capabilities, it still involves native development.
172172

173-
The advantages of this platform technology are as follows:
173+
The advantages of this platform technology are as follows:
174174

175175
1. High performance; since the self-drawing engine directly calls the system API to draw the UI, the performance is close to that of native controls.
176-
176+
177177
2. Flexible, easy to maintain the component library, high fidelity and consistency of UI appearance; since UI rendering does not rely on native controls, there is no need to maintain a set of component libraries separately for controls of different platforms, so the code is easy to maintain. Since the component library is the same set of code and the same rendering engine, the display appearance of the component can achieve high fidelity and high consistency on different platforms; in addition, because it does not rely on native controls, it will not be restricted by the native layout system. This layout system will be very flexible.
178-
178+
179179

180180
Disadvantages:
181181

@@ -194,7 +194,7 @@ Main resons behing QT's Failure :
194194
- The official promotion is not good and the support is not enough.
195195
- QT was late as the market has been occupied by other dynamic frameworks (Hybrid and RN)
196196
- In mobile development, C++ development has inherent disadvantages compared to Web development stacks, and the direct result is that QT development efficiency is too low.
197-
197+
198198

199199
Based on these four points, although QT is a pioneer in the development of cross-platform self-drawing engines on mobile, it has become a martyr.
200200

manuscript/chapter_1.2.md

+23-23
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,29 @@ Currently, there are two main ways to run programs: compiling and interpreting c
2525
Now let's see why Flutter chooses Dart language? The author summarizes the following points based on the official explanation and my own understanding of Flutter (because other cross-platform frameworks use JavaScript as their development language, we mainly compare Dart and JavaScript):
2626

2727
1. **High Development Efficiency**
28-
29-
The Dart runtime and compiler support a combination of two key features of Flutter:
30-
31-
**JIT-based rapid development cycle** : Flutter adopts the JIT mode in the development phase, which avoids the need to compile every change and greatly saves development time;
32-
33-
**AOT-based release package** : Flutter can generate efficient ARM code through AOT during release to ensure application performance. JavaScript does not have this capability.
34-
28+
29+
The Dart runtime and compiler support a combination of two key features of Flutter:
30+
31+
**JIT-based rapid development cycle** : Flutter adopts the JIT mode in the development phase, which avoids the need to compile every change and greatly saves development time;
32+
33+
**AOT-based release package** : Flutter can generate efficient ARM code through AOT during release to ensure application performance. JavaScript does not have this capability.
34+
3535
2. **High Performance**
36-
37-
Flutter aims to provide a smooth, high-fidelity UI experience. In order to achieve this, Flutter needs to be able to run a large amount of code in each animation frame. This means that a language that can provide high performance without periodic pauses that will drop frames is needed. Dart supports AOT, which can do better than JavaScript at this point.
38-
36+
37+
Flutter aims to provide a smooth, high-fidelity UI experience. In order to achieve this, Flutter needs to be able to run a large amount of code in each animation frame. This means that a language that can provide high performance without periodic pauses that will drop frames is needed. Dart supports AOT, which can do better than JavaScript at this point.
38+
3939
3. **Fast Memory Allocation**
40-
41-
The Flutter framework uses functional streams, which makes it largely dependent on the underlying memory allocator. Therefore, it is very important to have a memory allocator that can effectively handle trivial tasks. Flutter will not work effectively in languages ​​lacking this feature. Of course, the JavaScript engine of Chrome V8 has also done a good job in memory allocation. In fact, many members of the Dart development team are from the Chrome team, so Dart cannot be used as an advantage over JavaScript in memory allocation, but for Flutter Say, it needs such features, and Dart just meets it.
42-
40+
41+
The Flutter framework uses functional streams, which makes it largely dependent on the underlying memory allocator. Therefore, it is very important to have a memory allocator that can effectively handle trivial tasks. Flutter will not work effectively in languages ​​lacking this feature. Of course, the JavaScript engine of Chrome V8 has also done a good job in memory allocation. In fact, many members of the Dart development team are from the Chrome team, so Dart cannot be used as an advantage over JavaScript in memory allocation, but for Flutter Say, it needs such features, and Dart just meets it.
42+
4343
4. **Type Safety**
44-
45-
Since Dart is a type-safe language and supports static type detection, some types of errors can be found before compilation and potential problems can be eliminated, which may be more attractive to front-end developers. In contrast, JavaScript is a weakly typed language, so many extension languages ​​and tools that add static type detection to JavaScript code have appeared in the front-end community, such as Microsoft's TypeScript and Facebook's Flow. In contrast, Dart itself supports static typing, which is an important advantage of it.
46-
44+
45+
Since Dart is a type-safe language and supports static type detection, some types of errors can be found before compilation and potential problems can be eliminated, which may be more attractive to front-end developers. In contrast, JavaScript is a weakly typed language, so many extension languages ​​and tools that add static type detection to JavaScript code have appeared in the front-end community, such as Microsoft's TypeScript and Facebook's Flow. In contrast, Dart itself supports static typing, which is an important advantage of it.
46+
4747
5. **The Dart team is by your side**
48-
49-
It may seem inconspicuous, but it is very important. Thanks to the active investment of the Dart team, the Flutter team can get more and more convenient support. As stated on the Flutter official website, "We are working closely with the Dart community to improve the use of Dart in Flutter. For example, when we initially adopted Dart, the language did not provide a toolchain for generating native binary files (which helps to achieve high performance), but it is now implemented because the Dart team built it specifically for Flutter.
50-
48+
49+
It may seem inconspicuous, but it is very important. Thanks to the active investment of the Dart team, the Flutter team can get more and more convenient support. As stated on the Flutter official website, "We are working closely with the Dart community to improve the use of Dart in Flutter. For example, when we initially adopted Dart, the language did not provide a toolchain for generating native binary files (which helps to achieve high performance), but it is now implemented because the Dart team built it specifically for Flutter.
50+
5151

5252
#### to sum up
5353

@@ -62,13 +62,13 @@ In this section, we first give an overall introduction to the Flutter framework,
6262
### Flutter Framework
6363
Flutter is designed as an extensible, layered system. It exists as a series of independent libraries that each depend on the underlying layer. No layer has privileged access to the layer below, and every part of the framework level is designed to be optional and replaceable.This is a pure Dart SDK, which implements a set of basic libraries.
6464

65-
From the bottom up, let's briefly introduce:
65+
From the bottom up, let's briefly introduce:
6666

6767
- Basic foundational classes, and building block services such as animation, painting, and gestures that offer commonly used abstractions over the underlying foundation.
6868
- The rendering layer provides an abstraction for dealing with layout. With this layer, you can build a tree of renderable objects. You can manipulate these objects dynamically, with the tree automatically updating the layout to reflect your changes.
6969
- The widgets layer is a composition abstraction. Each render object in the rendering layer has a corresponding class in the widgets layer. In addition, the widgets layer allows you to define combinations of classes that you can reuse. This is the layer at which the reactive programming model is introduced.
7070
- The Material and Cupertino libraries offer comprehensive sets of controls that use the widget layer’s composition primitives to implement the Material or iOS design languages.
71-
71+
7272

7373
### Flutter Engine
7474

@@ -85,9 +85,9 @@ This section gives you some learning suggestions and shares some of the author's
8585
### Resources
8686

8787
- **Official website** : Reading the resources of Flutter official website is the best way to get started quickly. At the same time, the official website is also a place to learn about the latest developments in Flutter. Since Flutter is still in the rapid development stage, readers are advised to go to the official website from time to time to see if there are any new trends. .
88-
88+
8989
- **Source code and comments** : The source code comments should be used as the first document for learning Flutter. The source code of the Flutter SDK is open source, and the comments are very detailed. There are also many examples. In fact, the official Flutter SDK documentation is generated through comments. Source code combined with comments can help you solve most problems.
90-
90+
9191
- **Github** : If the problem you encounter is not answered on StackOverflow, you can go to the flutter's github project to raise an issue.
9292
- **Gallery source code** : Gallery is the official sample app of Flutter. There are rich examples in it. Readers can download and install it online. The source code of Gallery is in the "examples" directory of the Flutter source code.
9393

0 commit comments

Comments
 (0)