Fun Android is a product-level open source App based on Google’s Flutter, the official recommendation status management Provider and the open apis of Playing Android.

The F in the Logo stands for both Fun and Flutter.

Let’s start with some samples

The project address

Github.com/phoenixsky/…

Download address

Dandelion download page

The code to compile

  • Flutter SDK (Channel dev, v1.10.4)

  • If you want to see what’s going on, you have to use Release mode, there’s a big difference in smoothness

    The Debug and Release compilation modes of Flutter are different. The JIT and AOt. Debug modes support hot Reload respectively.

  • IOS is stuck on the Splash page. You need to check the current scheme. If it is release, run flutter build iOS on the command line

  • The internationalization part of the project relies on AndroidStudio’s plugin Flutter_i18n to search for Flutter I18n in the Plugin repository. After the plug-in is successfully installed and the AndroidStudio is restarted, the lib/generated/i18n.dart file is generated

    For details and usage refer to nuggets – Rhyme _ LPHLV’s blog post

introduce

Borrow two lines of dialogue from water friends in the group, when the preview version comes out

  • 1A: There are tons of open source projects out there to play with Android.

  • 3C: I want to see the most beautiful one.

Thank you for your recognition of Fun Android.

As for the theme Style of App, it’s not all Material Design advocated by Google, nor all Cupertino Style advocated by Apple. Since I’m an Android developer and a long-time iPhone user, the App style is a mix of the two and a little bootstrapper. Personally, I think the iOS version is actually better.

If there are problems in the code, please actively raise the Issue.

update

V0.1.12 2019-10-21(Unreleased)

  • When loading fails, if no data is displayed on the current page, a toast message will pop up if there is data

V0.1.11 2019-10-17

  • Added a message indicating network loading failure

V0.1.10 2019-10-16

  • Fix the bug where the ‘shareUser’ field is empty on the favorites page

V0.1.9 2019-10-14

  • Extreme Black (Native splash screen page with darkMode)
  • Home banner height ADAPTS to screen width and height
  • Signature file Adjustment

V0.1.8 2019-10-13

  • Join the list of articles to share
  • Add a logical judgment that data is empty on the home page
  • ViewStateModel logic optimization,bug fix
  • Status bar font color optimization
  • Fixed TextField hint being out of center when it was Chinese

V0.1.7 2019-09-23

  • DarkMode automatically follows system Settings
  • App update component adjustment
  • For Version 3.0
  • Pull_to_refresh update: Added internationalization

V0.1.6 2019-09-20

  • Fix the bug of page error when the list of favorites enter details

V0.1.5 2019-09-19

  • The Flutter SDK is updated toThe Channel dev, v1.10.3, repair,myPage inexplicable stuck problem
  • Change the name of the Android App to Fun Android

V0.1.4 2019-09-18

  • Adaptive Flutter 1.9 x
  • Android added a version update
  • Join the LeanCloud API cloud service
  • Removed code to fix a black screen on the home pageIt was officially fixed in version 1.10.1
  • Removing the previous screen adaptation scheme has too much impact on the NativeView
  • Fixed bug where progress bar color and background color are not obvious in AppBar due to version update
  • Refactoring the Http usage for better decoupling
  • Home banner height adjustment
  • Android status bar transparent

2019-09-10

  • Flutter version Update
  • The theme of adaptation update AppBar area CupertinoActivityIndicator color conflict
  • Remove OffState and Indicator combinations to optimize performance
  • Adjust the clear implementation of textField to prevent errors

2019-09-09

  • Repair each page in the articlecollectionThe status is not synchronized
    • After the collection on the home page, the collection status of items corresponding to other TAB pages will be synchronized
    • Remove favorites from my favorites page. The status of other pages is synchronized
    • Refresh the favorite status of each page after login and logout
    • If the same account has changed the favorite status on other platforms, you only need to refresh the list to synchronize the favorite status (there is a problem with WanAndroid interface at present).
  • Optimized Dropdown pop-up animation
  • The first loading of data on the home page disables the pull-up recording function
  • You can switch the input box of the login page by pressing enter

