Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Androidproject | 5,116 | 7 months ago | 1 | apache-2.0 | Java | |||||
Android 技术中台,但愿人长久,搬砖不再有 | ||||||||||
Flutter Architecture Blueprints | 1,308 | a year ago | 30 | mit | Dart | |||||
Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to developing Flutter apps. | ||||||||||
Android Learning Resources | 1,289 | 3 years ago | 2 | |||||||
Android学习资源网站索引大全 | ||||||||||
Androidproject Kotlin | 677 | 5 months ago | 3 | apache-2.0 | Kotlin | |||||
Android 技术中台 Kotlin 版本,但愿人长久,搬砖不再有 | ||||||||||
Jetpack_github | 355 | a year ago | mit | Roff | ||||||
基于Kotlin + Jetpack全家桶 + Coroutines(协程) + Flutter等架构实现的一款精简版Github客户端项目,望与广大小伙伴一起成长,欢迎start or fork! | ||||||||||
Mvvm_flutter | 261 | 5 days ago | 1 | other | Dart | |||||
Build MVVM App for Android and IOS with Flutter | ||||||||||
Flawless Ios | 222 | 3 years ago | ||||||||
Awesome iOS guides from the community, shared on Flawless iOS Medium blog 👉 | ||||||||||
Mood Example | 176 | 12 days ago | bsd-3-clause | Dart | ||||||
🐦 Flutter 3 心情记录 样例工程 - 国际化 i18n、uni 小程序、深色模式、多主题、本地数据管理、路由管理、状态管理、无障碍(Semantics)、异步 FFI、集成测试、图表统计、Excel 导入导出、游戏…… | ||||||||||
Flutter Architecture | 112 | 3 years ago | 1 | Dart | ||||||
Clean Architecture with MVVM for Flutter using Get_It, State management, SQFlite, Dio, StorageHelper, ConnectionHelper, custom widgets and more | ||||||||||
Flutter Elementary | 107 | 5 days ago | 20 | August 14, 2022 | 2 | mit | Dart | |||
This is a home to a family of Elementary library packages. |
Build MVVM App for Android and IOS with Flutter。
The Structure seems like MVVM-Android。
PS:each layer connected by rx, use responsive thinking and rxdart operators for logical processing.Finally, update the view with provider.
//remote
class GithubService{
Observable<dynamic> login()=> get("user");
}
//repo
class GithubRepo {
final GithubService _remote;
GithubRepo(this._remote);
Observable login(String username, String password) {
token = "basic " + base64Encode(utf8.encode('$username:$password'));
return _remote.login();
}
}
//viewmodel
class HomeViewModel extends ChangeNotifier {
final GithubRepo _repo;
String username = "";
String password = "";
bool _loading = false;
String _response = "";
//...
HomeViewModel(this._repo);
/**
* call the model layer 's method to login
* doOnData : handle response when success
* doOnError : handle error when failure
* doOnListen : show loading when listen start
* doOnDone : hide loading when complete
*/
Observable login() => _repo
.login(username, password)
.doOnData((r) => response = r.toString())
.doOnError((e, stacktrace) {
if (e is DioError) {
response = e.response.data.toString();
}
})
.doOnListen(() => loading = true)
.doOnDone(() => loading = false);
}
/// View :HomePage
///
/// 获取其它页面传递来的参数
class HomePage extends PageProvideNode<HomeProvide> {
/// 提供
///
/// 获取参数 [title] 并生成一个[HomeProvide]对象
HomePage(String title) : super(params: [title]);
@override
Widget buildContent(BuildContext context) {
return _HomeContentPage(mProvider);
}
}
// ...
class _HomeContentPageState extends State<_HomeContentPage> implements Presenter{
//...
_HomeState(this._viewModel) {
providers.provideValue(_viewModel);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appbar://...,
body://...
CupertinoButton(
onPressed: ()=>onClick(ACTION_LOGIN),
//...
),
Container(
//...
child: Provide<HomeViewModel>(
builder: (BuildContext context, Widget child,
HomeViewModel value) =>
Text(value.response),
),
),
//...
);
}
/// 通过[action]进行事件处理
@override
void onClick(String action) {
print("onClick:" + action);
if (ACTION_LOGIN == action) {
_login();
}
}
_login()=>_viewModel.login().doOnListen(() {
_controller.forward();
}).doOnDone(() {
_controller.reverse();
}).listen((_) {
//success
Toast.show("login success",context,type: Toast.SUCCESS);
}, onError: (e) {
//error
dispatchFailure(context, e);
});
}
the Apache License