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 Pun
2022-01-27 14:59:26 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5e416d92567d4f58a35e4c8f83e80312a51a0384
5e416d92
1 parent
1955e7eb
添加了弹出小菜单
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
230 additions
and
4 deletions
assets/images/common/jt.png
lib/poem/page/poem_detail.dart
lib/poem/widgets/poem_more_menu.dart
pubspec.yaml
assets/images/common/jt.png
0 → 100644
View file @
5e416d9
158 Bytes
lib/poem/page/poem_detail.dart
View file @
5e416d9
...
...
@@ -2,6 +2,7 @@ import 'dart:ui';
import
'package:flutter/material.dart'
;
import
'package:one_poem/poem/widgets/poem_content.dart'
;
import
'package:one_poem/poem/widgets/poem_more_menu.dart'
;
import
'package:one_poem/poem/widgets/poem_user_audio.dart'
;
import
'package:one_poem/poem/widgets/poem_user_comments.dart'
;
import
'package:one_poem/res/gaps.dart'
;
...
...
@@ -40,6 +41,19 @@ class PoemDetailPage extends StatefulWidget {
class
_PoemDetailPageState
extends
State
<
PoemDetailPage
>
{
PoemContentSwitch
contentSwitch
=
PoemContentSwitch
.
audio
;
final
GlobalKey
_hintKey
=
GlobalKey
();
final
GlobalKey
_moreKey
=
GlobalKey
();
void
_showMoreMenu
()
{
final
RenderBox
button
=
_moreKey
.
currentContext
!.
findRenderObject
()!
as
RenderBox
;
showPopupWindow
<
void
>(
context:
context
,
isShowBg:
true
,
offset:
Offset
(
button
.
size
.
width
-
8.0
,
-
12.0
),
anchor:
button
,
child:
const
PoemMoreMenu
(),
);
}
void
_showHint
()
{
final
RenderBox
hint
=
...
...
@@ -101,10 +115,51 @@ class _PoemDetailPageState extends State<PoemDetailPage> {
);
},
),
homeActionWidgets:
HomeActionWidgets
(
funcStar:
()
{
print
(
"starrrrrrr"
);
},
homeActionWidgets:
Row
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
SizedBox
(
height:
30
,
width:
30
,
child:
IconButton
(
padding:
const
EdgeInsets
.
all
(
0.0
),
icon:
const
Icon
(
Icons
.
star_border
,
size:
20
,
color:
Colors
.
white
,
),
onPressed:
()
{},
),
),
SizedBox
(
height:
30
,
width:
30
,
child:
IconButton
(
padding:
const
EdgeInsets
.
all
(
0.0
),
icon:
const
Icon
(
Icons
.
ios_share
,
size:
20
,
color:
Colors
.
white
,
),
onPressed:
()
{},
),
),
SizedBox
(
height:
30
,
width:
30
,
child:
IconButton
(
key:
_moreKey
,
padding:
const
EdgeInsets
.
all
(
0.0
),
onPressed:
_showMoreMenu
,
icon:
const
Icon
(
Icons
.
more_horiz
,
size:
20
,
color:
Colors
.
white
,
),
),
),
],
),
),
body:
Container
(
...
...
lib/poem/widgets/poem_more_menu.dart
0 → 100644
View file @
5e416d9
import
'package:flutter/material.dart'
;
import
'package:one_poem/res/resources.dart'
;
import
'package:one_poem/util/theme_utils.dart'
;
import
'package:one_poem/widgets/load_image.dart'
;
class
PoemMoreMenu
extends
StatefulWidget
{
const
PoemMoreMenu
({
Key
?
key
,
})
:
super
(
key:
key
);
@override
_PoemMoreMenuState
createState
()
=>
_PoemMoreMenuState
();
}
class
_PoemMoreMenuState
extends
State
<
PoemMoreMenu
>
with
SingleTickerProviderStateMixin
{
late
AnimationController
_controller
;
late
Animation
<
double
>
_scaleAnimation
;
@override
void
initState
()
{
super
.
initState
();
_controller
=
AnimationController
(
duration:
const
Duration
(
milliseconds:
200
),
vsync:
this
,
);
_scaleAnimation
=
Tween
<
double
>(
begin:
0.0
,
end:
1.0
).
animate
(
_controller
);
_controller
.
forward
();
}
@override
void
dispose
()
{
_controller
.
dispose
();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
final
Color
backgroundColor
=
context
.
backgroundColor
;
final
Color
?
iconColor
=
ThemeUtils
.
getIconColor
(
context
);
final
Widget
body
=
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
end
,
children:
<
Widget
>[
Padding
(
padding:
const
EdgeInsets
.
only
(
right:
12.0
),
child:
LoadAssetImage
(
'common/jt'
,
width:
8.0
,
height:
4.0
,
color:
ThemeUtils
.
getDarkColor
(
context
,
Colours
.
dark_bg_color
),
),
),
SizedBox
(
width:
120.0
,
height:
60.0
,
child:
TextButton
.
icon
(
onPressed:
()
{},
icon:
IconButton
(
icon:
const
Icon
(
Icons
.
mic_none_outlined
,
size:
16.0
,
),
color:
iconColor
,
onPressed:
()
{},
),
label:
const
Text
(
'录音'
),
style:
TextButton
.
styleFrom
(
primary:
Theme
.
of
(
context
).
textTheme
.
bodyText2
?.
color
,
onSurface:
Theme
.
of
(
context
)
.
textTheme
.
bodyText2
?.
color
?.
withOpacity
(
0.12
),
backgroundColor:
backgroundColor
,
shape:
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
8.0
),
topRight:
Radius
.
circular
(
8.0
),
),
),
),
),
),
Container
(
width:
120.0
,
height:
0.6
,
color:
Colours
.
line
,
),
SizedBox
(
width:
120.0
,
height:
60.0
,
child:
TextButton
.
icon
(
onPressed:
()
{},
icon:
IconButton
(
icon:
const
Icon
(
Icons
.
camera_alt_outlined
,
size:
16.0
,
),
color:
iconColor
,
onPressed:
()
{},
),
label:
const
Text
(
'拍摄'
),
style:
TextButton
.
styleFrom
(
primary:
Theme
.
of
(
context
).
textTheme
.
bodyText2
?.
color
,
onSurface:
Theme
.
of
(
context
)
.
textTheme
.
bodyText2
?.
color
?.
withOpacity
(
0.12
),
backgroundColor:
backgroundColor
,
shape:
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
zero
,
),
),
),
),
Container
(
width:
120.0
,
height:
0.6
,
color:
Colours
.
line
,
),
SizedBox
(
width:
120.0
,
height:
60.0
,
child:
TextButton
.
icon
(
onPressed:
()
{},
icon:
IconButton
(
icon:
const
Icon
(
Icons
.
delete_forever_outlined
,
size:
16.0
,
),
color:
iconColor
,
onPressed:
()
{},
),
label:
const
Text
(
'删除'
),
style:
TextButton
.
styleFrom
(
primary:
Theme
.
of
(
context
).
textTheme
.
bodyText2
?.
color
,
onSurface:
Theme
.
of
(
context
)
.
textTheme
.
bodyText2
?.
color
?.
withOpacity
(
0.12
),
backgroundColor:
backgroundColor
,
shape:
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
only
(
bottomLeft:
Radius
.
circular
(
8.0
),
bottomRight:
Radius
.
circular
(
8.0
),
),
),
),
),
),
],
);
return
AnimatedBuilder
(
animation:
_scaleAnimation
,
builder:
(
_
,
child
)
{
return
Transform
.
scale
(
scale:
_scaleAnimation
.
value
,
alignment:
Alignment
.
topRight
,
child:
child
,
);
},
child:
body
,
);
}
}
pubspec.yaml
View file @
5e416d9
...
...
@@ -177,6 +177,7 @@ flutter:
# see https://flutter.dev/custom-fonts/#from-packages
assets
:
-
assets/images/
-
assets/images/common/
-
assets/images/login/
-
assets/images/state/
-
assets/images/poem/
...
...
Please
register
or
login
to post a comment