Showing
4 changed files
with
230 additions
and
4 deletions
assets/images/common/jt.png
0 → 100644

158 Bytes
... | @@ -2,6 +2,7 @@ import 'dart:ui'; | ... | @@ -2,6 +2,7 @@ import 'dart:ui'; |
2 | 2 | ||
3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
4 | import 'package:one_poem/poem/widgets/poem_content.dart'; | 4 | import 'package:one_poem/poem/widgets/poem_content.dart'; |
5 | +import 'package:one_poem/poem/widgets/poem_more_menu.dart'; | ||
5 | import 'package:one_poem/poem/widgets/poem_user_audio.dart'; | 6 | import 'package:one_poem/poem/widgets/poem_user_audio.dart'; |
6 | import 'package:one_poem/poem/widgets/poem_user_comments.dart'; | 7 | import 'package:one_poem/poem/widgets/poem_user_comments.dart'; |
7 | import 'package:one_poem/res/gaps.dart'; | 8 | import 'package:one_poem/res/gaps.dart'; |
... | @@ -40,6 +41,19 @@ class PoemDetailPage extends StatefulWidget { | ... | @@ -40,6 +41,19 @@ class PoemDetailPage extends StatefulWidget { |
40 | class _PoemDetailPageState extends State<PoemDetailPage> { | 41 | class _PoemDetailPageState extends State<PoemDetailPage> { |
41 | PoemContentSwitch contentSwitch = PoemContentSwitch.audio; | 42 | PoemContentSwitch contentSwitch = PoemContentSwitch.audio; |
42 | final GlobalKey _hintKey = GlobalKey(); | 43 | final GlobalKey _hintKey = GlobalKey(); |
44 | + final GlobalKey _moreKey = GlobalKey(); | ||
45 | + | ||
46 | + void _showMoreMenu() { | ||
47 | + final RenderBox button = | ||
48 | + _moreKey.currentContext!.findRenderObject()! as RenderBox; | ||
49 | + showPopupWindow<void>( | ||
50 | + context: context, | ||
51 | + isShowBg: true, | ||
52 | + offset: Offset(button.size.width - 8.0, -12.0), | ||
53 | + anchor: button, | ||
54 | + child: const PoemMoreMenu(), | ||
55 | + ); | ||
56 | + } | ||
43 | 57 | ||
44 | void _showHint() { | 58 | void _showHint() { |
45 | final RenderBox hint = | 59 | final RenderBox hint = |
... | @@ -101,10 +115,51 @@ class _PoemDetailPageState extends State<PoemDetailPage> { | ... | @@ -101,10 +115,51 @@ class _PoemDetailPageState extends State<PoemDetailPage> { |
101 | ); | 115 | ); |
102 | }, | 116 | }, |
103 | ), | 117 | ), |
104 | - homeActionWidgets: HomeActionWidgets( | 118 | + homeActionWidgets: Row( |
105 | - funcStar: () { | 119 | + mainAxisSize: MainAxisSize.min, |
106 | - print("starrrrrrr"); | 120 | + mainAxisAlignment: MainAxisAlignment.center, |
107 | - }, | 121 | + children: [ |
122 | + SizedBox( | ||
123 | + height: 30, | ||
124 | + width: 30, | ||
125 | + child: IconButton( | ||
126 | + padding: const EdgeInsets.all(0.0), | ||
127 | + icon: const Icon( | ||
128 | + Icons.star_border, | ||
129 | + size: 20, | ||
130 | + color: Colors.white, | ||
131 | + ), | ||
132 | + onPressed: () {}, | ||
133 | + ), | ||
134 | + ), | ||
135 | + SizedBox( | ||
136 | + height: 30, | ||
137 | + width: 30, | ||
138 | + child: IconButton( | ||
139 | + padding: const EdgeInsets.all(0.0), | ||
140 | + icon: const Icon( | ||
141 | + Icons.ios_share, | ||
142 | + size: 20, | ||
143 | + color: Colors.white, | ||
144 | + ), | ||
145 | + onPressed: () {}, | ||
146 | + ), | ||
147 | + ), | ||
148 | + SizedBox( | ||
149 | + height: 30, | ||
150 | + width: 30, | ||
151 | + child: IconButton( | ||
152 | + key: _moreKey, | ||
153 | + padding: const EdgeInsets.all(0.0), | ||
154 | + onPressed: _showMoreMenu, | ||
155 | + icon: const Icon( | ||
156 | + Icons.more_horiz, | ||
157 | + size: 20, | ||
158 | + color: Colors.white, | ||
159 | + ), | ||
160 | + ), | ||
161 | + ), | ||
162 | + ], | ||
108 | ), | 163 | ), |
109 | ), | 164 | ), |
110 | body: Container( | 165 | body: Container( | ... | ... |
lib/poem/widgets/poem_more_menu.dart
0 → 100644
1 | +import 'package:flutter/material.dart'; | ||
2 | +import 'package:one_poem/res/resources.dart'; | ||
3 | +import 'package:one_poem/util/theme_utils.dart'; | ||
4 | +import 'package:one_poem/widgets/load_image.dart'; | ||
5 | + | ||
6 | +class PoemMoreMenu extends StatefulWidget { | ||
7 | + const PoemMoreMenu({ | ||
8 | + Key? key, | ||
9 | + }) : super(key: key); | ||
10 | + | ||
11 | + @override | ||
12 | + _PoemMoreMenuState createState() => _PoemMoreMenuState(); | ||
13 | +} | ||
14 | + | ||
15 | +class _PoemMoreMenuState extends State<PoemMoreMenu> | ||
16 | + with SingleTickerProviderStateMixin { | ||
17 | + late AnimationController _controller; | ||
18 | + late Animation<double> _scaleAnimation; | ||
19 | + | ||
20 | + @override | ||
21 | + void initState() { | ||
22 | + super.initState(); | ||
23 | + _controller = AnimationController( | ||
24 | + duration: const Duration(milliseconds: 200), | ||
25 | + vsync: this, | ||
26 | + ); | ||
27 | + | ||
28 | + _scaleAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(_controller); | ||
29 | + _controller.forward(); | ||
30 | + } | ||
31 | + | ||
32 | + @override | ||
33 | + void dispose() { | ||
34 | + _controller.dispose(); | ||
35 | + super.dispose(); | ||
36 | + } | ||
37 | + | ||
38 | + @override | ||
39 | + Widget build(BuildContext context) { | ||
40 | + final Color backgroundColor = context.backgroundColor; | ||
41 | + final Color? iconColor = ThemeUtils.getIconColor(context); | ||
42 | + | ||
43 | + final Widget body = Column( | ||
44 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
45 | + children: <Widget>[ | ||
46 | + Padding( | ||
47 | + padding: const EdgeInsets.only(right: 12.0), | ||
48 | + child: LoadAssetImage( | ||
49 | + 'common/jt', | ||
50 | + width: 8.0, | ||
51 | + height: 4.0, | ||
52 | + color: ThemeUtils.getDarkColor(context, Colours.dark_bg_color), | ||
53 | + ), | ||
54 | + ), | ||
55 | + SizedBox( | ||
56 | + width: 120.0, | ||
57 | + height: 60.0, | ||
58 | + child: TextButton.icon( | ||
59 | + onPressed: () {}, | ||
60 | + icon: IconButton( | ||
61 | + icon: const Icon( | ||
62 | + Icons.mic_none_outlined, | ||
63 | + size: 16.0, | ||
64 | + ), | ||
65 | + color: iconColor, | ||
66 | + onPressed: () {}, | ||
67 | + ), | ||
68 | + label: const Text('录音'), | ||
69 | + style: TextButton.styleFrom( | ||
70 | + primary: Theme.of(context).textTheme.bodyText2?.color, | ||
71 | + onSurface: Theme.of(context) | ||
72 | + .textTheme | ||
73 | + .bodyText2 | ||
74 | + ?.color | ||
75 | + ?.withOpacity(0.12), | ||
76 | + backgroundColor: backgroundColor, | ||
77 | + shape: const RoundedRectangleBorder( | ||
78 | + borderRadius: BorderRadius.only( | ||
79 | + topLeft: Radius.circular(8.0), | ||
80 | + topRight: Radius.circular(8.0), | ||
81 | + ), | ||
82 | + ), | ||
83 | + ), | ||
84 | + ), | ||
85 | + ), | ||
86 | + Container( | ||
87 | + width: 120.0, | ||
88 | + height: 0.6, | ||
89 | + color: Colours.line, | ||
90 | + ), | ||
91 | + SizedBox( | ||
92 | + width: 120.0, | ||
93 | + height: 60.0, | ||
94 | + child: TextButton.icon( | ||
95 | + onPressed: () {}, | ||
96 | + icon: IconButton( | ||
97 | + icon: const Icon( | ||
98 | + Icons.camera_alt_outlined, | ||
99 | + size: 16.0, | ||
100 | + ), | ||
101 | + color: iconColor, | ||
102 | + onPressed: () {}, | ||
103 | + ), | ||
104 | + label: const Text('拍摄'), | ||
105 | + style: TextButton.styleFrom( | ||
106 | + primary: Theme.of(context).textTheme.bodyText2?.color, | ||
107 | + onSurface: Theme.of(context) | ||
108 | + .textTheme | ||
109 | + .bodyText2 | ||
110 | + ?.color | ||
111 | + ?.withOpacity(0.12), | ||
112 | + backgroundColor: backgroundColor, | ||
113 | + shape: const RoundedRectangleBorder( | ||
114 | + borderRadius: BorderRadius.zero, | ||
115 | + ), | ||
116 | + ), | ||
117 | + ), | ||
118 | + ), | ||
119 | + Container( | ||
120 | + width: 120.0, | ||
121 | + height: 0.6, | ||
122 | + color: Colours.line, | ||
123 | + ), | ||
124 | + SizedBox( | ||
125 | + width: 120.0, | ||
126 | + height: 60.0, | ||
127 | + child: TextButton.icon( | ||
128 | + onPressed: () {}, | ||
129 | + icon: IconButton( | ||
130 | + icon: const Icon( | ||
131 | + Icons.delete_forever_outlined, | ||
132 | + size: 16.0, | ||
133 | + ), | ||
134 | + color: iconColor, | ||
135 | + onPressed: () {}, | ||
136 | + ), | ||
137 | + label: const Text('删除'), | ||
138 | + style: TextButton.styleFrom( | ||
139 | + primary: Theme.of(context).textTheme.bodyText2?.color, | ||
140 | + onSurface: Theme.of(context) | ||
141 | + .textTheme | ||
142 | + .bodyText2 | ||
143 | + ?.color | ||
144 | + ?.withOpacity(0.12), | ||
145 | + backgroundColor: backgroundColor, | ||
146 | + shape: const RoundedRectangleBorder( | ||
147 | + borderRadius: BorderRadius.only( | ||
148 | + bottomLeft: Radius.circular(8.0), | ||
149 | + bottomRight: Radius.circular(8.0), | ||
150 | + ), | ||
151 | + ), | ||
152 | + ), | ||
153 | + ), | ||
154 | + ), | ||
155 | + ], | ||
156 | + ); | ||
157 | + | ||
158 | + return AnimatedBuilder( | ||
159 | + animation: _scaleAnimation, | ||
160 | + builder: (_, child) { | ||
161 | + return Transform.scale( | ||
162 | + scale: _scaleAnimation.value, | ||
163 | + alignment: Alignment.topRight, | ||
164 | + child: child, | ||
165 | + ); | ||
166 | + }, | ||
167 | + child: body, | ||
168 | + ); | ||
169 | + } | ||
170 | +} |
... | @@ -177,6 +177,7 @@ flutter: | ... | @@ -177,6 +177,7 @@ flutter: |
177 | # see https://flutter.dev/custom-fonts/#from-packages | 177 | # see https://flutter.dev/custom-fonts/#from-packages |
178 | assets: | 178 | assets: |
179 | - assets/images/ | 179 | - assets/images/ |
180 | + - assets/images/common/ | ||
180 | - assets/images/login/ | 181 | - assets/images/login/ |
181 | - assets/images/state/ | 182 | - assets/images/state/ |
182 | - assets/images/poem/ | 183 | - assets/images/poem/ | ... | ... |
-
Please register or login to post a comment