Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gmalpha_flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile
gmalpha_flutter
Commits
fd5a2c37
Commit
fd5a2c37
authored
Sep 05, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add read me
parent
496de6de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
5 deletions
+76
-5
ReadMe
ReadMe
+70
-0
main.dart
lib/main.dart
+6
-5
No files found.
ReadMe
0 → 100644
View file @
fd5a2c37
JSON TO DART 网址 ===>https://javiercbk.github.io/json_to_dart/
本项目采用组件化 请在lib下面创建 XXXModel
在 XXXModel
下面需要创建
@Router(这里是模块名称,这里是模块的实现)
abstract class XXXRouter implements RouterBaser{
这里写这个模块对外提供的方法
}
写一个实现类 来实现这个接口
class XXXRouterImpl implements UserRouter {
实现他
}
注! 接口和实现类 一定要在同一个目录下 才能导对包
网络层
希望是和 userModel 是一样的结构
api目录下创建的 class 上面需要 @ServiceCenter() 注释 要不找不到
api 目录下主要放的是 接口
比如有这样的接口
https://www.wanandroid.com/user/register
方法:POST
参数
username,password,repassword
@Post("user/register")这里是拼接的url
TestUserEntity resign(@Query("username") String name,
@Query("password") String word, @Query("repassword") String repassword);、
@Query是定义的参数 key
api 目录下只需要写上面的方法就可以了
执行 ./build.sh 会在同级目录下自动生成代码
User方面的话
@UserCenter()
class UserEntity {
}
已经写好了 同样 ./build.sh 会在同级目录下生成代码
我们采用 bloc 模式
用观察者模式 实现 view层和 数据层 完全解耦
创建 XXXModel
class XXXModel extends BaseModel{
LiveData<类型> live = new LiveData();
void fun(){
//do something
live.notifyView(data);就可以刷新UI了
}
@override
//View层要掉这个方法!!
void dispose() {
dispose时候记得回收资源哦
}
}
lib/main.dart
View file @
fd5a2c37
...
...
@@ -61,11 +61,12 @@ class _MyAppState extends State<MyApp> {
// return null;
// }
// return findMessageRouter.getMessagePage({});
var
findUserRouter
=
RouterCenterImpl
().
findUserRouter
();
if
(
findUserRouter
==
null
){
return
null
;
}
return
findUserRouter
.
getUserPage
();
return
RouterCenterImpl
().
findUserRouter
()?.
getUserPage
();
// var findUserRouter = RouterCenterImpl().findUserRouter();
// if(findUserRouter==null){
// return null;
// }
// return findUserRouter.getUserPage();
},
},
//调试的时候可以打开
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment