Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-App
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
reason
2022-07-20 16:11:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6b1af878aca506e7a5e9506a6d8b4901ce3d80ea
6b1af878
1 parent
92399115
增加新鲜接口
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
11 deletions
android/app/src/main/AndroidManifest.xml
lib/home/home_page.dart
lib/net/http_api.dart
pubspec.yaml
android/app/src/main/AndroidManifest.xml
View file @
6b1af87
...
...
@@ -72,4 +72,7 @@
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.RECORD_AUDIO"
/>
<uses-permission
android:name=
"android.permission.QUERY_ALL_PACKAGES"
tools:node=
"remove"
/>
</manifest>
...
...
lib/home/home_page.dart
View file @
6b1af87
...
...
@@ -23,7 +23,6 @@ class Home extends StatefulWidget {
class
HomeState
extends
State
<
Home
>
with
WidgetsBindingObserver
{
final
PageController
_controller
=
PageController
();
bool
isLoading
=
false
;
int
currentId
=
0
;
int
currentPage
=
0
;
...
...
@@ -32,6 +31,7 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
bool
isFav
=
false
;
bool
isPraise
=
false
;
bool
isSharing
=
false
;
int
cate
=
0
;
late
StreamSubscription
bus
;
List
<
Widget
>
videos
=
[];
...
...
@@ -95,6 +95,7 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
:
debugPrint
(
"未获得授权:
$permissions
"
));
});
_onRefresh
();
bus
=
eventBus
.
on
<
TransEvent
>().
listen
((
event
)
{});
}
/// 下拉刷新方法,为list重新赋值
...
...
@@ -103,7 +104,7 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
currentPage
=
0
;
DioUtils
.
instance
.
asyncRequestNetwork
<
HomeEntity
>(
Method
.
get
,
HttpApi
.
home
,
cate
==
0
?
HttpApi
.
home
:
HttpApi
.
fresh
,
params:
{
'page_size'
:
80
},
onSuccess:
(
data
)
{
isLoading
=
false
;
...
...
@@ -119,8 +120,6 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
));
}
setState
(()
{});
bus
=
eventBus
.
on
<
TransEvent
>().
listen
((
event
)
{});
},
onError:
(
code
,
msg
)
{
Toast
.
show
(
"获取数据失败,请稍候再试..."
);
...
...
@@ -135,11 +134,10 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
isLoading
=
true
;
DioUtils
.
instance
.
asyncRequestNetwork
<
HomeEntity
>(
Method
.
get
,
HttpApi
.
home
,
cate
==
0
?
HttpApi
.
home
:
HttpApi
.
fresh
,
params:
{
'page_size'
:
80
,
'page'
:
currentPage
},
onSuccess:
(
data
)
{
isLoading
=
false
;
for
(
HomeData
data
in
data
!.
data
!)
{
videos
.
add
(
VideoSlides
(
videoId:
data
.
id
!,
...
...
@@ -151,8 +149,6 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
));
}
setState
(()
{});
bus
=
eventBus
.
on
<
TransEvent
>().
listen
((
event
)
{});
},
onError:
(
code
,
msg
)
{
Toast
.
show
(
"获取数据失败,请稍候再试..."
);
...
...
@@ -188,7 +184,11 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
TextButton
(
onPressed:
()
{},
onPressed:
()
{
cate
=
0
;
setState
(()
{});
_onRefresh
();
},
child:
const
Text
(
"临境"
,
style:
TextStyle
(
...
...
@@ -203,6 +203,7 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
),
TextButton
(
onPressed:
()
{
eventBus
.
fire
(
TransEvent
());
NavigatorUtils
.
push
(
context
,
CategoryRouter
.
categoryPage
,
...
...
@@ -221,7 +222,11 @@ class HomeState extends State<Home> with WidgetsBindingObserver {
style:
TextStyle
(
color:
Colors
.
white
),
),
TextButton
(
onPressed:
()
=>
{},
onPressed:
()
{
cate
=
1
;
setState
(()
{});
_onRefresh
();
},
child:
const
Text
(
"新鲜"
,
style:
TextStyle
(
...
...
lib/net/http_api.dart
View file @
6b1af87
...
...
@@ -11,6 +11,7 @@ class HttpApi {
static
const
String
user
=
'user'
;
static
const
String
membership
=
'membership'
;
static
const
String
home
=
'home'
;
static
const
String
fresh
=
'fresh'
;
static
const
String
myVideos
=
'/my/videos'
;
static
const
String
praise
=
'/praise'
;
static
const
String
addView
=
'/addview'
;
...
...
pubspec.yaml
View file @
6b1af87
...
...
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version
:
1.0.0+
6
version
:
1.0.0+
8
environment
:
sdk
:
"
>=2.16.2
<3.0.0"
...
...
Please
register
or
login
to post a comment