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
2021-12-29 09:08:13 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2f942fc541a33c2065c6acb1ef9e24871c3db6f2
2f942fc5
1 parent
c0413e67
update yiyan info
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
391 additions
and
101 deletions
android/app/src/main/AndroidManifest.xml
lib/account/account_router.dart
lib/account/page/account_page.dart
lib/home/home_page.dart
lib/main.dart
lib/poem/page/poem_detail.dart
lib/poem/page/poem_page.dart
lib/poem/poem_router.dart
lib/tiktok/pages/user_page.dart
android/app/src/main/AndroidManifest.xml
View file @
2f942fc
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.mofunsky.one_poem"
>
<application
android:label=
"
one_poem
"
android:label=
"
一言
"
android:icon=
"@mipmap/ic_launcher"
>
<activity
android:name=
".MainActivity"
...
...
lib/account/account_router.dart
View file @
2f942fc
...
...
@@ -10,7 +10,9 @@ class AccountRouter implements IRouterProvider{
@override
void
initRouter
(
FluroRouter
router
)
{
router
.
define
(
accountPage
,
handler:
Handler
(
handlerFunc:
(
_
,
__
)
=>
const
AccountPage
()));
router
.
define
(
accountPage
,
handler:
Handler
(
handlerFunc:
(
_
,
__
)
{
return
const
AccountPage
(
isSelfPage:
true
,);
}));
}
}
...
...
lib/account/page/account_page.dart
View file @
2f942fc
import
'package:common_utils/common_utils.dart'
;
import
'package:flutter/material.dart'
;
import
'package:one_poem/res/gaps.dart'
;
import
'package:one_poem/res/resources.dart'
;
import
'package:one_poem/routers/fluro_navigator.dart'
;
import
'package:one_poem/util/image_utils.dart'
;
import
'package:one_poem/widgets/click_item.dart'
;
import
'package:one_poem/tiktok/style/style.dart'
;
import
'package:one_poem/widgets/my_app_bar.dart'
;
import
'package:one_poem/widgets/rise_number_text.dart'
;
import
'package:tapped/tapped.dart'
;
import
'package:flutter_gen/gen_l10n/one_poem_localizations.dart'
;
import
'../account_router.dart'
;
/// design/6店铺-账户/index.html#artboard2
class
AccountPage
extends
StatefulWidget
{
const
AccountPage
({
Key
?
key
,
this
.
canPop
=
false
,
this
.
onPop
,
this
.
isSelfPage
,
this
.
onSwitch
,
})
:
super
(
key:
key
);
const
AccountPage
({
Key
?
key
})
:
super
(
key:
key
);
final
bool
canPop
;
final
bool
?
isSelfPage
;
final
Function
?
onPop
;
final
Function
?
onSwitch
;
@override
_AccountPageState
createState
()
=>
_AccountPageState
();
...
...
@@ -22,106 +25,370 @@ class AccountPage extends StatefulWidget {
class
_AccountPageState
extends
State
<
AccountPage
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
const
MyAppBar
(
centerTitle:
'资金管理'
,
Widget
likeButton
=
Container
(
color:
ColorPlate
.
back1
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
const
<
Widget
>[
Tapped
(
child:
_UserRightButton
(
title:
'钱包'
,
),
),
],
),
);
Widget
avatar
=
Container
(
height:
120
+
MediaQuery
.
of
(
context
).
padding
.
top
,
padding:
const
EdgeInsets
.
only
(
left:
18
),
alignment:
Alignment
.
bottomLeft
,
child:
OverflowBox
(
alignment:
Alignment
.
bottomLeft
,
minHeight:
20
,
maxHeight:
300
,
child:
Container
(
height:
74
,
width:
74
,
margin:
const
EdgeInsets
.
only
(
bottom:
12
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
44
),
color:
Colors
.
orange
,
border:
Border
.
all
(
color:
Colors
.
white
,
width:
1
,
),
),
child:
ClipOval
(
child:
Image
.
network
(
"https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"
,
fit:
BoxFit
.
cover
,
),
),
),
body:
SingleChildScrollView
(
),
);
Widget
body
=
ListView
(
physics:
const
BouncingScrollPhysics
(
parent:
AlwaysScrollableScrollPhysics
(),
),
children:
<
Widget
>[
Container
(
height:
20
),
// 头像与关注
Stack
(
alignment:
Alignment
.
bottomLeft
,
children:
<
Widget
>[
likeButton
,
avatar
],
),
Container
(
color:
ColorPlate
.
back1
,
child:
Column
(
children:
<
Widget
>[
Container
(
padding:
const
EdgeInsets
.
only
(
left:
18
),
color:
ColorPlate
.
back1
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Gaps
.
vGap5
,
_buildCard
(),
Gaps
.
vGap5
,
ClickItem
(
title:
'提现'
,
onTap:
()
=>
NavigatorUtils
.
push
(
context
,
AccountRouter
.
accountPage
),
//TODO
const
Text
(
'@唐宋八大家TOP8'
,
style:
StandardTextStyle
.
big
,
),
Container
(
height:
8
),
Text
(
'朴实无华,且枯燥'
,
style:
StandardTextStyle
.
smallWithOpacity
.
apply
(
color:
Colors
.
white
,
),
ClickItem
(
title:
'提现记录'
,
onTap:
()
=>
NavigatorUtils
.
push
(
context
,
AccountRouter
.
accountPage
),
//TODO
),
ClickItem
(
title:
'提现密码'
,
onTap:
()
=>
NavigatorUtils
.
push
(
context
,
AccountRouter
.
accountPage
),
//TODO
Container
(
height:
10
),
Row
(
children:
const
<
Widget
>[
_UserTag
(
tag:
'幽默'
),
_UserTag
(
tag:
'机智'
),
_UserTag
(
tag:
'枯燥'
),
_UserTag
(
tag:
'狮子座'
),
],
),
Container
(
height:
10
),
],
),
)
),
Container
(
color:
ColorPlate
.
back1
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8
,
vertical:
2
,
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
const
<
Widget
>[
TextGroup
(
'356'
,
'关注'
),
TextGroup
(
'145万'
,
'粉丝'
),
TextGroup
(
'1423万'
,
'获赞'
),
],
),
),
Container
(
height:
10
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
12
),
decoration:
BoxDecoration
(
border:
Border
(
bottom:
BorderSide
(
color:
Colors
.
white
.
withOpacity
(
0.1
),
),
),
),
),
const
_UserVideoTable
(),
],
),
),
],
);
return
Scaffold
(
appBar:
const
MyAppBar
(
centerTitle:
'我在'
,
),
body:
Container
(
decoration:
const
BoxDecoration
(
gradient:
LinearGradient
(
begin:
Alignment
.
topCenter
,
colors:
<
Color
>[
Colors
.
orange
,
Colors
.
red
,
],
),
),
child:
Stack
(
alignment:
Alignment
.
topCenter
,
children:
<
Widget
>[
Container
(
margin:
const
EdgeInsets
.
only
(
top:
400
),
height:
double
.
infinity
,
width:
double
.
infinity
,
color:
ColorPlate
.
back1
,
),
body
,
],
),
));
}
}
Widget
_buildCard
()
{
return
AspectRatio
(
aspectRatio:
1.85
,
child:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
6.0
),
padding:
const
EdgeInsets
.
all
(
6.0
),
class
_UserRightButton
extends
StatelessWidget
{
const
_UserRightButton
({
Key
?
key
,
required
this
.
title
,
})
:
super
(
key:
key
);
final
String
title
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
20
,
),
margin:
const
EdgeInsets
.
all
(
8
),
alignment:
Alignment
.
center
,
child:
Text
(
title
,
style:
const
TextStyle
(
color:
ColorPlate
.
orange
),
),
decoration:
BoxDecoration
(
image:
DecorationImage
(
image:
ImageUtils
.
getAssetImage
(
'account/bg'
),
fit:
BoxFit
.
fill
,
border:
Border
.
all
(
color:
ColorPlate
.
orange
),
borderRadius:
BorderRadius
.
circular
(
4
),
),
);
}
}
class
_UserTag
extends
StatelessWidget
{
final
String
?
tag
;
const
_UserTag
({
Key
?
key
,
this
.
tag
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
4
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
2
,
horizontal:
4
,
),
child:
Column
(
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Colors
.
white
.
withOpacity
(
0.3
),
),
borderRadius:
BorderRadius
.
circular
(
4
),
),
child:
Text
(
tag
??
'标签'
,
style:
StandardTextStyle
.
smallWithOpacity
,
),
);
}
}
class
_UserVideoTable
extends
StatelessWidget
{
const
_UserVideoTable
({
Key
?
key
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Column
(
children:
<
Widget
>[
const
_AccountMoney
(
title:
'当前余额(元)'
,
money:
'30.12'
,
alignment:
MainAxisAlignment
.
end
,
moneyTextStyle:
TextStyle
(
color:
Colors
.
white
,
fontSize:
32.0
,
fontWeight:
FontWeight
.
bold
,
fontFamily:
'RobotoThin'
),
Container
(
color:
ColorPlate
.
back1
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
12
,
),
Expanded
(
child:
Row
(
children:
const
<
Widget
>[
_AccountMoney
(
title:
'累计结算金额'
,
money:
'20000'
),
_AccountMoney
(
title:
'累计发放佣金'
,
money:
'0.02'
),
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
_PointSelectTextButton
(
true
,
OnePoemLocalizations
.
of
(
context
)
.
onePoemBottomNavigationBarItemTitle
,
),
_PointSelectTextButton
(
false
,
OnePoemLocalizations
.
of
(
context
)
.
timelineBottomNavigationBarItemTitle
),
_PointSelectTextButton
(
false
,
OnePoemLocalizations
.
of
(
context
)
.
categoryBottomNavigationBarItemTitle
),
],
),
),
Row
(
children:
const
<
Widget
>[
_SmallVideo
(),
_SmallVideo
(),
_SmallVideo
(),
],
),
Row
(
children:
const
<
Widget
>[
_SmallVideo
(),
_SmallVideo
(),
_SmallVideo
(),
],
),
],
);
}
}
class
_AccountMoney
extends
StatelessWidget
{
const
_AccountMoney
({
class
_SmallVideo
extends
StatelessWidget
{
const
_SmallVideo
({
Key
?
key
,
required
this
.
title
,
required
this
.
money
,
this
.
alignment
,
this
.
moneyTextStyle
}):
super
(
key:
key
);
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Expanded
(
child:
AspectRatio
(
aspectRatio:
3
/
4.0
,
child:
Container
(
decoration:
BoxDecoration
(
color:
ColorPlate
.
darkGray
,
border:
Border
.
all
(
color:
Colors
.
black
),
),
alignment:
Alignment
.
center
,
child:
Text
(
'一言'
,
style:
TextStyle
(
color:
Colors
.
white
.
withOpacity
(
0.1
),
fontSize:
18
,
fontWeight:
FontWeight
.
w900
,
),
),
),
),
);
}
}
class
_PointSelectTextButton
extends
StatelessWidget
{
final
bool
isSelect
;
final
String
title
;
final
String
money
;
final
MainAxisAlignment
?
alignment
;
final
TextStyle
?
moneyTextStyle
;
final
Function
?
onTap
;
const
_PointSelectTextButton
(
this
.
isSelect
,
this
.
title
,
{
Key
?
key
,
this
.
onTap
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Expanded
(
child:
MergeSemantics
(
child:
Column
(
mainAxisAlignment:
alignment
??
MainAxisAlignment
.
center
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
/// 横向撑开Column,扩大语义区域
const
SizedBox
(
width:
double
.
infinity
),
Text
(
title
,
style:
const
TextStyle
(
color:
Colours
.
text_disabled
,
fontSize:
Dimens
.
font_sp12
)),
Gaps
.
vGap8
,
RiseNumberText
(
NumUtil
.
getDoubleByValueStr
(
money
)
??
0
,
style:
moneyTextStyle
??
const
TextStyle
(
color:
Colours
.
text_disabled
,
fontSize:
Dimens
.
font_sp14
,
fontWeight:
FontWeight
.
bold
,
fontFamily:
'RobotoThin'
isSelect
?
Container
(
width:
6
,
height:
6
,
decoration:
BoxDecoration
(
color:
ColorPlate
.
orange
,
borderRadius:
BorderRadius
.
circular
(
3
),
),
)
:
Container
(),
Container
(
padding:
const
EdgeInsets
.
only
(
left:
2
),
child:
Text
(
title
,
style:
isSelect
?
StandardTextStyle
.
small
:
StandardTextStyle
.
smallWithOpacity
,
),
)
],
),
);
}
}
class
TextGroup
extends
StatelessWidget
{
final
String
title
,
tag
;
final
Color
?
color
;
const
TextGroup
(
this
.
title
,
this
.
tag
,
{
Key
?
key
,
this
.
color
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
0
,
horizontal:
8
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
end
,
children:
<
Widget
>[
Text
(
title
,
style:
StandardTextStyle
.
big
.
apply
(
color:
color
),
),
Container
(
width:
4
),
Text
(
tag
,
style:
StandardTextStyle
.
smallWithOpacity
.
apply
(
color:
color
?.
withOpacity
(
0.6
),
),
),
],
),
);
}
...
...
lib/home/home_page.dart
View file @
2f942fc
import
'package:flutter/material.dart'
;
import
'package:one_poem/account/page/account_page.dart'
;
import
'package:one_poem/goods/page/goods_page.dart'
;
import
'package:one_poem/poem/page/poem_page.dart'
;
import
'package:one_poem/res/resources.dart'
;
...
...
@@ -45,7 +46,7 @@ class _HomeState extends State<Home> with RestorationMixin {
const
PoemPage
(),
const
GoodsPage
(),
const
NotFoundPage
(),
const
Shop
Page
(),
const
Account
Page
(),
];
}
...
...
lib/main.dart
View file @
2f942fc
...
...
@@ -46,13 +46,18 @@ Future<void> main() async {
/// sp初始化
await
SpUtil
.
getInstance
();
WidgetsFlutterBinding
.
ensureInitialized
();
SystemChrome
.
setPreferredOrientations
(
[
DeviceOrientation
.
portraitUp
,
DeviceOrientation
.
portraitDown
]);
/// 1.22 预览功能: 在输入频率与显示刷新率不匹配情况下提供平滑的滚动效果
// GestureBinding.instance?.resamplingEnabled = true;
/// 异常处理
handleError
(()
=>
runApp
(
MyApp
()));
/// 隐藏状态栏。为启动页、引导页设置。完成后修改回显示状态栏。
SystemChrome
.
setEnabledSystemUIMode
(
SystemUiMode
.
manual
,
overlays:
[
SystemUiOverlay
.
bottom
]);
SystemChrome
.
setEnabledSystemUIMode
(
SystemUiMode
.
manual
,
overlays:
[
SystemUiOverlay
.
bottom
]);
// TODO(weilu): 启动体验不佳。状态栏、导航栏在冷启动开始的一瞬间为黑色,且无法通过隐藏、修改颜色等方式进行处理。。。
// 相关问题跟踪:https://github.com/flutter/flutter/issues/73351
}
...
...
@@ -108,10 +113,7 @@ class MyApp extends StatelessWidget {
quickActions
.
setShortcutItems
(<
ShortcutItem
>[
const
ShortcutItem
(
type:
'demo'
,
localizedTitle:
'Demo'
,
icon:
'flutter_dash_black'
),
type:
'demo'
,
localizedTitle:
'Demo'
,
icon:
'flutter_dash_black'
),
]);
}
}
...
...
@@ -124,7 +126,8 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider
(
create:
(
_
)
=>
LocaleProvider
())
],
child:
Consumer2
<
ThemeProvider
,
LocaleProvider
>(
builder:
(
_
,
ThemeProvider
provider
,
LocaleProvider
localeProvider
,
__
)
{
builder:
(
_
,
ThemeProvider
provider
,
LocaleProvider
localeProvider
,
__
)
{
return
_buildMaterialApp
(
provider
,
localeProvider
);
},
),
...
...
@@ -133,14 +136,15 @@ class MyApp extends StatelessWidget {
/// Toast 配置
return
OKToast
(
backgroundColor:
Colors
.
black54
,
textPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
,
vertical:
10.0
),
textPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
,
vertical:
10.0
),
radius:
20.0
,
position:
ToastPosition
.
bottom
,
child:
app
);
child:
app
);
}
Widget
_buildMaterialApp
(
ThemeProvider
provider
,
LocaleProvider
localeProvider
)
{
Widget
_buildMaterialApp
(
ThemeProvider
provider
,
LocaleProvider
localeProvider
)
{
return
MaterialApp
(
title:
'Flutter Deer'
,
// showPerformanceOverlay: true, //显示性能标签
...
...
lib/poem/page/poem_detail.dart
View file @
2f942fc
import
'package:flutter/material.dart'
;
import
'package:one_poem/tiktok/style/style.dart'
;
import
'package:one_poem/widgets/my_app_bar.dart'
;
class
PoemDetailPage
extends
StatefulWidget
{
const
PoemDetailPage
({
Key
?
key
,
this
.
isAccessibilityTest
=
false
,
this
.
onPop
,
required
this
.
poemId
,
})
:
super
(
key
:
key
);
final
bool
isAccessibilityTest
;
final
int
poemId
;
final
Function
?
onPop
;
@override
_PoemDetailPageState
createState
()
=>
_PoemDetailPageState
();
...
...
@@ -17,11 +20,27 @@ class PoemDetailPage extends StatefulWidget {
class
_PoemDetailPageState
extends
State
<
PoemDetailPage
>{
@override
Widget
build
(
BuildContext
context
)
{
return
const
Scaffold
(
appBar:
MyAppBar
(
title:
'一言|译解|临境'
,
return
Scaffold
(
appBar:
const
MyAppBar
(
title:
'一言'
,
),
body:
Container
(
decoration:
const
BoxDecoration
(
gradient:
LinearGradient
(
begin:
Alignment
.
topCenter
,
colors:
<
Color
>[
Colors
.
black
,
Colors
.
black
,
],
),
),
child:
Stack
(
alignment:
Alignment
.
topCenter
,
children:
<
Widget
>[
Text
(
"题 破山寺后禅院"
),
],
),
),
body:
Text
(
"题 破山此后禅院"
),
);
}
}
\ No newline at end of file
...
...
lib/poem/page/poem_page.dart
View file @
2f942fc
...
...
@@ -13,6 +13,8 @@ import 'package:one_poem/tiktok/widgets/tiktok_video_button_column.dart';
import
'package:one_poem/tiktok/widgets/tiktok_video_poem.dart'
;
import
'package:video_player/video_player.dart'
;
import
'poem_detail.dart'
;
class
PoemPage
extends
StatefulWidget
{
const
PoemPage
({
Key
?
key
})
:
super
(
key:
key
);
...
...
@@ -100,12 +102,10 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver {
},
);
var
userPage
=
UserPage
(
isSelfPage:
false
,
canPop:
true
,
onPop:
()
{
var
detailPage
=
PoemDetailPage
(
onPop:
(){
tkController
.
animateToMiddle
();
},
},
poemId:
1
,
);
var
searchPage
=
SearchPage
(
onPop:
tkController
.
animateToMiddle
,
...
...
@@ -116,7 +116,7 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver {
controller:
tkController
,
header:
header
,
leftPage:
searchPage
,
rightPage:
user
Page
,
rightPage:
detail
Page
,
enableGesture:
true
,
page:
Stack
(
children:
<
Widget
>[
...
...
lib/poem/poem_router.dart
View file @
2f942fc
import
'package:fluro/fluro.dart'
;
import
'package:one_poem/routers/i_router.dart'
;
import
'page/poem_detail.dart'
;
import
'page/poem_page.dart'
;
class
PoemRouter
implements
IRouterProvider
{
static
String
poemPage
=
'/poem'
;
static
String
poemDetail
=
'/poem/detail'
;
@override
void
initRouter
(
FluroRouter
router
)
{
router
.
define
(
poemPage
,
handler:
Handler
(
handlerFunc:
(
_
,
__
)
=>
const
PoemPage
()));
router
.
define
(
poemDetail
,
handler:
Handler
(
handlerFunc:
(
_
,
__
)
=>
const
PoemDetailPage
()));
}
}
...
...
lib/tiktok/pages/user_page.dart
View file @
2f942fc
...
...
@@ -13,7 +13,7 @@ class UserPage extends StatefulWidget {
Key
?
key
,
this
.
canPop
=
false
,
this
.
onPop
,
required
this
.
isSelfPag
e
,
this
.
isSelfPage
=
fals
e
,
this
.
onSwitch
,
})
:
super
(
key:
key
);
...
...
Please
register
or
login
to post a comment