The project address
preface
I have been interested in Flutter for a long time. I started to pay attention to Flutter in the second half of 2018. At that time, there were very few people using Flutter. You can see that Flutter is really on fire.
The body of the
I have been paying attention to Flutter for a long time. I have also learned a lot of knowledge on Android. I have seen many people write different versions of Flutter, including Java, Kotlin, and Flutter. In fact, I had the idea of playing Android for practice long ago, but I didn’t put it into practice due to lack of time. I spent a few days this time, and basically completed the commonly used functions, such as article list, project list, public number list, favorites, points, article search, login and registration, etc.
Without further ado, let’s take a look at a partial screenshot of the project:
Dependent libraries
After looking at the renderings, here are the dependency libraries used:
- Flutter_screenutil Screen adaptation
- Fluttertoast toast
- Shard_preferences is similar to Sp for Android
- Event_bus is similar to Android eventbus
- Image_picker Image selection
- HTTP Network Request
- Flutter_swiper round figure
- Flutter_webview_plugin webview plug-in
- Pull_to_refresh Pulldown refresh and pullup loading
The above libraries can be searched and used at https://pub.dev/.
Problems encountered
Three days, in fact, did not meet many problems, let me say a few more disgusting problems:
- First, TabBar and TabView display public number page, I want to directly obtain the public number data at the same time refresh TabController and directly request the current public number article list, these operations are all put in a piece, then give me the whole confused, and then TabView slide monitor there are problems 🤨, All I need to do is create a new Widget and use it to create a list of public numbers. Everything is a Widget!
- Later, after finishing writing the interface that does not need cookie (interface that does not need login), I almost crashed when implementing the interface that needs cookie. Cookie is often used in the background, but I have never used cookie when writing Android. See The PostMan implementation written by Hong Yang Dagod can also be successful. Cookie is just a parameter of header. I wrote the key of user name and password PostMan as cookie, but the background cannot get it. After I change it, IT is ok.
- When I use that Scaffold WebViewScaffold, the bottom dialog does not pop up. When I change that Scaffold, the bottom dialog pops up. WebViewScaffold blocks our bottom dialog so it does not pop out; In the framework of webview, we add the bottomNavigationBar of the scaffold to the page that we want to pop up and control whether the page is displayed or not.
conclusion
The advantages of Flutter are that it is cheap to develop, fast and efficient. But the disadvantages of Flutter are also obvious: the interface is too nested and maintenance is difficult. I also tried to write the Android MVP into the Flutter, but it didn’t work very well, so I gave it up and had to smoke a few more widgets. You if have time can also according to try to carry forward the great spirit of play the android API to write (www.wanandroid.com/blog/show/2…
update
- WebView plugin changed from Flutter_webview_plugin to webview_flutter
- Add photo permission for IOS, and select profile picture for photo taking.
- 2020.4.13