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
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
628 additions
and
9 deletions
+628
-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
+307
-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
import
'dart:async'
;
import
'package:cached_network_image/cached_network_image.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:gmalpha_flutter/FindModel/page/FindModel.dart'
;
import
'package:gmalpha_flutter/FindModel/service/remote/entity/FindEntity.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BasePage.dart'
;
import
'package:gmalpha_flutter/res/value/ALColors.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
class
FindPage
extends
StatefulWidget
{
FindModel
_findModel
;
final
String
fromPage
;
FindPage
(
this
.
fromPage
)
{
_findModel
=
new
FindModel
(
1
,
8
);
}
@override
_FindPageState
createState
()
=>
_FindPageState
(
_findModel
);
}
class
_FindPageState
extends
BasePage
<
FindPage
>
{
FindModel
_findModel
;
static
int
count
=
8
;
static
int
page
=
1
;
RefreshController
_refreshController
=
RefreshController
(
initialRefresh:
false
);
_FindPageState
(
this
.
_findModel
);
@override
Widget
build
(
BuildContext
context
)
{
ScreenUtil
.
instance
=
ScreenUtil
(
width:
375.0
,
height:
667.0
)
..
init
(
context
);
return
Scaffold
(
appBar:
AppBar
(
leading:
GestureDetector
(
child:
Center
(
child:
Container
(
padding:
EdgeInsets
.
fromLTRB
(
12
,
0
,
0
,
0
),
child:
Text
(
"发现"
),
),
)),
centerTitle:
false
,
backgroundColor:
ALColors
.
ColorFFFFFF
,
actions:
<
Widget
>[
Container
(
padding:
EdgeInsets
.
only
(
right:
16
),
child:
new
Icon
(
Icons
.
search
,
size:
24.0
,),
),
],
),
body:
SmartRefresher
(
enablePullDown:
true
,
enablePullUp:
true
,
header:
WaterDropHeader
(),
footer:
CustomFooter
(
builder:
(
BuildContext
context
,
LoadStatus
mode
)
{
Widget
body
;
if
(
mode
==
LoadStatus
.
idle
)
{
body
=
Text
(
"上拉加载"
);
}
else
if
(
mode
==
LoadStatus
.
loading
)
{
body
=
CupertinoActivityIndicator
();
}
else
if
(
mode
==
LoadStatus
.
failed
)
{
body
=
Text
(
"加载失败!点击重试!"
);
}
else
if
(
mode
==
LoadStatus
.
canLoading
)
{
body
=
Text
(
"松手,加载更多!"
);
}
else
{
body
=
Text
(
"没有更多数据了!"
);
}
return
Container
(
height:
55.0
,
child:
Center
(
child:
body
),
);
},
),
controller:
_refreshController
,
onRefresh:
_onRefresh
,
onLoading:
_onLoading
,
child:
CustomScrollView
(
slivers:
<
Widget
>[
// SliverToBoxAdapter(
// child: Container(height: 1,
// color: Colors.amberAccent,),
// ),
getListView
(),
],
)));
}
void
_onRefresh
()
{
_findModel
.
init
(
context
,
(
value
)
{
Timer
(
Duration
(
seconds:
1
),
()
{
_refreshController
.
refreshToIdle
();
});
});
}
void
_onLoading
()
async
{
page
++;
await
_findModel
.
getFindPage
(
page
,
count
,
(
data
)
{
if
(
data
.
data
?.
cards
?.
length
==
0
)
{
_refreshController
.
loadNoData
();
}
else
{
_refreshController
.
loadComplete
();
}
});
}
Widget
_listViewUI2
(
BuildContext
context
,
Cards
item
)
{
return
Container
(
width:
ScreenUtil
.
instance
.
setWidth
(
375.0
),
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
.
instance
.
setHeight
(
3
)),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
right:
ScreenUtil
.
instance
.
setWidth
(
3.0
)),
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[0].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
123
),
height:
ScreenUtil
.
instance
.
setHeight
(
123
),
fit:
BoxFit
.
cover
,
)),
Container
(
margin:
EdgeInsets
.
only
(
right:
ScreenUtil
.
instance
.
setWidth
(
3.0
)),
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[1].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
123
),
height:
ScreenUtil
.
instance
.
setHeight
(
123
),
fit:
BoxFit
.
cover
,
)),
Container
(
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[2].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
123
),
height:
ScreenUtil
.
instance
.
setHeight
(
123
),
fit:
BoxFit
.
cover
,
)),
]));
}
Widget
_listViewUI1
(
BuildContext
context
,
Cards
item
)
{
return
Container
(
width:
ScreenUtil
.
instance
.
setWidth
(
375.0
),
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
.
instance
.
setHeight
(
3
)),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
right:
ScreenUtil
.
instance
.
setWidth
(
3.0
)),
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[0].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
249
),
height:
ScreenUtil
.
instance
.
setHeight
(
249
),
fit:
BoxFit
.
fitHeight
,
)),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
.
instance
.
setHeight
(
3.0
)),
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[1].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
123
),
height:
ScreenUtil
.
instance
.
setHeight
(
123
),
fit:
BoxFit
.
cover
,
)),
Container
(
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[2].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
123
),
height:
ScreenUtil
.
instance
.
setHeight
(
123
),
fit:
BoxFit
.
cover
,
)),
]),
]));
}
Widget
_listViewUI3
(
BuildContext
context
,
Cards
item
)
{
return
Container
(
width:
ScreenUtil
.
instance
.
setWidth
(
375.0
),
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
.
instance
.
setHeight
(
3
)),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
.
instance
.
setHeight
(
3
)),
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[0].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
123
),
height:
ScreenUtil
.
instance
.
setHeight
(
123
),
fit:
BoxFit
.
cover
,
)),
Container
(
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[1].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
123
),
height:
ScreenUtil
.
instance
.
setHeight
(
123
),
fit:
BoxFit
.
cover
,
)),
]),
Container
(
margin:
EdgeInsets
.
only
(
left:
ScreenUtil
.
instance
.
setWidth
(
3.0
)),
child:
CachedNetworkImage
(
imageUrl:
'
${item.topics[2].imageUrl}
'
,
width:
ScreenUtil
.
instance
.
setWidth
(
249
),
height:
ScreenUtil
.
instance
.
setHeight
(
249
),
fit:
BoxFit
.
cover
,
)),
]));
}
Widget
loadingItem
()
{
Widget
loadCircle
=
Column
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
<
Widget
>[
Container
(
padding:
EdgeInsets
.
only
(
top:
60.0
),
child:
CircularProgressIndicator
(),
),
Padding
(
padding:
EdgeInsets
.
only
(
left:
ScreenUtil
.
instance
.
setSp
(
10
),
right:
ScreenUtil
.
instance
.
setSp
(
10
),
top:
ScreenUtil
.
instance
.
setSp
(
10
),
bottom:
ScreenUtil
.
instance
.
setSp
(
10
)),
child:
Text
(
'加载中...'
),
)
],
);
return
SliverFillViewport
(
delegate:
SliverChildListDelegate
([
loadCircle
]));
}
Widget
getListView
()
{
return
StreamBuilder
<
FindEntity
>(
stream:
_findModel
.
findLive
.
stream
,
initialData:
_findModel
.
findLive
.
data
,
builder:
(
BuildContext
context
,
data
)
{
var
dataList
=
data
?.
data
?.
data
;
if
(
dataList
==
null
)
{
return
loadingItem
();
}
return
SliverList
(
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
var
item
=
dataList
.
cards
[
index
];
if
(
item
.
layout
==
1
)
{
return
_listViewUI1
(
context
,
item
);
}
else
if
(
item
.
layout
==
2
)
{
return
_listViewUI2
(
context
,
item
);
}
else
{
return
_listViewUI3
(
context
,
item
);
}
},
childCount:
dataList
.
cards
.
length
,
));
});
}
Widget
noData
()
{
return
Container
(
height:
double
.
maxFinite
,
width:
double
.
maxFinite
,
color:
Colors
.
amberAccent
,
);
}
@override
void
dispose
()
{
super
.
dispose
();
_refreshController
.
dispose
();
}
@override
String
pageName
()
{
return
'find_home'
;
}
@override
String
referrer
()
{
return
widget
.
fromPage
;
}
@override
void
initState
()
{
super
.
initState
();
_findModel
.
init
(
context
);
}
}
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