Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_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
林生雨
gm_flutter
Commits
4e01db3a
Commit
4e01db3a
authored
Jun 30, 2020
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
d94ecc47
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
417 additions
and
38 deletions
+417
-38
left_arrow.png
assets/left_arrow.png
+0
-0
vs_black.png
assets/vs_black.png
+0
-0
LevelOneBar.dart
lib/ClueModel/page/levelOne/LevelOneBar.dart
+100
-0
LevelOneItem.dart
lib/ClueModel/page/levelOne/LevelOneItem.dart
+8
-2
LevelOneModel.dart
lib/ClueModel/page/levelOne/LevelOneModel.dart
+62
-0
LevelOnePage.dart
lib/ClueModel/page/levelOne/LevelOnePage.dart
+0
-0
ClueApi.dart
lib/ClueModel/server/api/ClueApi.dart
+7
-5
ClueApi.serv.dart
lib/ClueModel/server/api/ClueApi.serv.dart
+23
-0
LevelOneFeedList.dart
lib/ClueModel/server/entity/LevelOneFeedList.dart
+114
-23
PosUtil.dart
lib/ClueModel/util/PosUtil.dart
+16
-0
GMBase.dart
lib/commonModel/GMBase.dart
+0
-1
BaseComponent.dart
lib/commonModel/base/BaseComponent.dart
+85
-5
main.dart
lib/main.dart
+1
-1
pubspec.yaml
pubspec.yaml
+1
-1
No files found.
assets/left_arrow.png
0 → 100644
View file @
4e01db3a
776 Bytes
assets/vs_black.png
0 → 100644
View file @
4e01db3a
4.22 KB
lib/ClueModel/page/levelOne/LevelOneBar.dart
0 → 100644
View file @
4e01db3a
/*
* @author lsy
* @date 2020-01-02
**/
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/flutter_svg.dart'
;
import
'package:flutter_common/flutter_common.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
class
MessageBarView
extends
StatelessWidget
{
final
LiveData
<
int
>
topIndexLive
;
final
LiveData
<
double
>
topScrollLive
;
final
PageController
pageController
;
bool
leftShow
=
false
;
bool
rightShow
=
false
;
MessageBarView
({
this
.
topIndexLive
,
this
.
topScrollLive
,
this
.
pageController
,
})
{}
@override
Widget
build
(
BuildContext
context
)
{
return
topView
(
context
);
}
Widget
topViewItem
(
String
text
,
int
index
)
{
return
StreamBuilder
(
stream:
topIndexLive
.
stream
,
initialData:
topIndexLive
.
data
??
0.0
,
builder:
(
con
,
data
)
{
return
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
{
// pageController.jumpToPage(index);
pageController
.
animateToPage
(
index
,
duration:
Duration
(
milliseconds:
200
),
curve:
Curves
.
ease
);
},
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
width:
double
.
maxFinite
,
height:
double
.
maxFinite
,
child:
baseText
(
text
,
16
,
data
.
data
==
index
?
Color
(
0xff282828
)
:
Color
(
0xffB5B5B5
)),
),
);
},
);
}
Widget
topView
(
BuildContext
context
)
{
return
Container
(
height:
49
,
width:
double
.
maxFinite
,
child:
Column
(
children:
<
Widget
>[
Expanded
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Expanded
(
child:
topViewItem
(
"价格"
,
0
)),
Expanded
(
child:
topViewItem
(
"医院"
,
1
)),
Expanded
(
child:
topViewItem
(
"医生"
,
2
)),
Expanded
(
child:
topViewItem
(
"评价"
,
3
)),
],
),
),
Container
(
alignment:
Alignment
.
topLeft
,
height:
8
,
margin:
EdgeInsets
.
only
(
top:
4
,
bottom:
5
),
width:
double
.
maxFinite
,
child:
StreamBuilder
(
stream:
topScrollLive
.
stream
,
initialData:
topScrollLive
.
data
??
0.0
,
builder:
(
con
,
data
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
left:
MediaQuery
.
of
(
context
).
size
.
width
/
12
+
4.5
+
data
.
data
),
width:
22
,
height:
3
,
decoration:
BoxDecoration
(
borderRadius:
new
BorderRadius
.
circular
((
1.5
)),
color:
Color
(
0xff3FB5AF
),
),
);
},
),
)
],
),
);
}
}
lib/ClueModel/page/levelOne/LevelOneItem.dart
View file @
4e01db3a
...
@@ -6,6 +6,7 @@ import 'package:cached_network_image/cached_network_image.dart';
...
@@ -6,6 +6,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseUtil.dart'
;
import
'package:gm_flutter/commonModel/base/BaseUtil.dart'
;
...
@@ -161,7 +162,12 @@ class LevelOneItem extends StatelessWidget {
...
@@ -161,7 +162,12 @@ class LevelOneItem extends StatelessWidget {
Positioned
(
Positioned
(
bottom:
67
,
bottom:
67
,
left:
57
,
left:
57
,
child:
baseText
(
cards
.
hospital
.
name
,
12
,
Color
(
0xff666666
)),
child:
baseText
(
cards
.
hospital
.
address
,
12
,
Color
(
0xff666666
)),
),
Positioned
(
left:
57
,
top:
43.5
,
child:
FiveStarView
(
cards
.
hospital
.
star
,
5
),
)
)
],
],
),
),
...
@@ -191,7 +197,7 @@ class LevelOneItem extends StatelessWidget {
...
@@ -191,7 +197,7 @@ class LevelOneItem extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment
.
end
,
crossAxisAlignment:
CrossAxisAlignment
.
end
,
children:
<
Widget
>[
children:
<
Widget
>[
baseText
(
"¥"
,
12
,
Color
(
0xffFF5963
)),
baseText
(
"¥"
,
12
,
Color
(
0xffFF5963
)),
baseText
(
cards
.
plan
,
15
,
Color
(
0xffFF5963
))
baseText
(
cards
.
plan
.
maxPrice
,
15
,
Color
(
0xffFF5963
))
],
],
),
),
),
),
...
...
lib/ClueModel/page/levelOne/LevelOneModel.dart
0 → 100644
View file @
4e01db3a
/*
* @author lsy
* @date 2020/6/29
**/
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/rx/RxDispose.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
class
LevelOneModel
extends
BaseModel
{
LiveData
<
double
>
appBarLive
=
LiveData
();
LiveData
<
List
<
String
>>
rectLive
=
LiveData
();
LiveData
<
List
<
String
>>
explainLive
=
LiveData
();
LiveData
<
bool
>
showTab
=
LiveData
();
LiveData
<
int
>
topIndexLive
=
new
LiveData
();
LiveData
<
double
>
topScrollLive
=
new
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
LiveData
<
Pair
<
int
,
List
<
Cards
>>>
cardsLive
=
LiveData
();
Map
<
int
,
List
<
Cards
>>
data
=
new
Map
();
List
list
=
[
"plan"
,
"hospital"
,
"doctor"
,
"diary"
];
List
pageList
=
[
1
,
1
,
1
,
1
];
void
refreshView
(
bool
clear
,
{
RefreshController
refreshListener
})
{
int
index
=
currentIndex
;
if
(
clear
)
{
data
.
clear
();
pageList
=
[
1
,
1
,
1
,
1
];
}
ClueApiImpl
.
getInstance
()
.
getLevelOneList
(
DioUtil
.
getInstance
().
getDio
(),
123
,
list
[
index
],
pageList
[
index
])
.
listen
((
event
)
{
}).
addToDispose
(
rxDispose
).
onError
((
err
)
{
});
}
int
currentIndex
=
0
;
@override
void
dispose
()
{
showTab
.
dispost
();
cardsLive
.
dispost
();
appBarLive
.
dispost
();
rectLive
.
dispost
();
topIndexLive
.
dispost
();
topScrollLive
.
dispost
();
}
void
selectPage
(
int
index
)
{
if
(
currentIndex
==
index
)
{
return
;
}
currentIndex
=
index
;
}
}
lib/ClueModel/page/levelOne/LevelOnePage.dart
View file @
4e01db3a
This diff is collapsed.
Click to expand it.
lib/ClueModel/server/api/ClueApi.dart
View file @
4e01db3a
...
@@ -3,10 +3,13 @@
...
@@ -3,10 +3,13 @@
* @date 2020/6/28
* @date 2020/6/28
**/
**/
import
'package:flutter_common/Annotations/anno/Get.dart'
;
import
'package:flutter_common/Annotations/anno/Get.dart'
;
import
'package:flutter_common/Annotations/anno/Query.dart'
;
import
'package:flutter_common/Annotations/anno/ServiceCenter.dart'
;
import
'package:flutter_common/Annotations/anno/ServiceCenter.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
@ServiceCenter
()
@ServiceCenter
()
class
ClueApi
{
abstract
class
ClueApi
{
@Get
(
"api/janus/plans/plan_feed"
)
LevelOneFeedList
getLevelOneList
(
@Query
(
"plan_id"
)
int
plan_id
,
}
@Query
(
"tab_type"
)
String
tab_type
,
@Query
(
"page"
)
int
page
);
\ No newline at end of file
}
lib/ClueModel/server/api/ClueApi.serv.dart
View file @
4e01db3a
...
@@ -14,6 +14,8 @@ import 'package:dio/dio.dart';
...
@@ -14,6 +14,8 @@ import 'package:dio/dio.dart';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
class
ClueApiImpl
{
class
ClueApiImpl
{
...
@@ -30,6 +32,23 @@ class ClueApiImpl {
...
@@ -30,6 +32,23 @@ class ClueApiImpl {
return
_instance
;
return
_instance
;
}
}
Stream
<
LevelOneFeedList
>
getLevelOneList
(
Dio
_dio
,
int
plan_id
,
String
tab_type
,
int
page
)
{
return
Stream
.
fromFuture
(
get
(
_dio
,
'api/janus/plans/plan_feed'
,
data:
{
'plan_id'
:
plan_id
,
'tab_type'
:
tab_type
,
'page'
:
page
,
})).
flatMap
((
value
)
{
if
(
value
!=
null
&&
(
value
.
statusCode
>=
200
&&
value
.
statusCode
<
300
))
{
return
Stream
.
fromFuture
(
compute
(
parseLevelOneFeedList
,
value
.
toString
()));
}
else
{
throw
Exception
(
"--未知网络错误--"
);
}
});
}
///==================base method==================
///==================base method==================
Future
<
Response
>
get
(
Dio
_dio
,
url
,
{
data
,
options
,
cancelToken
})
async
{
Future
<
Response
>
get
(
Dio
_dio
,
url
,
{
data
,
options
,
cancelToken
})
async
{
...
@@ -166,3 +185,7 @@ class ClueApiImpl {
...
@@ -166,3 +185,7 @@ class ClueApiImpl {
return
reason
;
return
reason
;
}
}
}
}
LevelOneFeedList
parseLevelOneFeedList
(
String
value
)
{
return
LevelOneFeedList
.
fromJson
(
json
.
decode
(
value
));
}
lib/ClueModel/server/entity/LevelOneFeedList.dart
View file @
4e01db3a
...
@@ -10,7 +10,9 @@ class LevelOneFeedList {
...
@@ -10,7 +10,9 @@ class LevelOneFeedList {
LevelOneFeedList
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
LevelOneFeedList
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'cards'
]
!=
null
)
{
if
(
json
[
'cards'
]
!=
null
)
{
cards
=
new
List
<
Cards
>();
cards
=
new
List
<
Cards
>();
json
[
'cards'
].
forEach
((
v
)
{
cards
.
add
(
new
Cards
.
fromJson
(
v
));
});
json
[
'cards'
].
forEach
((
v
)
{
cards
.
add
(
new
Cards
.
fromJson
(
v
));
});
}
}
}
}
...
@@ -35,8 +37,11 @@ class Cards {
...
@@ -35,8 +37,11 @@ class Cards {
Cards
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
Cards
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
cardType
=
json
[
'card_type'
];
cardType
=
json
[
'card_type'
];
plan
=
json
[
'plan'
]
!=
null
?
new
Plan
.
fromJson
(
json
[
'plan'
])
:
null
;
plan
=
json
[
'plan'
]
!=
null
?
new
Plan
.
fromJson
(
json
[
'plan'
])
:
null
;
hospital
=
json
[
'hospital'
]
!=
null
?
new
Hospital
.
fromJson
(
json
[
'hospital'
])
:
null
;
hospital
=
json
[
'hospital'
]
!=
null
doctor
=
json
[
'doctor'
]
!=
null
?
new
Hospital
.
fromJson
(
json
[
'doctor'
])
:
null
;
?
new
Hospital
.
fromJson
(
json
[
'hospital'
])
:
null
;
doctor
=
json
[
'doctor'
]
!=
null
?
new
Hospital
.
fromJson
(
json
[
'doctor'
])
:
null
;
diary
=
json
[
'diary'
]
!=
null
?
new
Diary
.
fromJson
(
json
[
'diary'
])
:
null
;
diary
=
json
[
'diary'
]
!=
null
?
new
Diary
.
fromJson
(
json
[
'diary'
])
:
null
;
}
}
...
@@ -70,7 +75,16 @@ class Plan {
...
@@ -70,7 +75,16 @@ class Plan {
String
consultUrl
;
String
consultUrl
;
String
phoneAuthroize
;
String
phoneAuthroize
;
Plan
({
this
.
planName
,
this
.
minPrice
,
this
.
maxPrice
,
this
.
positiveRate
,
this
.
salesCount
,
this
.
baseAttrs
,
this
.
projectImage
,
this
.
consultUrl
,
this
.
phoneAuthroize
});
Plan
(
{
this
.
planName
,
this
.
minPrice
,
this
.
maxPrice
,
this
.
positiveRate
,
this
.
salesCount
,
this
.
baseAttrs
,
this
.
projectImage
,
this
.
consultUrl
,
this
.
phoneAuthroize
});
Plan
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
Plan
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
planName
=
json
[
'plan_name'
];
planName
=
json
[
'plan_name'
];
...
@@ -80,7 +94,9 @@ class Plan {
...
@@ -80,7 +94,9 @@ class Plan {
salesCount
=
json
[
'sales_count'
];
salesCount
=
json
[
'sales_count'
];
if
(
json
[
'base_attrs'
]
!=
null
)
{
if
(
json
[
'base_attrs'
]
!=
null
)
{
baseAttrs
=
new
List
<
BaseAttrs
>();
baseAttrs
=
new
List
<
BaseAttrs
>();
json
[
'base_attrs'
].
forEach
((
v
)
{
baseAttrs
.
add
(
new
BaseAttrs
.
fromJson
(
v
));
});
json
[
'base_attrs'
].
forEach
((
v
)
{
baseAttrs
.
add
(
new
BaseAttrs
.
fromJson
(
v
));
});
}
}
projectImage
=
json
[
'project_image'
];
projectImage
=
json
[
'project_image'
];
consultUrl
=
json
[
'consult_url'
];
consultUrl
=
json
[
'consult_url'
];
...
@@ -128,20 +144,33 @@ class Hospital {
...
@@ -128,20 +144,33 @@ class Hospital {
String
name
;
String
name
;
String
minPrice
;
String
minPrice
;
String
maxPrice
;
String
maxPrice
;
String
address
;
int
star
;
List
<
BaseAttrs
>
baseAttrs
;
List
<
BaseAttrs
>
baseAttrs
;
String
consultUrl
;
String
consultUrl
;
String
phoneAuthroize
;
String
phoneAuthroize
;
Hospital
({
this
.
portrait
,
this
.
name
,
this
.
minPrice
,
this
.
maxPrice
,
this
.
baseAttrs
,
this
.
consultUrl
,
this
.
phoneAuthroize
});
Hospital
(
{
this
.
portrait
,
this
.
name
,
this
.
minPrice
,
this
.
maxPrice
,
this
.
baseAttrs
,
this
.
consultUrl
,
this
.
phoneAuthroize
});
Hospital
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
Hospital
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
portrait
=
json
[
'portrait'
];
portrait
=
json
[
'portrait'
];
name
=
json
[
'name'
];
name
=
json
[
'name'
];
star
=
json
[
'star'
];
address
=
json
[
'address'
];
minPrice
=
json
[
'min_price'
];
minPrice
=
json
[
'min_price'
];
maxPrice
=
json
[
'max_price'
];
maxPrice
=
json
[
'max_price'
];
if
(
json
[
'base_attrs'
]
!=
null
)
{
if
(
json
[
'base_attrs'
]
!=
null
)
{
baseAttrs
=
new
List
<
BaseAttrs
>();
baseAttrs
=
new
List
<
BaseAttrs
>();
json
[
'base_attrs'
].
forEach
((
v
)
{
baseAttrs
.
add
(
new
BaseAttrs
.
fromJson
(
v
));
});
json
[
'base_attrs'
].
forEach
((
v
)
{
baseAttrs
.
add
(
new
BaseAttrs
.
fromJson
(
v
));
});
}
}
consultUrl
=
json
[
'consult_url'
];
consultUrl
=
json
[
'consult_url'
];
phoneAuthroize
=
json
[
'phone_authroize'
];
phoneAuthroize
=
json
[
'phone_authroize'
];
...
@@ -153,6 +182,8 @@ class Hospital {
...
@@ -153,6 +182,8 @@ class Hospital {
data
[
'name'
]
=
this
.
name
;
data
[
'name'
]
=
this
.
name
;
data
[
'min_price'
]
=
this
.
minPrice
;
data
[
'min_price'
]
=
this
.
minPrice
;
data
[
'max_price'
]
=
this
.
maxPrice
;
data
[
'max_price'
]
=
this
.
maxPrice
;
data
[
'address'
]
=
this
.
address
;
data
[
'star'
]
=
this
.
star
;
if
(
this
.
baseAttrs
!=
null
)
{
if
(
this
.
baseAttrs
!=
null
)
{
data
[
'base_attrs'
]
=
this
.
baseAttrs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
data
[
'base_attrs'
]
=
this
.
baseAttrs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
}
...
@@ -201,7 +232,44 @@ class Diary {
...
@@ -201,7 +232,44 @@ class Diary {
UserLevel
userLevel
;
UserLevel
userLevel
;
int
serviceId
;
int
serviceId
;
Diary
({
this
.
diaryNum
,
this
.
videoUrl
,
this
.
isIdentification
,
this
.
isLiked
,
this
.
titleStyleType
,
this
.
replyNum
,
this
.
lasestTopicCreatedTime
,
this
.
images
,
this
.
relationServiceSku
,
this
.
createdTime
,
this
.
latestTopicId
,
this
.
id
,
this
.
city
,
this
.
userId
,
this
.
title
,
this
.
isVoted
,
this
.
diaryId
,
this
.
preImageList
,
this
.
voteNum
,
this
.
tagsNewEra
,
this
.
content
,
this
.
videoPic
,
this
.
shortVideoUrl
,
this
.
diaryAmount
,
this
.
diaryTitle
,
this
.
authorType
,
this
.
tags
,
this
.
contentLevel
,
this
.
lastModified
,
this
.
user
,
this
.
isOnline
,
this
.
date
,
this
.
membershipLevel
,
this
.
viewNum
,
this
.
postImageList
,
this
.
userLevel
,
this
.
serviceId
});
Diary
(
{
this
.
diaryNum
,
this
.
videoUrl
,
this
.
isIdentification
,
this
.
isLiked
,
this
.
titleStyleType
,
this
.
replyNum
,
this
.
lasestTopicCreatedTime
,
this
.
images
,
this
.
relationServiceSku
,
this
.
createdTime
,
this
.
latestTopicId
,
this
.
id
,
this
.
city
,
this
.
userId
,
this
.
title
,
this
.
isVoted
,
this
.
diaryId
,
this
.
preImageList
,
this
.
voteNum
,
this
.
tagsNewEra
,
this
.
content
,
this
.
videoPic
,
this
.
shortVideoUrl
,
this
.
diaryAmount
,
this
.
diaryTitle
,
this
.
authorType
,
this
.
tags
,
this
.
contentLevel
,
this
.
lastModified
,
this
.
user
,
this
.
isOnline
,
this
.
date
,
this
.
membershipLevel
,
this
.
viewNum
,
this
.
postImageList
,
this
.
userLevel
,
this
.
serviceId
});
Diary
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
Diary
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
diaryNum
=
json
[
'diary_num'
];
diaryNum
=
json
[
'diary_num'
];
...
@@ -213,9 +281,13 @@ class Diary {
...
@@ -213,9 +281,13 @@ class Diary {
lasestTopicCreatedTime
=
json
[
'lasest_topic_created_time'
];
lasestTopicCreatedTime
=
json
[
'lasest_topic_created_time'
];
if
(
json
[
'images'
]
!=
null
)
{
if
(
json
[
'images'
]
!=
null
)
{
images
=
new
List
<
Images
>();
images
=
new
List
<
Images
>();
json
[
'images'
].
forEach
((
v
)
{
images
.
add
(
new
Images
.
fromJson
(
v
));
});
json
[
'images'
].
forEach
((
v
)
{
images
.
add
(
new
Images
.
fromJson
(
v
));
});
}
}
relationServiceSku
=
json
[
'relation_service_sku'
]
!=
null
?
new
RelationServiceSku
.
fromJson
(
json
[
'relation_service_sku'
])
:
null
;
relationServiceSku
=
json
[
'relation_service_sku'
]
!=
null
?
new
RelationServiceSku
.
fromJson
(
json
[
'relation_service_sku'
])
:
null
;
createdTime
=
json
[
'created_time'
];
createdTime
=
json
[
'created_time'
];
latestTopicId
=
json
[
'latest_topic_id'
];
latestTopicId
=
json
[
'latest_topic_id'
];
id
=
json
[
'id'
];
id
=
json
[
'id'
];
...
@@ -228,7 +300,9 @@ class Diary {
...
@@ -228,7 +300,9 @@ class Diary {
voteNum
=
json
[
'vote_num'
];
voteNum
=
json
[
'vote_num'
];
if
(
json
[
'tags_new_era'
]
!=
null
)
{
if
(
json
[
'tags_new_era'
]
!=
null
)
{
tagsNewEra
=
new
List
<
TagsNewEra
>();
tagsNewEra
=
new
List
<
TagsNewEra
>();
json
[
'tags_new_era'
].
forEach
((
v
)
{
tagsNewEra
.
add
(
new
TagsNewEra
.
fromJson
(
v
));
});
json
[
'tags_new_era'
].
forEach
((
v
)
{
tagsNewEra
.
add
(
new
TagsNewEra
.
fromJson
(
v
));
});
}
}
content
=
json
[
'content'
];
content
=
json
[
'content'
];
videoPic
=
json
[
'video_pic'
];
videoPic
=
json
[
'video_pic'
];
...
@@ -238,7 +312,9 @@ class Diary {
...
@@ -238,7 +312,9 @@ class Diary {
authorType
=
json
[
'author_type'
];
authorType
=
json
[
'author_type'
];
if
(
json
[
'tags'
]
!=
null
)
{
if
(
json
[
'tags'
]
!=
null
)
{
tags
=
new
List
<
Tags
>();
tags
=
new
List
<
Tags
>();
json
[
'tags'
].
forEach
((
v
)
{
tags
.
add
(
new
Tags
.
fromJson
(
v
));
});
json
[
'tags'
].
forEach
((
v
)
{
tags
.
add
(
new
Tags
.
fromJson
(
v
));
});
}
}
contentLevel
=
json
[
'content_level'
];
contentLevel
=
json
[
'content_level'
];
lastModified
=
json
[
'last_modified'
];
lastModified
=
json
[
'last_modified'
];
...
@@ -248,7 +324,9 @@ class Diary {
...
@@ -248,7 +324,9 @@ class Diary {
membershipLevel
=
json
[
'membership_level'
];
membershipLevel
=
json
[
'membership_level'
];
viewNum
=
json
[
'view_num'
];
viewNum
=
json
[
'view_num'
];
postImageList
=
json
[
'post_image_list'
].
cast
<
String
>();
postImageList
=
json
[
'post_image_list'
].
cast
<
String
>();
userLevel
=
json
[
'user_level'
]
!=
null
?
new
UserLevel
.
fromJson
(
json
[
'user_level'
])
:
null
;
userLevel
=
json
[
'user_level'
]
!=
null
?
new
UserLevel
.
fromJson
(
json
[
'user_level'
])
:
null
;
serviceId
=
json
[
'service_id'
];
serviceId
=
json
[
'service_id'
];
}
}
...
@@ -318,7 +396,16 @@ class Images {
...
@@ -318,7 +396,16 @@ class Images {
String
imageHalf
;
String
imageHalf
;
String
desc
;
String
desc
;
Images
({
this
.
imageWide
,
this
.
imageType
,
this
.
image
,
this
.
sImagePlatform
,
this
.
imageSlimwidth
,
this
.
smallWide
,
this
.
imageThumb
,
this
.
imageHalf
,
this
.
desc
});
Images
(
{
this
.
imageWide
,
this
.
imageType
,
this
.
image
,
this
.
sImagePlatform
,
this
.
imageSlimwidth
,
this
.
smallWide
,
this
.
imageThumb
,
this
.
imageHalf
,
this
.
desc
});
Images
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
Images
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
imageWide
=
json
[
'image_wide'
];
imageWide
=
json
[
'image_wide'
];
...
@@ -348,17 +435,14 @@ class Images {
...
@@ -348,17 +435,14 @@ class Images {
}
}
class
RelationServiceSku
{
class
RelationServiceSku
{
RelationServiceSku
();
RelationServiceSku
();
RelationServiceSku
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
RelationServiceSku
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{}
}
Map
<
String
,
dynamic
>
toJson
()
{
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
return
data
;
return
data
;
}
}
}
}
class
TagsNewEra
{
class
TagsNewEra
{
...
@@ -395,7 +479,14 @@ class User {
...
@@ -395,7 +479,14 @@ class User {
String
userName
;
String
userName
;
String
membershipLevel
;
String
membershipLevel
;
User
({
this
.
city
,
this
.
userId
,
this
.
topicNumPosted
,
this
.
voteNumGained
,
this
.
portrait
,
this
.
userName
,
this
.
membershipLevel
});
User
(
{
this
.
city
,
this
.
userId
,
this
.
topicNumPosted
,
this
.
voteNumGained
,
this
.
portrait
,
this
.
userName
,
this
.
membershipLevel
});
User
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
User
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
city
=
json
[
'city'
];
city
=
json
[
'city'
];
...
...
lib/ClueModel/util/PosUtil.dart
0 → 100644
View file @
4e01db3a
/*
* @author lsy
* @date 2020/6/30
**/
import
'package:flutter/cupertino.dart'
;
class
PosUtil
{
static
Offset
findPos
(
GlobalKey
globalKey
)
{
Offset
offset
;
if
(
globalKey
.
currentContext
!=
null
)
{
RenderBox
box
=
globalKey
.
currentContext
.
findRenderObject
();
offset
=
box
.
localToGlobal
(
Offset
.
zero
);
}
return
offset
;
}
}
lib/commonModel/GMBase.dart
View file @
4e01db3a
...
@@ -9,4 +9,3 @@ export 'base/BaseUtil.dart';
...
@@ -9,4 +9,3 @@ export 'base/BaseUtil.dart';
export
'net/Api.dart'
;
export
'net/Api.dart'
;
export
'net/DioUtil.dart'
;
export
'net/DioUtil.dart'
;
export
'picker/loadingPicker.dart'
;
export
'picker/loadingPicker.dart'
;
export
'util/DartUtil.dart'
;
lib/commonModel/base/BaseComponent.dart
View file @
4e01db3a
...
@@ -5,10 +5,13 @@
...
@@ -5,10 +5,13 @@
import
'package:flutter/gestures.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_common/commonModel/eventbus/GlobalEventBus.dart'
;
import
'package:flutter_common/commonModel/eventbus/GlobalEventBus.dart'
;
import
'package:flutter_common/commonModel/view/iOSLoading.dart'
;
import
'package:flutter_common/commonModel/view/iOSLoading.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/util/DartUtil.dart'
;
import
'package:gm_flutter/commonModel/view/ImagesAnimation.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
double
SCREENWIDTH
;
double
SCREENWIDTH
;
...
@@ -25,9 +28,8 @@ AppBar baseAppBar(
...
@@ -25,9 +28,8 @@ AppBar baseAppBar(
double
elevation
=
0.0
,
double
elevation
=
0.0
,
Widget
titleWidget
=
null
})
{
Widget
titleWidget
=
null
})
{
return
_baseAppBarChangeTitle
(
return
_baseAppBarChangeTitle
(
title:
title
==
null
title:
?
Container
()
title
==
null
?
Container
()
:
baseText
(
title
,
16
,
Color
(
0xff323232
)),
:
baseText
(
title
,
16
,
Color
(
0xff323232
)),
action:
action
,
action:
action
,
centerTitle:
centerTitle
,
centerTitle:
centerTitle
,
backClick:
backClick
,
backClick:
backClick
,
...
@@ -248,8 +250,86 @@ Widget baseRedPoint(int num) {
...
@@ -248,8 +250,86 @@ Widget baseRedPoint(int num) {
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
width:
15
,
width:
15
,
height:
15
,
height:
15
,
decoration:
decoration:
BoxDecoration
(
shape:
BoxShape
.
circle
,
color:
Color
(
0xffFF5963
)),
BoxDecoration
(
shape:
BoxShape
.
circle
,
color:
Color
(
0xffFF5963
)),
child:
baseText
(
"
${num}
"
,
11
,
Color
(
0xffFFFFFF
)),
child:
baseText
(
"
${num}
"
,
11
,
Color
(
0xffFFFFFF
)),
);
);
}
}
Widget
baseRefreshView
(
RefreshController
refreshController
,
VoidCallback
refresh
,
Widget
topFix
,
Widget
List
,
{
bool
pullUp
=
false
,
bool
pullDown
=
true
,
VoidCallback
onLoading
,
ScrollController
scrollController
,
CustomScrollView
customScrollView
})
{
return
SmartRefresher
(
enablePullDown:
pullDown
,
enablePullUp:
pullUp
,
onLoading:
onLoading
??
()
{},
header:
normalRefreshHeader
(),
controller:
refreshController
,
onRefresh:
refresh
,
footer:
CustomFooter
(
builder:
(
BuildContext
context
,
LoadStatus
mode
)
{
Widget
body
;
// if (mode == LoadStatus.idle) {
// body = baseText("准备加载", 12, Color(0xff545454));
// } else
if
(
mode
==
LoadStatus
.
loading
)
{
body
=
baseText
(
"加载中"
,
12
,
Color
(
0xff545454
));
}
else
if
(
mode
==
LoadStatus
.
failed
)
{
body
=
baseText
(
"加载失败"
,
12
,
Color
(
0xff545454
));
}
else
if
(
mode
==
LoadStatus
.
noMore
)
{
body
=
baseText
(
"没有更多数据了"
,
12
,
Color
(
0xff545454
));
}
else
{
body
=
Container
();
}
return
Container
(
height:
55.0
,
child:
Center
(
child:
body
),
);
},
),
child:
customScrollView
??
CustomScrollView
(
controller:
scrollController
,
slivers:
<
Widget
>[
SliverToBoxAdapter
(
child:
topFix
,
),
List
,
],
));
}
Widget
normalRefreshHeader
(
)
{
return
CustomHeader
(
builder:
(
BuildContext
context
,
RefreshStatus
mode
)
{
Widget
body
;
// if (mode == RefreshStatus.idle) {
//
// } else
if
(
mode
==
RefreshStatus
.
refreshing
)
{
body
=
ImagesAnimation
(
w:
46
,
h:
15
,
durationSeconds:
1500
,
entry:
ImagesAnimationEntry
(
1
,
20
,
"assets/ptr_header_loading"
));
}
// else if (mode == RefreshStatus.failed) {
// body = Text("Load Failed!Click retry!");
// }
else
{
body
=
Image
.
asset
(
"assets/ptr_header_loading01.png"
,
width:
46
,
height:
15
,
);
}
return
Container
(
height:
55.0
,
child:
Center
(
child:
body
),
);
},
);
}
lib/main.dart
View file @
4e01db3a
...
@@ -70,7 +70,7 @@ class MyApp extends State<MyAppWidget> {
...
@@ -70,7 +70,7 @@ class MyApp extends State<MyAppWidget> {
WindowUtil
.
setBarStatus
(
true
);
WindowUtil
.
setBarStatus
(
true
);
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(),
theme:
ThemeData
(),
builder:
FlutterBoost
.
init
(
postPush:
_onRoutePushed
),
//
builder: FlutterBoost.init(postPush: _onRoutePushed),
home:
RouterCenterImpl
().
findClueRouter
().
getLevelOnePage
());
home:
RouterCenterImpl
().
findClueRouter
().
getLevelOnePage
());
}
}
...
...
pubspec.yaml
View file @
4e01db3a
...
@@ -3,7 +3,7 @@ description: A new flutter module project.
...
@@ -3,7 +3,7 @@ description: A new flutter module project.
version
:
1.0.0+1
version
:
1.0.0+1
environment
:
environment
:
sdk
:
"
>=2.
1
.0
<3.0.0"
sdk
:
"
>=2.
6
.0
<3.0.0"
dependencies
:
dependencies
:
flutter
:
flutter
:
...
...
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