Introduction to the

Increase project extensibility, reduce coupling, improve development speed. Make data two-way flow, more flexible state control, more standardized development, more clear project structure.

Based on some development experience (in fact, borrowed from various native /Flutter big na), we have compiled this MVVM+Provider rapid development framework, and collected common and useful plug-ins in Pub, which can completely meet the daily development (non-fundamental temporary comments removed). I in pub and demo as far as possible to add detailed notes and according to their own development experience to add some ideas, convenient for everyone to quickly access and use.

The main features

1, MVVM+Provider, low coupling, logical, clear page code. Provider provides the status of the management control and display the page, and 2 more flexible and convenient exception capture of interface YeWuXing and grammatical YeWuXing can according to the need for processing (such as not login, unauthorized, timeout, no network, etc.) and implement page automatically switches, grammatical can jump to a specified page to avoid red screen (also available on this page do upload log). Basestate-state, BasestatelessWidget-StatelessWidget, and BaseSkeletonWidget encapsulate common functions. 4. The base classes ProviderWidget-Provider and ViewStatemodel-Changenotifier encapsulate the Provider and encapsulate some common status and exception handling functions Global cookie default SharedPreferences, basic interceptor automatically upload APP version, etc. (can be customized according to needs) 7. Global toast, skeleton screen, cache, formatting text, image selection clipping and uploading, waterfall stream and Util are all excellent functions provided by plug-ins (thanks again to all open source authors) 8. Intl based internationalization, APP theme switch. 9, your viewmodel as long as it is inheritance ViewStateModel, and register CacheDataFactory, load for the first time can be achieved automatically cache, no network automatic display last cache using MMKV cache (cache)Copy the code

Method of use

Wall crack recommends running DEMO and viewing source code and annotations, as well as annotations in pub (there are many frequently used plug-ins, you can view their documentation, skilled use can improve development efficiency).

Is very simple, the following: 1, page/wiget, inherit to the skeleton Basestate/BaseStatelessWidget 2, screen BaseSkeletonWidget 3, ViewModel (VM) inherited ViewStateModel subclasses, such as: SingleViewStateModel, RefreshListViewStateModel (also can according to demand their encapsulation) page code is as follows (please use Basestate page) :  class APageState extends BaseState<APage>{ @override Widget build(BuildContext context) { return switchStatusBar2Dark( /// Global VMS, such as user VMS, can refresh and manage the status of the entire project when logging in and out. /// The framework also defines some common global VM visible DEMO child: Consumer< global VM>(Builder :(CTX, global VM,child){return ProviderWidget< current page VM>(model: initialize your VM onModelReady: model){ Start your model, /// Optional} Builder (CTX, your VM, child){reutrn Your page; }); })); Class YourPageViewModel extends SingleViewStateModel{}Copy the code

See DEMO for specific usage methods

Making integration

When you clone the project, you can see several files: I10n // I10n plugin created, or you may have to create it yourself. Generated ///I10n automatically generated after you edit the language file Please do not edit the contents in this folder page /// your project page /// service_API /// project interface corresponding to the native repository. The PUB integration is not easy to modify to suit your needs. In addition, direct Clone integration is very easy, just after the Clone project, delete all folders except base_framework.Copy the code

DEMO

It is mainly divided into two parts: functional demonstration and comprehensive demonstration. Clone project directly to run browse, I add detailed comments in the DEMO, strongly recommend running and reading the DEMO code.Copy the code

Link: Bedrock

Github.com/bladeofgod/…

Thank you

Thanks again for the dedication and sharing of the open source, the growth of the novice is inseparable from your help. This frame belongs to the first taste of vegetable chicken, please forgive the immature, welcome to correct the deficiencies, we are very grateful.Copy the code