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
083d23b8
Commit
083d23b8
authored
Nov 04, 2019
by
何碧荣
Browse files
Options
Browse Files
Download
Plain Diff
发现页提交
parents
64de7666
71a0364e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
321 additions
and
9 deletions
+321
-9
RouterCenterRestore.mark.dart
lib/Annotations/RouterCenterRestore.mark.dart
+6
-3
FindRouter.dart
lib/FindModel/FindRouter.dart
+10
-0
FindRouterImpl.dart
lib/FindModel/FindRouterImpl.dart
+12
-0
FindListItem.dart
lib/FindModel/page/FindListItem.dart
+0
-0
FindModel.dart
lib/FindModel/page/FindModel.dart
+44
-0
FindPage.dart
lib/FindModel/page/FindPage.dart
+0
-0
FindRepository.dart
lib/FindModel/service/FindRepository.dart
+32
-0
FindLocal.dart
lib/FindModel/service/local/FindLocal.dart
+12
-0
FindRemote.dart
lib/FindModel/service/remote/FindRemote.dart
+21
-0
FindApi.dart
lib/FindModel/service/remote/api/FindApi.dart
+11
-0
FindApi.serv.dart
lib/FindModel/service/remote/api/FindApi.serv.dart
+49
-0
FindEntity.dart
lib/FindModel/service/remote/entity/FindEntity.dart
+98
-0
TestPage.dart
lib/TestPage.dart
+11
-0
main.dart
lib/main.dart
+15
-6
No files found.
lib/Annotations/RouterCenterRestore.mark.dart
View file @
083d23b8
...
...
@@ -11,6 +11,7 @@
//UserRouterImpl is resign : true
//WebRouterImpl is resign : true
import
'package:gmalpha_flutter/FindModel/FindRouter.dart'
;
import
"package:gmalpha_flutter/MainModel/MainRouterImpl.dart"
;
import
"package:gmalpha_flutter/MainModel/MainRouter.dart"
;
import
"package:gmalpha_flutter/BuriedLib/BuriedImpl.dart"
;
...
...
@@ -27,6 +28,8 @@ import "package:gmalpha_flutter/WebModel/WebRouter.dart";
import
"package:gmalpha_flutter/Annotations/RouterCenterRestore.dart"
;
import
"package:gmalpha_flutter/Annotations/RouterBaser.dart"
;
class
RouterCenterImpl
{
Map
<
String
,
RouterBaser
>
map
;
...
...
@@ -77,11 +80,11 @@ class RouterCenterImpl {
return
map
[
"buried_router"
]
as
BuriedRouter
;
}
AlbumRouter
findAlbum
Router
()
{
if
(
map
[
"
album
Model"
]
==
null
)
{
FindRouter
findFind
Router
()
{
if
(
map
[
"
Find
Model"
]
==
null
)
{
return
null
;
}
return
map
[
"
albumModel"
]
as
Album
Router
;
return
map
[
"
FindModel"
]
as
Find
Router
;
}
NewMessageRouter
findNewMessageRouter
()
{
...
...
lib/FindModel/FindRouter.dart
0 → 100644
View file @
083d23b8
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/Annotations/RouterBaser.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/Router.dart'
;
import
'package:gmalpha_flutter/FindModel/FindRouterImpl.dart'
;
@Router
(
"FindModel"
,
FindRouterImpl
,
true
)
abstract
class
FindRouter
implements
RouterBaser
{
Widget
getFindPage
(
String
fromPage
);
}
\ No newline at end of file
lib/FindModel/FindRouterImpl.dart
0 → 100644
View file @
083d23b8
import
'package:flutter/widgets.dart'
;
import
'package:gmalpha_flutter/FindModel/FindRouter.dart'
;
import
'package:gmalpha_flutter/FindModel/page/FindPage.dart'
;
class
FindRouterImpl
implements
FindRouter
{
@override
Widget
getFindPage
(
String
fromPage
)
{
return
FindPage
(
fromPage
);
}
}
\ No newline at end of file
lib/FindModel/page/FindListItem.dart
0 → 100644
View file @
083d23b8
lib/FindModel/page/FindModel.dart
0 → 100644
View file @
083d23b8
import
'package:flutter/cupertino.dart'
;
import
'package:gmalpha_flutter/FindModel/service/FindRepository.dart'
;
import
'package:gmalpha_flutter/FindModel/service/remote/entity/FindEntity.dart'
;
import
'package:gmalpha_flutter/commonModel/live/BaseModel.dart'
;
import
'package:gmalpha_flutter/commonModel/live/LiveData.dart'
;
import
'package:gmalpha_flutter/commonModel/toast/toast.dart'
;
class
FindModel
extends
BaseModel
{
final
int
page
;
final
int
count
;
LiveData
<
FindEntity
>
findLive
=
new
LiveData
();
FindEntity
findList
;
FindModel
(
this
.
page
,
this
.
count
);
init
(
BuildContext
context
,[
callback
=
null
]){
getFindPage
(
page
,
count
,
callback
);
}
getFindPage
(
page
,
count
,[
callback
]){
FindRepository
.
getInstance
()
.
getFindPage
(
page
,
count
)
.
listen
((
value
){
if
(
value
!=
null
)
{
if
(
page
>
1
)
{
findList
.
data
?.
cards
?.
addAll
(
value
.
data
.
cards
);
}
else
{
findList
=
value
;
}
if
(
callback
!=
null
)
callback
(
value
);
findLive
.
notifyView
(
findList
);
}
}).
onError
((
error
)
{
Toast
.
show
(
error
,
"
${error.toString()}
"
);
print
(
error
);
});
}
@override
void
dispose
()
{
findLive
.
dispost
();
}
}
\ No newline at end of file
lib/FindModel/page/FindPage.dart
0 → 100644
View file @
083d23b8
This diff is collapsed.
Click to expand it.
lib/FindModel/service/FindRepository.dart
0 → 100644
View file @
083d23b8
import
'package:gmalpha_flutter/FindModel/service/local/FindLocal.dart'
;
import
'package:gmalpha_flutter/FindModel/service/remote/FindRemote.dart'
;
import
'package:gmalpha_flutter/FindModel/service/remote/entity/FindEntity.dart'
;
import
'package:rxdart/rxdart.dart'
;
class
FindRepository
{
FindRemote
_remote
;
FindLocal
_local
;
static
FindRepository
_findRepository
;
FindRepository
.
_
(){
_remote
=
FindRemote
.
getInstance
();
_local
=
FindLocal
.
getInstance
();
}
static
FindRepository
getInstance
(){
if
(
_findRepository
==
null
){
_findRepository
=
FindRepository
.
_
();
}
return
_findRepository
;
}
Observable
<
FindEntity
>
getFindPage
(
int
page
,
int
count
){
return
_remote
.
getFindPage
(
page
,
count
).
map
((
value
){
if
(
value
!=
null
){
}
return
value
;
});
}
}
\ No newline at end of file
lib/FindModel/service/local/FindLocal.dart
0 → 100644
View file @
083d23b8
class
FindLocal
{
static
FindLocal
_findRemote
;
FindLocal
.
_
(){}
static
FindLocal
getInstance
(){
if
(
_findRemote
==
null
){
_findRemote
=
new
FindLocal
.
_
();
}
return
_findRemote
;
}
}
\ No newline at end of file
lib/FindModel/service/remote/FindRemote.dart
0 → 100644
View file @
083d23b8
import
'package:gmalpha_flutter/FindModel/service/remote/api/FindApi.serv.dart'
;
import
'package:gmalpha_flutter/FindModel/service/remote/entity/FindEntity.dart'
;
import
'package:rxdart/rxdart.dart'
;
class
FindRemote
{
static
FindRemote
_findRemote
;
FindRemote
.
_
(){}
static
FindRemote
getInstance
(){
if
(
_findRemote
==
null
){
_findRemote
=
new
FindRemote
.
_
();
}
return
_findRemote
;
}
Observable
<
FindEntity
>
getFindPage
(
int
page
,
int
count
){
return
FindApiImpl
().
getFindPage
(
page
,
count
);
}
}
\ No newline at end of file
lib/FindModel/service/remote/api/FindApi.dart
0 → 100644
View file @
083d23b8
import
'package:gmalpha_flutter/Annotations/anno/Get.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/Query.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/ServiceCenter.dart'
;
import
'package:gmalpha_flutter/FindModel/service/remote/entity/FindEntity.dart'
;
@ServiceCenter
()
abstract
class
FindApi
{
@Get
(
"api/v1/discover"
)
FindEntity
getFindPage
(
@Query
(
'page'
)
int
page
,
@Query
(
'count'
)
int
count
);
}
\ No newline at end of file
lib/FindModel/service/remote/api/FindApi.serv.dart
0 → 100644
View file @
083d23b8
// GENERATED CODE - DO NOT MODIFY BY HAND
// **************************************************************************
// ServiceGenerator
// **************************************************************************
import
'dart:convert'
;
import
'dart:io'
;
import
'package:rxdart/rxdart.dart'
;
import
'package:dio/dio.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:gmalpha_flutter/FindModel/service/remote/entity/FindEntity.dart'
;
import
'package:gmalpha_flutter/commonModel/net/DioUtil.dart'
;
class
FindApiImpl
{
factory
FindApiImpl
()
=>
_sharedInstance
();
static
FindApiImpl
_instance
;
FindApiImpl
.
_
()
{}
static
FindApiImpl
_sharedInstance
()
{
if
(
_instance
==
null
)
{
_instance
=
FindApiImpl
.
_
();
}
return
_instance
;
}
Observable
<
FindEntity
>
getFindPage
(
int
page
,
int
count
)
{
return
Observable
.
fromFuture
(
DioUtil
().
get
(
'api/v1/discover'
,
data:
{
'page'
:
page
,
'count'
:
count
})).
flatMap
((
value
)
{
if
(
value
!=
null
&&
value
.
statusCode
==
200
)
{
return
Observable
.
fromFuture
(
compute
(
paseFindEntity
,
value
.
toString
()));
}
else
{
return
Observable
.
fromFuture
(
null
);
}
});
}
}
FindEntity
paseFindEntity
(
String
value
)
{
return
FindEntity
.
fromJson
(
json
.
decode
(
value
));
}
lib/FindModel/service/remote/entity/FindEntity.dart
0 → 100644
View file @
083d23b8
class
FindEntity
{
int
error
;
String
message
;
Null
extra
;
Data
data
;
FindEntity
({
this
.
error
,
this
.
message
,
this
.
extra
,
this
.
data
});
FindEntity
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
error
=
json
[
'error'
];
message
=
json
[
'message'
];
extra
=
json
[
'extra'
];
data
=
json
[
'data'
]
!=
null
?
new
Data
.
fromJson
(
json
[
'data'
])
:
null
;
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'extra'
]
=
this
.
extra
;
if
(
this
.
data
!=
null
)
{
data
[
'data'
]
=
this
.
data
.
toJson
();
}
return
data
;
}
}
class
Data
{
List
<
Cards
>
cards
;
Data
({
this
.
cards
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'cards'
]
!=
null
)
{
cards
=
new
List
<
Cards
>();
json
[
'cards'
].
forEach
((
v
)
{
cards
.
add
(
new
Cards
.
fromJson
(
v
));
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
cards
!=
null
)
{
data
[
'cards'
]
=
this
.
cards
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
class
Cards
{
List
<
Topics
>
topics
;
int
layout
;
Cards
({
this
.
topics
,
this
.
layout
});
Cards
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'topics'
]
!=
null
)
{
topics
=
new
List
<
Topics
>();
json
[
'topics'
].
forEach
((
v
)
{
topics
.
add
(
new
Topics
.
fromJson
(
v
));
});
}
layout
=
json
[
'layout'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
topics
!=
null
)
{
data
[
'topics'
]
=
this
.
topics
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'layout'
]
=
this
.
layout
;
return
data
;
}
}
class
Topics
{
int
topicId
;
String
imageUrl
;
int
imageId
;
Topics
({
this
.
topicId
,
this
.
imageUrl
,
this
.
imageId
});
Topics
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
topicId
=
json
[
'topic_id'
];
imageUrl
=
json
[
'image_url'
];
imageId
=
json
[
'image_id'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'topic_id'
]
=
this
.
topicId
;
data
[
'image_url'
]
=
this
.
imageUrl
;
data
[
'image_id'
]
=
this
.
imageId
;
return
data
;
}
}
\ No newline at end of file
lib/TestPage.dart
View file @
083d23b8
...
...
@@ -32,6 +32,7 @@ class TestPage extends StatelessWidget {
testMessagePage
(
context
),
likePage
(
context
),
focusPage
(
context
),
findPage
(
context
),
],
),
));
...
...
@@ -125,4 +126,14 @@ class TestPage extends StatelessWidget {
?.
getFocusPage
(
'message_home'
)));
},
"关注页面"
);
}
findPage
(
BuildContext
context
)
{
return
base
(
context
,
()
{
Navigator
.
push
(
context
,
new
CustomRoute
(
RouterCenterImpl
()
.
findFindRouter
()?.
getFindPage
(
'find_home'
))
);
},
"发现页面"
);
}
}
lib/main.dart
View file @
083d23b8
...
...
@@ -115,7 +115,16 @@ class _MyAppState extends State<MyApp> {
return
RouterCenterImpl
()
.
findNewMessageRouter
()
?.
getLikePage
(
params
[
"fromPage"
]);
}
},
'find_home'
:
(
pageName
,
params
,
_
)
{
if
(!
Api
.
getInstance
().
setDioCookie
(
params
)
||
params
[
"fromPage"
]
==
null
)
{
return
ErrorPage
(
"出错:需要传递的参数为空"
);
}
return
RouterCenterImpl
()
.
findFindRouter
()
?.
getFindPage
(
params
[
"fromPage"
]);
},
});
FlutterBoost
.
handleOnStartPage
();
}
...
...
@@ -125,11 +134,11 @@ class _MyAppState extends State<MyApp> {
return
MaterialApp
(
title:
'Flutter Boost example'
,
debugShowCheckedModeBanner:
false
,
//
routes: {
//
'/': (context) {
//
return TestPage();
//
},
//
},
routes:
{
'/'
:
(
context
)
{
return
TestPage
();
},
},
builder:
buildOnce
,
theme:
new
ThemeData
(
primaryColor:
Colors
.
white
,
...
...
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