lib_mvp 1.0.1
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:
Getting Started #
Use this package as a library #
- Depend on it Add this to your package's pubspec.yaml file:
dependencies:
lib_mvp: ^1.0.0
2.Install it You can install packages from the command line:
with Flutter:
$ flutter pub get
Now in your Dart code, you can use:
import 'package:lib_mvp/lib_mvp.dart';
一、 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.
Or It is especially recommended that you check out this open source project =>simplezhli -> flutter deer
[1.0.0] - 2019-8-23 17:50:09
- Mvp mode implementation, network request encapsulation
[1.0.01] - 2019-11-13 11:28:09
- Add network request progress
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies:
lib_mvp: ^1.0.1
2. Install it
You can install packages from the command line:
with Flutter:
$ flutter pub get
Alternatively, your editor might support flutter pub get
.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
import 'package:lib_mvp/lib_mvp.dart';
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
20
|
Health:
Code health derived from static analysis.
[more]
|
100
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
50
|
Overall:
Weighted score of the above.
[more]
|
50
|
We analyzed this package on Dec 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.0
- pana: 0.13.1+4
- Flutter: 1.12.13+hotfix.4
Health suggestions
Fix lib/network/intercept.dart
. (-0.50 points)
Analysis of lib/network/intercept.dart
reported 1 hint:
line 10 col 8: Unused import: 'dio_utils.dart'.
Format lib/mvp/base_page_state.dart
.
Run flutter format
to format lib/mvp/base_page_state.dart
.
Format lib/mvp/contract.dart
.
Run flutter format
to format lib/mvp/contract.dart
.
Fix additional 7 files with analysis or formatting issues.
Additional issues in the following files:
lib/mvp/ilife_cycle.dart
(Runflutter format
to formatlib/mvp/ilife_cycle.dart
.)lib/network/base_entity.dart
(Runflutter format
to formatlib/network/base_entity.dart
.)lib/network/error_handler.dart
(Runflutter format
to formatlib/network/error_handler.dart
.)lib/router/app_navigator.dart
(Runflutter format
to formatlib/router/app_navigator.dart
.)lib/utils/toast_utils.dart
(Runflutter format
to formatlib/utils/toast_utils.dart
.)lib/utils/utils.dart
(Runflutter format
to formatlib/utils/utils.dart
.)lib/widget/loading_dialog.dart
(Runflutter format
to formatlib/widget/loading_dialog.dart
.)
Maintenance issues and suggestions
Support latest dependencies. (-20 points)
The version constraint in pubspec.yaml
does not support the latest published versions for 2 dependencies (dio
, rxdart
).
The package description is too short. (-20 points)
Add more detail to the description
field of pubspec.yaml
. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Maintain an example. (-10 points)
Create a short demo in the example/
directory to show how to use this package.
Common filename patterns include main.dart
, example.dart
, and lib_mvp.dart
. Packages with multiple examples should provide example/README.md
.
For more information see the pub package layout conventions.
Dependencies
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=2.1.0 <3.0.0 | ||
dio | ^2.1.13 | 2.2.2 | 3.0.7 |
flutter | 0.0.0 | ||
oktoast | ^2.1.8 | 2.2.1 | |
rxdart | ^0.21.0 | 0.21.0 | 0.23.1 |
sprintf | ^4.0.0 | 4.0.2 | |
Transitive dependencies | |||
collection | 1.14.11 | 1.14.12 | |
cookie_jar | 1.0.1 | ||
meta | 1.1.8 | ||
sky_engine | 0.0.99 | ||
typed_data | 1.1.6 | ||
vector_math | 2.0.8 | ||
Dev dependencies | |||
flutter_test |