The pit about setting up the environment in front is omitted here, because I just want to take notes today! Fill it up later when we build it.

The first day

It's just a small hole today. I used Column to carry out a two-line layout, and found that the two lines of text were always centered. Even if Align was used for positioning, it still did not work. I can't figure out what the problem is. So... I decided to settle down and look at the properties of the component I was using (yes, I compromised). Column is found to have a crossAxisAlignment attribute. This property controls how the text in Column is aligned. The default is crossAxisAlignment crossAxisAlignment. Center. Here we change it to CrossAxisAlignment. Start and there is no problem! Paste the code and result Column (crossAxisAlignment: crossAxisAlignment. Start, children: < Widget > [Padding (Padding: EdgeInsets.only(top: 15, left: 0), child: Text(dynamics['name'], style: TextStyle(fontSize: 13, color: Color(0xff333333))) ), Padding( padding: EdgeInsets.only(top: 7), child: Text(dynamics['creatTime'], style: TextStyle(fontSize: 11, color: Color(0xff9E9E9E))) ) ] )Copy the code

In fact, this is not pit, their components did not understand clearly. Flutter has many components and properties for alignment and positioning. Adding this property to Column felt less necessary. This, of course, avoids the need for text alignment on each Column subcomponent. But there are many components that don’t have similar properties on them, so the property of Flutter puzzled me a bit.

The second day

Previously, the Flutter environment was built on the company’s computer, so I built one on my own computer. Download SDK configuration environment variables before not to say, there is no problem.

But remember to post in Java8, remember to post in Java8, remember to post in Java8.

Start with Flutter Doctor. The first time I run it

I’m kidding…

How can I punch myself in the face when I have successfully configured the Win7 environment flutter? Absolutely not.

I vaguely remember that this situation also occurred in the previous configuration. It seems that the file sdkManager has been changed, but it is not the same as what baidu has just received. I made some changes to the DEFAULT_JVM_OPTS variable from memory and the result of the above error. I can’t find java.se.ee, so I removed it from the value string. Modified value should be DEFAULT_JVM_OPTS = “- Dcom. Android. Sdklib. Toolsdir = % ~ dp0. The.” – XX: + IgnoreUnrecognizedVMOptions – add – modules’ run the sdkmanager – update again

Yes, it worked. It was like the sound of ‘Aleluia’ was all over my head. It took me three hours, but if I didn’t remember the setup, I wouldn’t be able to get it out. Just take notes. What a terrible environment!

Environment building replenishment

When running flutter project, download https://services.gradle.org/distributions/gradle-4.10.2-all.zip failed. Then go to download on the net, also still won’t do, right path modified into https://services.gradle.org/distributions/gradle-4.6-all.zip can run normally. Individual conjectures should be Windows version is different the version that uses is different!

On the third day

It’s been a month. Renew it. Today, the home page navigation of the project has been reconfigured. The bottom navigation was realized with the BottomNavigationBar before.

Flex layout

The fourth day

Project progress: the homepage navigation page has been completed and it should be connected with real data, but the request interface encountered a big pit. From the Internet, everyone was talking about a library of Internet requests, ‘Dio’, so I gave it a try. However, an internal error 500 was reported by the flutter application when an interface request was made using the official POST method. However, Google and Baidu have no relevant introduction, let alone the official one (new product ecology, you know). Dart’s native Web request library, HTTP, was then used and the interface was properly requested. So, is Dio buggy?

I solved a problem today. The navigation on the home page uses PageView and BottomNavigationBar. However, every time you switch the navigation, the page is redrawn, meaning that the current Widget state is not recorded.

Here we use AutomaticKeepAliveClientMixin to solve, literally can be seen that this class is used to maintain the state of the Widget. Specific implementation is: will need to store the state class inheritance in AutomaticKeepAliveClientMixin class

Then rewrite AutomaticKeepAliveClientMixin wantKeepAlive function in the current class, and make it returns true

This will store the state of the current page, as well as any other page.

Use image_Picker to open your phone’s photo album

So here we use the image_picker class ImagePicker which has three static methods, pickImage, PickVideo and retrieveLostData pickImage is the mobile phone photo albums And choose photos here are a few parameters are source cameraImageSource gallery and ImageSource. The former is to open the album directly, while the latter is to open the camera to take photos on site for saving.

MaxWidth maxHeight specifies the maximum width and height of the selected image.

The last parameter of imageQuality is the quality of the selected image, which is between 0 and 100

I haven’t moved the Flutter practice project for a long time.

It’s a crater. We’ll declare a String String listString = ‘a, B, C, D,e,f’. Dart’s split string is the same API as JS (split). OK take a look at my code!

Liststring.split (‘,’).map(item => {}) Yes this works fine on JS and on Flutter, but if we need toList() to render a list, we will get a syntax error. Let me rewrite it a little bit

List listTest = listString.split(‘,’)

listTest.split(‘,’).map(item => {})

This will export a wedgit list using toList() normally. The exact reason for this is unclear, but I suspect that when split(‘,’) does not have an explicit list variable to receive the array, so it cannot export directly to toList().

That’s it for today, another few weeks of slacking off!