Showing
4 changed files
with
74 additions
and
55 deletions
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | import 'package:one_poem/routers/fluro_navigator.dart'; | 2 | import 'package:one_poem/routers/fluro_navigator.dart'; |
3 | +import 'package:one_poem/setting/setting_router.dart'; | ||
3 | import 'package:one_poem/tiktok/style/style.dart'; | 4 | import 'package:one_poem/tiktok/style/style.dart'; |
4 | import 'package:tapped/tapped.dart'; | 5 | import 'package:tapped/tapped.dart'; |
5 | import 'package:flutter_gen/gen_l10n/one_poem_localizations.dart'; | 6 | import 'package:flutter_gen/gen_l10n/one_poem_localizations.dart'; |
... | @@ -82,8 +83,6 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -82,8 +83,6 @@ class _AccountPageState extends State<AccountPage> { |
82 | parent: AlwaysScrollableScrollPhysics(), | 83 | parent: AlwaysScrollableScrollPhysics(), |
83 | ), | 84 | ), |
84 | children: <Widget>[ | 85 | children: <Widget>[ |
85 | - Container(height: 20.px), | ||
86 | - // 头像与关注 | ||
87 | Stack( | 86 | Stack( |
88 | alignment: Alignment.bottomLeft, | 87 | alignment: Alignment.bottomLeft, |
89 | children: <Widget>[ | 88 | children: <Widget>[ |
... | @@ -187,6 +186,7 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -187,6 +186,7 @@ class _AccountPageState extends State<AccountPage> { |
187 | child: Stack( | 186 | child: Stack( |
188 | alignment: Alignment.topCenter, | 187 | alignment: Alignment.topCenter, |
189 | children: <Widget>[ | 188 | children: <Widget>[ |
189 | + body, | ||
190 | Container( | 190 | Container( |
191 | alignment: Alignment.centerRight, | 191 | alignment: Alignment.centerRight, |
192 | height: 64.px, | 192 | height: 64.px, |
... | @@ -199,12 +199,13 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -199,12 +199,13 @@ class _AccountPageState extends State<AccountPage> { |
199 | Icons.settings_outlined, | 199 | Icons.settings_outlined, |
200 | color: Colors.black54, | 200 | color: Colors.black54, |
201 | ), | 201 | ), |
202 | - onPressed: () {}, | 202 | + onPressed: () { |
203 | + NavigatorUtils.push(context, SettingRouter.settingPage); | ||
204 | + }, | ||
203 | ), | 205 | ), |
204 | ], | 206 | ], |
205 | ), | 207 | ), |
206 | ), | 208 | ), |
207 | - body, | ||
208 | ], | 209 | ], |
209 | ), | 210 | ), |
210 | ), | 211 | ), | ... | ... |
... | @@ -33,7 +33,7 @@ class PoemVoiceWidget extends StatefulWidget { | ... | @@ -33,7 +33,7 @@ class PoemVoiceWidget extends StatefulWidget { |
33 | class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { | 33 | class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { |
34 | // 倒计时总时长 | 34 | // 倒计时总时长 |
35 | final int _countTotal = 12; | 35 | final int _countTotal = 12; |
36 | - double starty = 0.0; | 36 | + double startY = 0.0; |
37 | double offset = 0.0; | 37 | double offset = 0.0; |
38 | bool isUp = false; | 38 | bool isUp = false; |
39 | String textShow = "按住说话"; | 39 | String textShow = "按住说话"; |
... | @@ -69,7 +69,6 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { | ... | @@ -69,7 +69,6 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { |
69 | recordPlugin?.response.listen((data) { | 69 | recordPlugin?.response.listen((data) { |
70 | if (data.msg == "onStop") { | 70 | if (data.msg == "onStop") { |
71 | ///结束录制时会返回录制文件的地址方便上传服务器 | 71 | ///结束录制时会返回录制文件的地址方便上传服务器 |
72 | - // print("onStop " + data.path!); | ||
73 | if (widget.stopRecord != null) { | 72 | if (widget.stopRecord != null) { |
74 | audioFilePath = data.path!; | 73 | audioFilePath = data.path!; |
75 | widget.stopRecord!(data.path, data.audioTimeLength); | 74 | widget.stopRecord!(data.path, data.audioTimeLength); |
... | @@ -104,8 +103,6 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { | ... | @@ -104,8 +103,6 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { |
104 | overlayEntry!.markNeedsBuild(); | 103 | overlayEntry!.markNeedsBuild(); |
105 | } | 104 | } |
106 | }); | 105 | }); |
107 | - | ||
108 | - // print("振幅大小 " + voiceData.toString() + " " + voiceIco); | ||
109 | }); | 106 | }); |
110 | } | 107 | } |
111 | 108 | ||
... | @@ -202,7 +199,7 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { | ... | @@ -202,7 +199,7 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { |
202 | 199 | ||
203 | moveVoiceView() { | 200 | moveVoiceView() { |
204 | setState(() { | 201 | setState(() { |
205 | - isUp = starty - offset > 100 ? true : false; | 202 | + isUp = startY - offset > 100 ? true : false; |
206 | if (isUp) { | 203 | if (isUp) { |
207 | textShow = "松开手指,取消发送"; | 204 | textShow = "松开手指,取消发送"; |
208 | toastShow = textShow; | 205 | toastShow = textShow; |
... | @@ -238,7 +235,7 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { | ... | @@ -238,7 +235,7 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { |
238 | children: [ | 235 | children: [ |
239 | GestureDetector( | 236 | GestureDetector( |
240 | onLongPressStart: (details) { | 237 | onLongPressStart: (details) { |
241 | - starty = details.globalPosition.dy; | 238 | + startY = details.globalPosition.dy; |
242 | _timer = Timer.periodic(const Duration(milliseconds: 1000), (t) { | 239 | _timer = Timer.periodic(const Duration(milliseconds: 1000), (t) { |
243 | _count++; | 240 | _count++; |
244 | if (_count == _countTotal) { | 241 | if (_count == _countTotal) { |
... | @@ -257,10 +254,10 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { | ... | @@ -257,10 +254,10 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> { |
257 | child: Container( | 254 | child: Container( |
258 | height: widget.height ?? 60, | 255 | height: widget.height ?? 60, |
259 | margin: widget.margin ?? const EdgeInsets.fromLTRB(50, 0, 50, 20), | 256 | margin: widget.margin ?? const EdgeInsets.fromLTRB(50, 0, 50, 20), |
260 | - child: const Icon( | 257 | + child: Icon( |
261 | Icons.mic_none, | 258 | Icons.mic_none, |
262 | size: 70.0, | 259 | size: 70.0, |
263 | - color: Colors.green, | 260 | + color: Colors.black45.withOpacity(0.6), |
264 | ), | 261 | ), |
265 | ), | 262 | ), |
266 | ), | 263 | ), | ... | ... |
... | @@ -6,11 +6,11 @@ import 'package:one_poem/res/resources.dart'; | ... | @@ -6,11 +6,11 @@ import 'package:one_poem/res/resources.dart'; |
6 | import 'package:one_poem/routers/fluro_navigator.dart'; | 6 | import 'package:one_poem/routers/fluro_navigator.dart'; |
7 | import 'package:one_poem/util/device_utils.dart'; | 7 | import 'package:one_poem/util/device_utils.dart'; |
8 | import 'package:one_poem/util/other_utils.dart'; | 8 | import 'package:one_poem/util/other_utils.dart'; |
9 | +import 'package:one_poem/util/toast_utils.dart'; | ||
9 | import 'package:one_poem/widgets/click_item.dart'; | 10 | import 'package:one_poem/widgets/click_item.dart'; |
10 | import 'package:one_poem/widgets/my_app_bar.dart'; | 11 | import 'package:one_poem/widgets/my_app_bar.dart'; |
11 | 12 | ||
12 | class AboutPage extends StatefulWidget { | 13 | class AboutPage extends StatefulWidget { |
13 | - | ||
14 | const AboutPage({Key? key}) : super(key: key); | 14 | const AboutPage({Key? key}) : super(key: key); |
15 | 15 | ||
16 | @override | 16 | @override |
... | @@ -18,7 +18,6 @@ class AboutPage extends StatefulWidget { | ... | @@ -18,7 +18,6 @@ class AboutPage extends StatefulWidget { |
18 | } | 18 | } |
19 | 19 | ||
20 | class _AboutPageState extends State<AboutPage> { | 20 | class _AboutPageState extends State<AboutPage> { |
21 | - | ||
22 | final List<FlutterLogoStyle> _styles = <FlutterLogoStyle>[ | 21 | final List<FlutterLogoStyle> _styles = <FlutterLogoStyle>[ |
23 | FlutterLogoStyle.stacked, | 22 | FlutterLogoStyle.stacked, |
24 | FlutterLogoStyle.markOnly, | 23 | FlutterLogoStyle.markOnly, |
... | @@ -26,11 +25,20 @@ class _AboutPageState extends State<AboutPage> { | ... | @@ -26,11 +25,20 @@ class _AboutPageState extends State<AboutPage> { |
26 | ]; | 25 | ]; |
27 | 26 | ||
28 | final List<Cubic> _curves = <Cubic>[ | 27 | final List<Cubic> _curves = <Cubic>[ |
29 | - Curves.ease, Curves.easeIn, Curves.easeInOutCubic, Curves.easeInOut, | 28 | + Curves.ease, |
30 | - Curves.easeInQuad, Curves.easeInCirc, Curves.easeInBack, Curves.easeInOutExpo, | 29 | + Curves.easeIn, |
31 | - Curves.easeInToLinear, Curves.easeOutExpo, Curves.easeInOutSine, Curves.easeOutSine, | 30 | + Curves.easeInOutCubic, |
31 | + Curves.easeInOut, | ||
32 | + Curves.easeInQuad, | ||
33 | + Curves.easeInCirc, | ||
34 | + Curves.easeInBack, | ||
35 | + Curves.easeInOutExpo, | ||
36 | + Curves.easeInToLinear, | ||
37 | + Curves.easeOutExpo, | ||
38 | + Curves.easeInOutSine, | ||
39 | + Curves.easeOutSine, | ||
32 | ]; | 40 | ]; |
33 | - | 41 | + |
34 | // 取随机颜色 | 42 | // 取随机颜色 |
35 | Color _randomColor() { | 43 | Color _randomColor() { |
36 | final int red = Random.secure().nextInt(255); | 44 | final int red = Random.secure().nextInt(255); |
... | @@ -51,9 +59,7 @@ class _AboutPageState extends State<AboutPage> { | ... | @@ -51,9 +59,7 @@ class _AboutPageState extends State<AboutPage> { |
51 | if (!mounted) { | 59 | if (!mounted) { |
52 | return; | 60 | return; |
53 | } | 61 | } |
54 | - setState(() { | 62 | + setState(() {}); |
55 | - | ||
56 | - }); | ||
57 | }); | 63 | }); |
58 | }); | 64 | }); |
59 | } | 65 | } |
... | @@ -64,11 +70,21 @@ class _AboutPageState extends State<AboutPage> { | ... | @@ -64,11 +70,21 @@ class _AboutPageState extends State<AboutPage> { |
64 | _countdownTimer = null; | 70 | _countdownTimer = null; |
65 | super.dispose(); | 71 | super.dispose(); |
66 | } | 72 | } |
67 | - | 73 | + |
68 | @override | 74 | @override |
69 | Widget build(BuildContext context) { | 75 | Widget build(BuildContext context) { |
70 | return Scaffold( | 76 | return Scaffold( |
71 | - appBar: const MyAppBar( | 77 | + appBar: MyAppBar( |
78 | + homeMenuHeader: Container( | ||
79 | + alignment: Alignment.center, | ||
80 | + width: double.infinity, | ||
81 | + child: const Text( | ||
82 | + "关于我们", | ||
83 | + style: TextStyle( | ||
84 | + color: Colors.white, | ||
85 | + ), | ||
86 | + ), | ||
87 | + ), | ||
72 | ), | 88 | ), |
73 | body: Column( | 89 | body: Column( |
74 | children: <Widget>[ | 90 | children: <Widget>[ |
... | @@ -81,13 +97,15 @@ class _AboutPageState extends State<AboutPage> { | ... | @@ -81,13 +97,15 @@ class _AboutPageState extends State<AboutPage> { |
81 | ), | 97 | ), |
82 | Gaps.vGap10, | 98 | Gaps.vGap10, |
83 | ClickItem( | 99 | ClickItem( |
84 | - title: 'Github', | 100 | + title: '项目官网', |
85 | - content: 'Go Star', | 101 | + onTap: () => _launchWebURL('项目官网', 'http://www.mofunsky.com/'), |
86 | - onTap: () => _launchWebURL('Flutter Deer', 'https://github.com/simplezhli/flutter_deer') | ||
87 | ), | 102 | ), |
103 | + Gaps.vGap10, | ||
88 | ClickItem( | 104 | ClickItem( |
89 | - title: '作者博客', | 105 | + title: '自我介绍', |
90 | - onTap: () => _launchWebURL('作者博客', 'https://weilu.blog.csdn.net') | 106 | + onTap: () { |
107 | + Toast.show('我们是一首很有诗意的APP~'); | ||
108 | + }, | ||
91 | ), | 109 | ), |
92 | ], | 110 | ], |
93 | ), | 111 | ), | ... | ... |
... | @@ -11,10 +11,8 @@ import 'package:one_poem/widgets/my_app_bar.dart'; | ... | @@ -11,10 +11,8 @@ import 'package:one_poem/widgets/my_app_bar.dart'; |
11 | 11 | ||
12 | import '../setting_router.dart'; | 12 | import '../setting_router.dart'; |
13 | 13 | ||
14 | - | ||
15 | /// design/8设置/index.html | 14 | /// design/8设置/index.html |
16 | class SettingPage extends StatefulWidget { | 15 | class SettingPage extends StatefulWidget { |
17 | - | ||
18 | const SettingPage({Key? key}) : super(key: key); | 16 | const SettingPage({Key? key}) : super(key: key); |
19 | 17 | ||
20 | @override | 18 | @override |
... | @@ -25,20 +23,32 @@ class _SettingPageState extends State<SettingPage> { | ... | @@ -25,20 +23,32 @@ class _SettingPageState extends State<SettingPage> { |
25 | @override | 23 | @override |
26 | Widget build(BuildContext context) { | 24 | Widget build(BuildContext context) { |
27 | return Scaffold( | 25 | return Scaffold( |
28 | - appBar: const MyAppBar( | 26 | + appBar: MyAppBar( |
27 | + homeMenuHeader: Container( | ||
28 | + alignment: Alignment.center, | ||
29 | + width: double.infinity, | ||
30 | + child: const Text( | ||
31 | + "设置", | ||
32 | + style: TextStyle( | ||
33 | + color: Colors.white, | ||
34 | + ), | ||
35 | + ), | ||
36 | + ), | ||
29 | ), | 37 | ), |
30 | body: Column( | 38 | body: Column( |
31 | children: <Widget>[ | 39 | children: <Widget>[ |
32 | Gaps.vGap5, | 40 | Gaps.vGap5, |
33 | ClickItem( | 41 | ClickItem( |
34 | title: '账号管理', | 42 | title: '账号管理', |
35 | - onTap: () => NavigatorUtils.push(context, SettingRouter.accountManagerPage), | 43 | + onTap: () => |
36 | - ), | 44 | + NavigatorUtils.push(context, SettingRouter.accountManagerPage), |
37 | - if (Device.isMobile) ClickItem( | ||
38 | - title: '清除缓存', | ||
39 | - content: '23.5MB', | ||
40 | - onTap: () {}, | ||
41 | ), | 45 | ), |
46 | + if (Device.isMobile) | ||
47 | + ClickItem( | ||
48 | + title: '清除缓存', | ||
49 | + content: '23.5MB', | ||
50 | + onTap: () {}, | ||
51 | + ), | ||
42 | ClickItem( | 52 | ClickItem( |
43 | title: '夜间模式', | 53 | title: '夜间模式', |
44 | content: _getCurrentTheme(), | 54 | content: _getCurrentTheme(), |
... | @@ -49,10 +59,11 @@ class _SettingPageState extends State<SettingPage> { | ... | @@ -49,10 +59,11 @@ class _SettingPageState extends State<SettingPage> { |
49 | content: _getCurrentLocale(), | 59 | content: _getCurrentLocale(), |
50 | onTap: () => NavigatorUtils.push(context, SettingRouter.localePage), | 60 | onTap: () => NavigatorUtils.push(context, SettingRouter.localePage), |
51 | ), | 61 | ), |
52 | - if (Device.isMobile) ClickItem( | 62 | + if (Device.isMobile) |
53 | - title: '检查更新', | 63 | + ClickItem( |
54 | - onTap: _showUpdateDialog, | 64 | + title: '检查更新', |
55 | - ), | 65 | + onTap: _showUpdateDialog, |
66 | + ), | ||
56 | ClickItem( | 67 | ClickItem( |
57 | title: '关于我们', | 68 | title: '关于我们', |
58 | onTap: () => NavigatorUtils.push(context, SettingRouter.aboutPage), | 69 | onTap: () => NavigatorUtils.push(context, SettingRouter.aboutPage), |
... | @@ -61,10 +72,6 @@ class _SettingPageState extends State<SettingPage> { | ... | @@ -61,10 +72,6 @@ class _SettingPageState extends State<SettingPage> { |
61 | title: '退出当前账号', | 72 | title: '退出当前账号', |
62 | onTap: _showExitDialog, | 73 | onTap: _showExitDialog, |
63 | ), | 74 | ), |
64 | - if (Device.isMobile) ClickItem( | ||
65 | - title: 'Deer Web版', | ||
66 | - onTap: () => NavigatorUtils.goWebViewPage(context, 'Flutter Deer', 'https://simplezhli.github.io/flutter_deer/'), | ||
67 | - ), | ||
68 | ], | 75 | ], |
69 | ), | 76 | ), |
70 | ); | 77 | ); |
... | @@ -73,7 +80,7 @@ class _SettingPageState extends State<SettingPage> { | ... | @@ -73,7 +80,7 @@ class _SettingPageState extends State<SettingPage> { |
73 | String _getCurrentTheme() { | 80 | String _getCurrentTheme() { |
74 | final String? theme = SpUtil.getString(Constant.theme); | 81 | final String? theme = SpUtil.getString(Constant.theme); |
75 | String themeMode; | 82 | String themeMode; |
76 | - switch(theme) { | 83 | + switch (theme) { |
77 | case 'Dark': | 84 | case 'Dark': |
78 | themeMode = '开启'; | 85 | themeMode = '开启'; |
79 | break; | 86 | break; |
... | @@ -90,7 +97,7 @@ class _SettingPageState extends State<SettingPage> { | ... | @@ -90,7 +97,7 @@ class _SettingPageState extends State<SettingPage> { |
90 | String _getCurrentLocale() { | 97 | String _getCurrentLocale() { |
91 | final String? locale = SpUtil.getString(Constant.locale); | 98 | final String? locale = SpUtil.getString(Constant.locale); |
92 | String localeMode; | 99 | String localeMode; |
93 | - switch(locale) { | 100 | + switch (locale) { |
94 | case 'zh': | 101 | case 'zh': |
95 | localeMode = '中文'; | 102 | localeMode = '中文'; |
96 | break; | 103 | break; |
... | @@ -105,17 +112,13 @@ class _SettingPageState extends State<SettingPage> { | ... | @@ -105,17 +112,13 @@ class _SettingPageState extends State<SettingPage> { |
105 | } | 112 | } |
106 | 113 | ||
107 | void _showExitDialog() { | 114 | void _showExitDialog() { |
108 | - showDialog<void>( | 115 | + showDialog<void>(context: context, builder: (_) => const ExitDialog()); |
109 | - context: context, | ||
110 | - builder: (_) => const ExitDialog() | ||
111 | - ); | ||
112 | } | 116 | } |
113 | 117 | ||
114 | void _showUpdateDialog() { | 118 | void _showUpdateDialog() { |
115 | showDialog<void>( | 119 | showDialog<void>( |
116 | - context: context, | 120 | + context: context, |
117 | - barrierDismissible: false, | 121 | + barrierDismissible: false, |
118 | - builder: (_) => const UpdateDialog() | 122 | + builder: (_) => const UpdateDialog()); |
119 | - ); | ||
120 | } | 123 | } |
121 | } | 124 | } | ... | ... |
-
Please register or login to post a comment