2019-08-30

  • Fixed a bug where integral values were not refreshed after login
  • Fixed a bug that caused the Splash page to go blank for a short time
  • Fixed bug where clicking on favorites can play animation when not logged in
  • The default theme color is set to light

2019-08-29

  • Add score record and leaderboard function

2019-08-28

  • Add the WebViewPlugin switch to the Settings
  • After removing favorites in details, the page of favorites list will refresh automatically

2019-08-26

  • Updated the implementation of favorite animations, the previous implementation was too intrusive, each page had to hide a small ❤❤. Now the idea of routing ➕Hero has changed and the Flare has been readjusted. A line of code is ok to display the animation. If you run the code and find that the animation is slightly inconsistent with the image, the bottom right corner of the list item will be carefully flashed. Don’t worry about the bug with Flutter, it has been fixed in the Master branch. See the pr – 37341)

The project structure

Provider Provides a simple way to use the MVVM

  • Quickly add a page with a pull-down refresh that loads more pages. Like developing aPlay the AndroidHome list page
    1. Model
    2. ViewModel
    3. View

The above is the basic use mode of Provider combined with ViewModel, considering the more comprehensive situation that will appear in App, we hope to discuss the use mode together

ViewState == viewState. Busy = model.viewState == viewState. Busy For writing convenience, a corresponding method is added

What can we find here?

  1. Best practices for Provider state management, although Google has long since abandoned Provide and declared Provider a recommended state management tool, we have encountered many problems in development.

    1. For example, how should a Provider’s derived classes be used in a specific business?

    2. When and where the data required for the page is initially initialized.

    3. How to combine loading, Error, Empty, Idle, and unAuthorized page states

    4. Commonly used pull-down refresh, pull-up loading should be more how to take to be more effective.

    5. After dispose of Widget, model no longer notify().

  2. Clear code structure.

    1. Page to page, business to business, all business logic is thereview_modelIn, widgets focus only on the page itself.
  3. Do not fill the screen with setState().

    1. Local refreshes can be performed within the same page using the various XXXBuilders provided by the Flutter framework.

    2. Multi-layer nesting can use the Provider mentioned earlier.

    3. Of course, use setState() for sufficiently fine-grained widgets. Eg: ChangeLogView in ChangeLogPage has only one function, and the refresh does not affect other widgets.

  4. Realized the basic functions of App, copy as a template code for rapid development

    1. Subject switch

    2. Night mode switch

    3. Font switch

    4. Nice skeleton screen

    5. Use IDE plug-in I18n for internationalization

    6. Dio with Cookjar to play Android login features

    7. AnimationList is combined with the normal data loading of SmartRefresh

  5. Of course, WanAndroid also has good content to read in your spare time every day.

Unfinished functionality

  1. The second floor of the home page is my personal blog, and I can’t move forward or backward. There will be a flutter feature later.

  2. Hero animation, in the non-last TAB login, logo animation will drift to the last one, need to add state judgment.

  3. Log out and join dynamic effects.

Current known problems

  1. There are many problems with webview_flutter. Some links do not respond to a flutter when clicked. So there are two WebView solutions

  2. Webview_flutter cannot slide with CustomScrollView. See the issue.

  3. Two widgets of the same color have a background color line in the middle for no apparent reason. See the issue.

Future

  • In the later stage, a large number of blogs will be posted to describe the problems encountered in this project and the ideas to solve them.

Looking for group

  • Fun Flutter wechat communication group


The author’s words

  • Coordinate Shanghai, plan to find a job in the direction of Flutter.4 years Android development experience.

Thank you

  1. Thanks to V2Lf, the App was downloaded early in TestFlight before it was released. I wanted to make an open source App.

  2. Drawing on the UI of goweiiWanAndroid project, the most beautiful native version of WanAndroid, thank you.

  3. While practicing the Provider, Tutorials were discovered, and the author’s Youtube Tutorials were great.

  4. Thanks to the excellent pull_to_refresh refresh library.

  5. Thanks to cool station to provide open source font.

  6. Thanks to WanAndroid for the API.

About the author

License

Copyright 2019 phoenixsky

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

www.apache.org/licenses/LI…

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.