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-01 00:31:01 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2d58333495f24fea03560315951d15e818976b80
2d583334
1 parent
8a77d10b
pass params
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
112 additions
and
160 deletions
lib/category/page/categories_page.dart
lib/category/page/category_list_page.dart
lib/category/widgets/category_item.dart
lib/main.dart
lib/poem/page/poem_detail.dart
lib/poem/poem_router.dart
lib/tiktok/widgets/tiktok_top_info.dart
lib/tiktok/widgets/tiktok_video_poem.dart
lib/widgets/bars/home_title_bar.dart → lib/widgets/bars/home_menu_bar.dart
lib/widgets/my_app_bar.dart
pubspec.yaml
lib/category/page/categories_page.dart
View file @
2d58333
...
...
@@ -43,7 +43,22 @@ class _CategoriesPageState extends State<CategoriesPage>
return
ChangeNotifierProvider
<
CategoriesPageProvider
>(
create:
(
_
)
=>
provider
,
child:
Scaffold
(
appBar:
MyAppBar
(
appBar:
MyAppBar
(
homeMenuHeader:
Container
(
alignment:
Alignment
.
center
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
),
child:
const
Text
(
"众妙"
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
homeActionWidgets:
IconButton
(
icon:
const
Icon
(
Icons
.
search
,
color:
Colors
.
white
,
),
onPressed:
()
{},
),
),
body:
Column
(
key:
_bodyKey
,
...
...
lib/category/page/category_list_page.dart
View file @
2d58333
...
...
@@ -22,7 +22,7 @@ class CategoryListPage extends StatefulWidget {
class
_CategoryListPageState
extends
State
<
CategoryListPage
>
with
AutomaticKeepAliveClientMixin
<
CategoryListPage
>,
SingleTickerProviderStateMixin
{
int
_selectIndex
=
-
1
;
final
int
_selectIndex
=
-
1
;
late
Animation
<
double
>
_animation
;
late
AnimationController
_controller
;
List
<
CategoryItemEntity
>
_list
=
[];
...
...
@@ -105,45 +105,10 @@ class _CategoryListPageState extends State<CategoryListPage> with AutomaticKeepA
loadMore:
_loadMore
,
hasMore:
_page
<
_maxPage
,
itemBuilder:
(
_
,
index
)
{
final
String
heroTag
=
'goodsImg
${widget.index}
-
$index
'
;
return
CategoryItem
(
index:
index
,
heroTag:
heroTag
,
selectIndex:
_selectIndex
,
item:
_list
[
index
],
animation:
_animation
,
onTapMenu:
()
{
/// 点击其他item时,重置状态
if
(
_selectIndex
!=
index
)
{
_animationStatus
=
AnimationStatus
.
dismissed
;
}
/// 避免动画中重复执行
if
(
_animationStatus
==
AnimationStatus
.
dismissed
)
{
// 开始执行动画
_controller
.
forward
(
from:
0.0
);
}
setState
(()
{
_selectIndex
=
index
;
});
},
onTapMenuClose:
()
{
if
(
_animationStatus
==
AnimationStatus
.
completed
)
{
_controller
.
reverse
(
from:
1.1
);
}
_selectIndex
=
-
1
;
},
onTapEdit:
()
{
setState
(()
{
_selectIndex
=
-
1
;
});
},
onTapOperation:
()
{
},
onTapDelete:
()
{
_controller
.
reverse
(
from:
1.1
);
_selectIndex
=
-
1
;
},
);
}
);
...
...
lib/category/widgets/category_item.dart
View file @
2d58333
import
'package:common_utils/common_utils.dart'
;
import
'dart:ui'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:one_poem/category/models/category_item_entity.dart'
;
import
'package:one_poem/poem/poem_router.dart'
;
import
'package:one_poem/res/gaps.dart'
;
import
'package:one_poem/res/resources.dart'
;
import
'package:one_poem/util/device_utils.dart'
;
import
'package:one_poem/util/other_utils.dart'
;
import
'package:one_poem/widgets/load_image.dart'
;
import
'package:one_poem/routers/fluro_navigator.dart'
;
import
'package:one_poem/setting/setting_router.dart'
;
class
CategoryItem
extends
StatelessWidget
{
const
CategoryItem
({
...
...
@@ -14,117 +15,84 @@ class CategoryItem extends StatelessWidget {
required
this
.
item
,
required
this
.
index
,
required
this
.
selectIndex
,
required
this
.
onTapMenu
,
required
this
.
onTapEdit
,
required
this
.
onTapOperation
,
required
this
.
onTapDelete
,
required
this
.
onTapMenuClose
,
required
this
.
animation
,
required
this
.
heroTag
,
})
:
super
(
key:
key
);
final
CategoryItemEntity
item
;
final
int
index
;
final
int
selectIndex
;
final
VoidCallback
onTapMenu
;
final
VoidCallback
onTapEdit
;
final
VoidCallback
onTapOperation
;
final
VoidCallback
onTapDelete
;
final
VoidCallback
onTapMenuClose
;
final
Animation
<
double
>
animation
;
final
String
heroTag
;
@override
Widget
build
(
BuildContext
context
)
{
return
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
10.0
,
top:
10.0
,
right:
10.0
),
child:
DecoratedBox
(
return
InkWell
(
onTap:
()
{
NavigatorUtils
.
push
(
context
,
'
${PoemRouter.poemDetailPage}
?id=100'
);
},
child:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
vertical:
5.0
,
horizontal:
10.0
),
width:
double
.
infinity
,
decoration:
BoxDecoration
(
image:
const
DecorationImage
(
image:
AssetImage
(
"assets/images/category/category_item_bg.png"
),
fit:
BoxFit
.
fill
,
),
color:
Colors
.
grey
.
shade200
.
withOpacity
(
0.1
),
border:
Border
.
all
(
color:
Colors
.
grey
,
width:
0.5
),
// 边色与边宽度
borderRadius:
BorderRadius
.
circular
(
2.0
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisSize:
MainAxisSize
.
max
,
//交叉轴的布局方式,对于column来说就是水平方向的布局方式
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
const
Text
(
"此地"
),
// Icon(
// Icons.query_builder_outlined,
// size: 15.0,
// ),
Wrap
(
crossAxisAlignment:
WrapCrossAlignment
.
center
,
children:
const
[
Icon
(
Icons
.
room_outlined
,
size:
15.0
,
),
Text
(
"北京 海淀 万泉庄"
,
maxLines:
3
,
),
],
),
const
Text
(
"京"
,
style:
TextStyle
(
fontSize:
30
)),
],
child:
ClipRect
(
child:
BackdropFilter
(
filter:
ImageFilter
.
blur
(
sigmaX:
10.0
,
sigmaY:
10.0
,
),
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
grey
.
shade200
.
withOpacity
(
0.1
),
),
Gaps
.
vGap16
,
const
Text
(
"前不见古人,后不见来者。
\n
念天地之悠悠,独怆然而涕下。
\n
"
,
style:
TextStyle
(
fontSize:
22.0
,
fontFamily:
"ZCOOLXiaoWei"
),
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisSize:
MainAxisSize
.
max
,
//交叉轴的布局方式,对于column来说就是水平方向的布局方式
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
const
Text
(
"此地"
),
// Icon(
// Icons.query_builder_outlined,
// size: 15.0,
// ),
Wrap
(
crossAxisAlignment:
WrapCrossAlignment
.
center
,
children:
const
[
Icon
(
Icons
.
room_outlined
,
size:
15.0
,
),
Text
(
"北京 海淀 万泉庄"
,
maxLines:
3
,
),
],
),
const
Text
(
"京"
,
style:
TextStyle
(
fontSize:
30
)),
],
),
Gaps
.
vGap16
,
const
Text
(
"前不见古人,后不见来者。
\n
念天地之悠悠,独怆然而涕下。
\n
"
,
style:
TextStyle
(
fontSize:
22.0
,
fontFamily:
"ZCOOLXiaoWei"
),
),
const
Text
(
"[唐] 陈子昂《登幽州台歌》"
,
maxLines:
1
,
),
],
),
),
const
Text
(
"[唐] 陈子昂《登幽州台歌》"
,
maxLines:
1
,
),
],
),
),
),
),
);
}
}
class
_GoodsItemTag
extends
StatelessWidget
{
const
_GoodsItemTag
({
Key
?
key
,
required
this
.
color
,
required
this
.
text
,
})
:
super
(
key:
key
);
final
Color
?
color
;
final
String
text
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
4.0
),
margin:
const
EdgeInsets
.
only
(
right:
4.0
),
decoration:
BoxDecoration
(
color:
color
,
borderRadius:
BorderRadius
.
circular
(
2.0
),
),
height:
16.0
,
alignment:
Alignment
.
center
,
child:
Text
(
text
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
Dimens
.
font_sp10
,
height:
Device
.
isAndroid
?
1.1
:
null
,
),
),
);
}
}
...
...
lib/main.dart
View file @
2d58333
...
...
@@ -146,7 +146,7 @@ class MyApp extends StatelessWidget {
Widget
_buildMaterialApp
(
ThemeProvider
provider
,
LocaleProvider
localeProvider
)
{
return
MaterialApp
(
title:
'
Flutter Deer
'
,
title:
'
一言
'
,
// showPerformanceOverlay: true, //显示性能标签
// debugShowCheckedModeBanner: false, // 去除右上角debug的标签
// checkerboardRasterCacheImages: true,
...
...
lib/poem/page/poem_detail.dart
View file @
2d58333
...
...
@@ -3,11 +3,8 @@ import 'dart:ui';
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:one_poem/res/gaps.dart'
;
import
'package:one_poem/util/theme_utils.dart'
;
import
'package:one_poem/util/toast_utils.dart'
;
import
'package:one_poem/widgets/bars/home_action_bar.dart'
;
import
'package:one_poem/widgets/bars/home_title_bar.dart'
;
import
'package:one_poem/widgets/load_image.dart'
;
import
'package:one_poem/widgets/bars/home_menu_bar.dart'
;
import
'package:one_poem/widgets/my_app_bar.dart'
;
class
PoemDetailPage
extends
StatefulWidget
{
...
...
@@ -29,10 +26,11 @@ class _PoemDetailPageState extends State<PoemDetailPage> {
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
MyAppBar
(
isBack:
true
,
isTransparent:
false
,
home
TitleHeader:
HomeTitle
Header
(
home
MenuHeader:
HomeMenu
Header
(
funcLeft:
()
{
print
(
"lefltlelfle
"
);
print
(
"lefltlelfle
poem id="
+
widget
.
poemId
.
toString
()
);
},
),
homeActionWidgets:
HomeActionWidgets
(
...
...
@@ -60,8 +58,8 @@ class _PoemDetailPageState extends State<PoemDetailPage> {
width:
double
.
infinity
,
decoration:
BoxDecoration
(
color:
Colors
.
grey
.
shade200
.
withOpacity
(
0.1
),
border:
Border
.
all
(
color:
Colors
.
grey
,
width:
0.1
),
// 边色与边宽度
borderRadius:
BorderRadius
.
circular
(
2.0
),
border:
Border
.
all
(
color:
Colors
.
grey
.
shade50
,
width:
0.5
),
// 边色与边宽度
//
borderRadius: BorderRadius.circular(2.0),
),
child:
ClipRect
(
child:
BackdropFilter
(
...
...
lib/poem/poem_router.dart
View file @
2d58333
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
{
class
PoemRouter
implements
IRouterProvider
{
static
String
poemPage
=
'/poem'
;
static
String
poemDetailPage
=
'/detail'
;
@override
void
initRouter
(
FluroRouter
router
)
{
router
.
define
(
poemPage
,
handler:
Handler
(
handlerFunc:
(
_
,
__
)
=>
const
PoemPage
()));
router
.
define
(
poemPage
,
handler:
Handler
(
handlerFunc:
(
_
,
__
)
=>
const
PoemPage
()));
router
.
define
(
poemDetailPage
,
handler:
Handler
(
handlerFunc:
(
_
,
Map
<
String
,
List
<
String
>>
params
)
{
String
?
id
=
params
[
'id'
]?.
first
;
return
PoemDetailPage
(
poemId:
int
.
parse
(
id
!),
);
}));
}
}
...
...
lib/tiktok/widgets/tiktok_top_info.dart
View file @
2d58333
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:one_poem/res/resources.dart'
;
import
'package:one_poem/tiktok/style/style.dart'
;
class
TikTokTopInfoColumn
extends
StatelessWidget
{
final
double
?
bottomPadding
;
...
...
@@ -23,7 +21,7 @@ class TikTokTopInfoColumn extends StatelessWidget {
decoration:
BoxDecoration
(
color:
Colors
.
grey
.
shade200
.
withOpacity
(
0.1
),
border:
Border
.
all
(
color:
Colors
.
grey
,
width:
0.1
),
// 边色与边宽度
borderRadius:
BorderRadius
.
circular
(
2.0
),
//
borderRadius: BorderRadius.circular(2.0),
),
child:
ClipRect
(
child:
BackdropFilter
(
...
...
lib/tiktok/widgets/tiktok_video_poem.dart
View file @
2d58333
...
...
@@ -25,7 +25,7 @@ class TikTokVidePoem extends StatelessWidget {
decoration:
BoxDecoration
(
color:
Colors
.
grey
.
shade200
.
withOpacity
(
0.1
),
border:
Border
.
all
(
color:
Colors
.
grey
,
width:
0.1
),
// 边色与边宽度
borderRadius:
BorderRadius
.
circular
(
2.0
),
//
borderRadius: BorderRadius.circular(2.0),
),
height:
220.0
,
width:
double
.
infinity
,
...
...
lib/widgets/bars/home_
title
_bar.dart
→
lib/widgets/bars/home_
menu
_bar.dart
View file @
2d58333
import
'package:flutter/material.dart'
;
class
Home
Title
Header
extends
StatelessWidget
{
const
Home
Title
Header
({
class
Home
Menu
Header
extends
StatelessWidget
{
const
Home
Menu
Header
({
Key
?
key
,
this
.
funcLeft
,
this
.
funcCenter
,
...
...
lib/widgets/my_app_bar.dart
View file @
2d58333
...
...
@@ -10,7 +10,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
this
.
backgroundColor
,
this
.
onPressed
,
this
.
isBack
=
true
,
this
.
home
Title
Header
,
this
.
home
Menu
Header
,
this
.
homeActionWidgets
,
this
.
isTransparent
=
false
,
})
:
super
(
key:
key
);
...
...
@@ -20,7 +20,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
final
bool
isBack
;
final
bool
isTransparent
;
final
Widget
?
home
Title
Header
;
final
Widget
?
home
Menu
Header
;
final
Widget
?
homeActionWidgets
;
@override
...
...
@@ -44,7 +44,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
},
tooltip:
'返回'
,
padding:
const
EdgeInsets
.
all
(
12.0
),
icon:
const
Icon
(
Icons
.
arrow_back_ios_outlined
),
icon:
const
Icon
(
Icons
.
arrow_back_ios_outlined
,
color:
Colors
.
white
,
),
)
:
Gaps
.
empty
;
...
...
@@ -62,7 +62,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
),
SizedBox
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
child:
home
Title
Header
,
child:
home
Menu
Header
,
),
SizedBox
(
child:
Container
(
...
...
pubspec.yaml
View file @
2d58333
...
...
@@ -68,7 +68,7 @@ dependencies:
# 格式化String https://github.com/Naddiseo/dart-sprintf
sprintf
:
^6.0.0
# 状态管理 https://github.com/rrousselGit/provider
provider
:
^6.0.
1
provider
:
^6.0.
2
# 扫码 https://github.com/juliuscanute/qr_code_scanner
qr_code_scanner
:
0.6.1
# App Shortcuts https://github.com/flutter/plugins/tree/master/packages/quick_actions
...
...
Please
register
or
login
to post a comment