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-01-02 12:23:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
77fab5043073f471ef5fcd9f1c3693f338742101
77fab504
1 parent
e75743fe
update styles
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
36 deletions
lib/poem/page/poem_page.dart
lib/tiktok/widgets/tiktok_video_poem.dart
lib/timeline/pages/timelines_page.dart
lib/timeline/widgets/friend_cell.dart
lib/widgets/bars/timeline_menu_bar.dart
lib/poem/page/poem_page.dart
View file @
77fab50
...
...
@@ -9,7 +9,6 @@ import 'package:one_poem/tiktok/widgets/tiktok_top_info.dart';
import
'package:one_poem/tiktok/widgets/tiktok_video.dart'
;
import
'package:one_poem/tiktok/widgets/tiktok_video_button_column.dart'
;
import
'package:one_poem/tiktok/widgets/tiktok_video_poem.dart'
;
import
'package:one_poem/util/toast_utils.dart'
;
import
'package:one_poem/widgets/bars/home_action_bar.dart'
;
import
'package:one_poem/widgets/my_app_bar.dart'
;
import
'package:video_player/video_player.dart'
;
...
...
lib/tiktok/widgets/tiktok_video_poem.dart
View file @
77fab50
...
...
@@ -66,6 +66,7 @@ class TikTokVidePoem extends StatelessWidget {
fontSize:
20
.
px
),
),
Container
(
padding:
EdgeInsets
.
only
(
right:
5
.
px
),
alignment:
Alignment
.
centerRight
,
width:
double
.
infinity
,
child:
Text
(
...
...
lib/timeline/pages/timelines_page.dart
View file @
77fab50
...
...
@@ -5,7 +5,8 @@ import 'package:flutter/material.dart';
import
'package:flutter/services.dart'
;
import
'package:one_poem/timeline/models/friend_entity.dart'
;
import
'package:one_poem/timeline/widgets/friend_cell.dart'
;
import
'package:one_poem/timeline/widgets/header_view.dart'
;
import
'package:one_poem/widgets/bars/timeline_menu_bar.dart'
;
import
'package:one_poem/widgets/my_app_bar.dart'
;
class
TimelinesPage
extends
StatefulWidget
{
const
TimelinesPage
({
Key
?
key
})
:
super
(
key:
key
);
...
...
@@ -14,11 +15,11 @@ class TimelinesPage extends StatefulWidget {
_TimelinesPageState
createState
()
=>
_TimelinesPageState
();
}
class
_TimelinesPageState
extends
State
<
TimelinesPage
>{
class
_TimelinesPageState
extends
State
<
TimelinesPage
>
{
final
ScrollController
_scrollController
=
ScrollController
();
double
_opacity
=
0
;
FriendEntity
_friend
m
odelEntity
=
FriendEntity
();
FriendEntity
_friend
M
odelEntity
=
FriendEntity
();
Future
<
String
>
loadAsset
()
async
{
return
await
rootBundle
.
loadString
(
'assets/data/Data.json'
);
...
...
@@ -28,59 +29,51 @@ class _TimelinesPageState extends State<TimelinesPage>{
void
initState
()
{
super
.
initState
();
loadAsset
().
then
((
value
){
loadAsset
().
then
((
value
)
{
var
json
=
jsonDecode
(
value
);
_friend
m
odelEntity
=
FriendEntity
.
fromJson
(
json
);
_friend
M
odelEntity
=
FriendEntity
.
fromJson
(
json
);
setState
(()
{});
});
_scrollController
.
addListener
(()
{
double
alph
=
_scrollController
.
offset
/
200
;
if
(
alph
<
0
)
{
alph
=
0
;
}
else
if
(
alph
>
1
)
{
alph
=
1
;
double
alpha
=
_scrollController
.
offset
/
200
;
if
(
alpha
<
0
)
{
alpha
=
0
;
}
else
if
(
alpha
>
1
)
{
alpha
=
1
;
}
setState
(()
{
_opacity
=
alph
;
_opacity
=
alph
a
;
});
});
}
Widget
_mainListViewBuidler
(
BuildContext
context
,
int
index
)
{
return
FriendCell
(
model:
_friendmodelEntity
.
data
[
index
],);
Widget
_mainListViewBuilder
(
BuildContext
context
,
int
index
)
{
return
FriendCell
(
model:
_friendModelEntity
.
data
[
index
],
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
body:
Stack
(
children:
<
Widget
>[
ListView
(
appBar:
const
MyAppBar
(
isBack:
false
,
isTransparent:
true
,
homeMenuHeader:
TimelineMenuHeader
(),
),
body:
ListView
(
padding:
const
EdgeInsets
.
only
(
top:
0
),
controller:
_scrollController
,
children:
<
Widget
>[
const
HeaderView
(),
ListView
.
builder
(
padding:
const
EdgeInsets
.
only
(
top:
0
),
itemBuilder:
_mainListViewBuidler
,
itemCount:
_friendmodelEntity
.
data
.
length
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),)
],
),
Opacity
(
opacity:
_opacity
,
child:
const
CupertinoNavigationBar
(
middle:
Text
(
"临境|附近|新鲜"
),
),
ListView
.
builder
(
padding:
const
EdgeInsets
.
only
(
top:
0
),
itemBuilder:
_mainListViewBuilder
,
itemCount:
_friendModelEntity
.
data
.
length
,
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
)
],
),
);
}
...
...
lib/timeline/widgets/friend_cell.dart
View file @
77fab50
This diff is collapsed. Click to expand it.
lib/widgets/bars/timeline_menu_bar.dart
0 → 100644
View file @
77fab50
import
'package:flutter/material.dart'
;
class
TimelineMenuHeader
extends
StatelessWidget
{
const
TimelineMenuHeader
({
Key
?
key
,
this
.
funcLeft
,
this
.
funcCenter
,
this
.
funcRight
,
})
:
super
(
key:
key
);
final
Function
?
funcLeft
;
final
Function
?
funcCenter
;
final
Function
?
funcRight
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
alignment:
Alignment
.
center
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisSize:
MainAxisSize
.
min
,
//交叉轴的布局方式,对于column来说就是水平方向的布局方式
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
SizedBox
(
width:
60.0
,
child:
TextButton
(
onPressed:
()
=>
funcLeft
!(),
child:
const
Text
(
"临境"
,
style:
TextStyle
(
color:
Colors
.
black54
),
),
),
),
const
VerticalDivider
(
color:
Colors
.
black54
,
width:
1.0
,
thickness:
1.0
,
indent:
16.0
,
endIndent:
16.0
,
),
TextButton
(
onPressed:
()
=>
funcCenter
!(),
child:
const
Text
(
"附近"
,
style:
TextStyle
(
color:
Colors
.
black54
),
),
),
const
VerticalDivider
(
color:
Colors
.
black54
,
width:
1.0
,
thickness:
1.0
,
indent:
15.0
,
endIndent:
15.0
,
),
TextButton
(
onPressed:
()
=>
funcRight
!(),
child:
const
Text
(
"新鲜"
,
style:
TextStyle
(
color:
Colors
.
black54
),
),
),
],
));
}
}
Please
register
or
login
to post a comment