Reason Pun

fixed: 录音播放停止按钮状态错误的问题

1 +import 'dart:ui';
2 +
1 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 +import 'package:one_poem/res/resources.dart';
2 import 'package:one_poem/routers/fluro_navigator.dart'; 5 import 'package:one_poem/routers/fluro_navigator.dart';
3 import 'package:one_poem/extension/int_extension.dart'; 6 import 'package:one_poem/extension/int_extension.dart';
7 +import 'package:one_poem/util/toast_utils.dart';
4 8
5 class MembershipPage extends StatefulWidget { 9 class MembershipPage extends StatefulWidget {
6 const MembershipPage({Key? key}) : super(key: key); 10 const MembershipPage({Key? key}) : super(key: key);
...@@ -44,10 +48,113 @@ class _MembershipPageState extends State<MembershipPage> ...@@ -44,10 +48,113 @@ class _MembershipPageState extends State<MembershipPage>
44 ), 48 ),
45 ), 49 ),
46 ), 50 ),
47 - const Text( 51 + const Spacer(),
48 - "这是会员页面", 52 + Container(
49 - style: TextStyle( 53 + margin:
50 - color: Colors.white, 54 + EdgeInsets.symmetric(vertical: 60.px, horizontal: 20.px),
55 + height: MediaQuery.of(context).size.height / 2,
56 + width: double.infinity,
57 + decoration: BoxDecoration(
58 + color: Colors.grey.shade200.withOpacity(0.1),
59 + border: Border.all(
60 + color: Colors.grey.shade50,
61 + width: 0.5,
62 + ), // 边色与边宽度
63 + ),
64 + child: ClipRect(
65 + child: BackdropFilter(
66 + filter: ImageFilter.blur(
67 + sigmaX: 10.0,
68 + sigmaY: 10.0,
69 + ),
70 + child: Container(
71 + decoration: BoxDecoration(
72 + color: Colors.grey.shade200.withOpacity(0.1),
73 + ),
74 + child: Padding(
75 + padding: EdgeInsets.all(10.px),
76 + child: Column(
77 + crossAxisAlignment: CrossAxisAlignment.center,
78 + children: [
79 + Text(
80 + "成为一言会员,将可以享受会员专属临境体验。",
81 + style: TextStyle(
82 + fontSize: 18.px,
83 + color: Colors.white,
84 + ),
85 + ),
86 + Gaps.vGap24,
87 + // TODO 如果会员则显示会员详情
88 + Expanded(
89 + child: ListView.builder(
90 + itemExtent: 48.0,
91 + itemBuilder: (_, index) {
92 + return _buildItem(index);
93 + },
94 + itemCount: 5,
95 + ),
96 + ),
97 + Gaps.vGap24,
98 + Text(
99 + "遇到任何问题,请在微信中关注“一言临境”公众号",
100 + style: TextStyle(
101 + fontSize: 14.px,
102 + color: Colors.white,
103 + ),
104 + ),
105 + Gaps.vGap10,
106 + Row(
107 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
108 + mainAxisSize: MainAxisSize.min,
109 + crossAxisAlignment: CrossAxisAlignment.center,
110 + children: [
111 + TextButton(
112 + onPressed: () {},
113 + child: Text(
114 + "服务协议",
115 + style: TextStyle(
116 + fontSize: 14.px,
117 + color: Colors.white,
118 + ),
119 + ),
120 + ),
121 + Container(
122 + width: 0.6,
123 + height: 15.0,
124 + color: Colours.line,
125 + ),
126 + TextButton(
127 + onPressed: () {},
128 + child: Text(
129 + "隐私政策",
130 + style: TextStyle(
131 + fontSize: 14.px,
132 + color: Colors.white,
133 + ),
134 + ),
135 + ),
136 + Container(
137 + width: 0.6,
138 + height: 15.0,
139 + color: Colours.line,
140 + ),
141 + TextButton(
142 + onPressed: () {},
143 + child: Text(
144 + "恢复购买",
145 + style: TextStyle(
146 + fontSize: 14.px,
147 + color: Colors.white,
148 + ),
149 + ),
150 + ),
151 + ],
152 + ),
153 + ],
154 + ),
155 + ),
156 + ),
157 + ),
51 ), 158 ),
52 ), 159 ),
53 ], 160 ],
...@@ -57,6 +164,45 @@ class _MembershipPageState extends State<MembershipPage> ...@@ -57,6 +164,45 @@ class _MembershipPageState extends State<MembershipPage>
57 ); 164 );
58 } 165 }
59 166
167 + Widget _buildItem(int index) {
168 + return Flex(
169 + direction: Axis.horizontal,
170 + children: [
171 + const Text(
172 + "一个月",
173 + style: TextStyle(
174 + color: Colors.white,
175 + fontSize: 15.0,
176 + ),
177 + ),
178 + Gaps.hGap10,
179 + const Expanded(
180 + flex: 1,
181 + child: Align(
182 + alignment: Alignment.centerRight,
183 + child: Text(
184 + "99¥",
185 + style: TextStyle(
186 + color: Colors.white,
187 + fontSize: 15.0,
188 + ),
189 + ),
190 + ),
191 + ),
192 + Gaps.hGap32,
193 + ElevatedButton(
194 + child: const Text(
195 + "开通",
196 + style: TextStyle(color: Colors.white, fontSize: 15.0),
197 + ),
198 + onPressed: () {
199 + Toast.show("开通啦!");
200 + },
201 + ),
202 + ],
203 + );
204 + }
205 +
60 @override 206 @override
61 void didChangeAppLifecycleState(AppLifecycleState state) {} 207 void didChangeAppLifecycleState(AppLifecycleState state) {}
62 208
......
...@@ -318,7 +318,9 @@ class _AudioToolBarState extends State<AudioToolBar> { ...@@ -318,7 +318,9 @@ class _AudioToolBarState extends State<AudioToolBar> {
318 void stopPlayer() { 318 void stopPlayer() {
319 if (_mPlayerIsInited && _mPlaybackReady && _mRecorder!.isStopped) { 319 if (_mPlayerIsInited && _mPlaybackReady && _mRecorder!.isStopped) {
320 _mPlayer!.stopPlayer().then((value) { 320 _mPlayer!.stopPlayer().then((value) {
321 - setState(() {}); 321 + setState(() {
322 + _mPlayerIsPlaying = false;
323 + });
322 }); 324 });
323 } 325 }
324 } 326 }
......