lib_mvp 1.0.0 copy "lib_mvp: ^1.0.0" to clipboard
lib_mvp: ^1.0.0 copied to clipboard

outdated

An mvp pattern implementation of flutter

lib_mvp #

an achieve of mvp framework,

Thanks #

Thanks to the simplezhli -> flutter deer project, this library is an MVP implementation separated from this project.

This is a strongly coupled tool library with the following open source libraries built in:

  1. dio: ^2.1.13
  2. sprintf: ^4.0.0
  3. rxdart: ^0.21.0
  4. oktoast: ^2.1.8

Getting Started #

一、 init OKToast:

  @override
  Widget build(BuildContext context) {
    return OKToast(//init OKToast
      child: MaterialApp(
        title: 'MVP Framework Test',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: IndexPage(),
      ),
    );
  }

二、xxxPageState extends BasePageState ,Take IndexPage as an example

class IndexPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return IndexPageState();
  }
}

class IndexPageState extends BasePageState<IndexPage, IndexPagePresenter> {

  @override
  IndexPagePresenter createPresenter() {
    return IndexPagePresenter();
  }

}

三、Create xxxPagePresenter,Take IndexPagePresenter as an example

class IndexPagePresenter extends BasePagePresenter<IndexPageState>{

  void requestUserInfo(){
    requestNetwork(Method.get,
      url: Api.users,
      baseUrl: Api.baseUrl,
      onSuccess: (response){
        Map<String,dynamic> _map = json.decode(response?.data.toString());
        String result = json.encode(_map);
        ResponseUserInfoEntity entity = EntityFactory.generateOBJ(_map["data"]);
        view.updateResponseView(entity);
      },
    );
  }
}

Hope you enjoy it!!!!

Here is a sample demo show how to use this mvp framework,scan this qrcode to download android demo.

android demo apk

Or It is especially recommended that you check out this open source project =>simplezhli -> flutter deer

0
likes
10
pub points
0%
popularity

Publisher

unverified uploader

An mvp pattern implementation of flutter

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio, flutter, oktoast, rxdart, sprintf

More

Packages that depend on lib_mvp