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-02 20:53:42 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2cb2676fd288b2c6df0a983369e788757523bf26
2cb2676f
1 parent
f376cc1e
增加设置页面
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
44 deletions
lib/account/page/account_page.dart
lib/recorder/widgets/poem_voice_widget.dart
lib/setting/page/about_page.dart
lib/setting/page/setting_page.dart
lib/account/page/account_page.dart
View file @
2cb2676
import
'package:flutter/material.dart'
;
import
'package:one_poem/routers/fluro_navigator.dart'
;
import
'package:one_poem/setting/setting_router.dart'
;
import
'package:one_poem/tiktok/style/style.dart'
;
import
'package:tapped/tapped.dart'
;
import
'package:flutter_gen/gen_l10n/one_poem_localizations.dart'
;
...
...
@@ -82,8 +83,6 @@ class _AccountPageState extends State<AccountPage> {
parent:
AlwaysScrollableScrollPhysics
(),
),
children:
<
Widget
>[
Container
(
height:
20
.
px
),
// 头像与关注
Stack
(
alignment:
Alignment
.
bottomLeft
,
children:
<
Widget
>[
...
...
@@ -187,6 +186,7 @@ class _AccountPageState extends State<AccountPage> {
child:
Stack
(
alignment:
Alignment
.
topCenter
,
children:
<
Widget
>[
body
,
Container
(
alignment:
Alignment
.
centerRight
,
height:
64
.
px
,
...
...
@@ -199,12 +199,13 @@ class _AccountPageState extends State<AccountPage> {
Icons
.
settings_outlined
,
color:
Colors
.
black54
,
),
onPressed:
()
{},
onPressed:
()
{
NavigatorUtils
.
push
(
context
,
SettingRouter
.
settingPage
);
},
),
],
),
),
body
,
],
),
),
...
...
lib/recorder/widgets/poem_voice_widget.dart
View file @
2cb2676
...
...
@@ -33,7 +33,7 @@ class PoemVoiceWidget extends StatefulWidget {
class
_PoemVoiceWidgetState
extends
State
<
PoemVoiceWidget
>
{
// 倒计时总时长
final
int
_countTotal
=
12
;
double
start
y
=
0.0
;
double
start
Y
=
0.0
;
double
offset
=
0.0
;
bool
isUp
=
false
;
String
textShow
=
"按住说话"
;
...
...
@@ -69,7 +69,6 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> {
recordPlugin
?.
response
.
listen
((
data
)
{
if
(
data
.
msg
==
"onStop"
)
{
///结束录制时会返回录制文件的地址方便上传服务器
// print("onStop " + data.path!);
if
(
widget
.
stopRecord
!=
null
)
{
audioFilePath
=
data
.
path
!;
widget
.
stopRecord
!(
data
.
path
,
data
.
audioTimeLength
);
...
...
@@ -104,8 +103,6 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> {
overlayEntry
!.
markNeedsBuild
();
}
});
// print("振幅大小 " + voiceData.toString() + " " + voiceIco);
});
}
...
...
@@ -202,7 +199,7 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> {
moveVoiceView
()
{
setState
(()
{
isUp
=
start
y
-
offset
>
100
?
true
:
false
;
isUp
=
start
Y
-
offset
>
100
?
true
:
false
;
if
(
isUp
)
{
textShow
=
"松开手指,取消发送"
;
toastShow
=
textShow
;
...
...
@@ -238,7 +235,7 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> {
children:
[
GestureDetector
(
onLongPressStart:
(
details
)
{
start
y
=
details
.
globalPosition
.
dy
;
start
Y
=
details
.
globalPosition
.
dy
;
_timer
=
Timer
.
periodic
(
const
Duration
(
milliseconds:
1000
),
(
t
)
{
_count
++;
if
(
_count
==
_countTotal
)
{
...
...
@@ -257,10 +254,10 @@ class _PoemVoiceWidgetState extends State<PoemVoiceWidget> {
child:
Container
(
height:
widget
.
height
??
60
,
margin:
widget
.
margin
??
const
EdgeInsets
.
fromLTRB
(
50
,
0
,
50
,
20
),
child:
const
Icon
(
child:
Icon
(
Icons
.
mic_none
,
size:
70.0
,
color:
Colors
.
green
,
color:
Colors
.
black45
.
withOpacity
(
0.6
)
,
),
),
),
...
...
lib/setting/page/about_page.dart
View file @
2cb2676
...
...
@@ -6,11 +6,11 @@ import 'package:one_poem/res/resources.dart';
import
'package:one_poem/routers/fluro_navigator.dart'
;
import
'package:one_poem/util/device_utils.dart'
;
import
'package:one_poem/util/other_utils.dart'
;
import
'package:one_poem/util/toast_utils.dart'
;
import
'package:one_poem/widgets/click_item.dart'
;
import
'package:one_poem/widgets/my_app_bar.dart'
;
class
AboutPage
extends
StatefulWidget
{
const
AboutPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
...
...
@@ -18,7 +18,6 @@ class AboutPage extends StatefulWidget {
}
class
_AboutPageState
extends
State
<
AboutPage
>
{
final
List
<
FlutterLogoStyle
>
_styles
=
<
FlutterLogoStyle
>[
FlutterLogoStyle
.
stacked
,
FlutterLogoStyle
.
markOnly
,
...
...
@@ -26,9 +25,18 @@ class _AboutPageState extends State<AboutPage> {
];
final
List
<
Cubic
>
_curves
=
<
Cubic
>[
Curves
.
ease
,
Curves
.
easeIn
,
Curves
.
easeInOutCubic
,
Curves
.
easeInOut
,
Curves
.
easeInQuad
,
Curves
.
easeInCirc
,
Curves
.
easeInBack
,
Curves
.
easeInOutExpo
,
Curves
.
easeInToLinear
,
Curves
.
easeOutExpo
,
Curves
.
easeInOutSine
,
Curves
.
easeOutSine
,
Curves
.
ease
,
Curves
.
easeIn
,
Curves
.
easeInOutCubic
,
Curves
.
easeInOut
,
Curves
.
easeInQuad
,
Curves
.
easeInCirc
,
Curves
.
easeInBack
,
Curves
.
easeInOutExpo
,
Curves
.
easeInToLinear
,
Curves
.
easeOutExpo
,
Curves
.
easeInOutSine
,
Curves
.
easeOutSine
,
];
// 取随机颜色
...
...
@@ -51,9 +59,7 @@ class _AboutPageState extends State<AboutPage> {
if
(!
mounted
)
{
return
;
}
setState
(()
{
});
setState
(()
{});
});
});
}
...
...
@@ -68,7 +74,17 @@ class _AboutPageState extends State<AboutPage> {
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
const
MyAppBar
(
appBar:
MyAppBar
(
homeMenuHeader:
Container
(
alignment:
Alignment
.
center
,
width:
double
.
infinity
,
child:
const
Text
(
"关于我们"
,
style:
TextStyle
(
color:
Colors
.
white
,
),
),
),
),
body:
Column
(
children:
<
Widget
>[
...
...
@@ -81,13 +97,15 @@ class _AboutPageState extends State<AboutPage> {
),
Gaps
.
vGap10
,
ClickItem
(
title:
'Github'
,
content:
'Go Star'
,
onTap:
()
=>
_launchWebURL
(
'Flutter Deer'
,
'https://github.com/simplezhli/flutter_deer'
)
title:
'项目官网'
,
onTap:
()
=>
_launchWebURL
(
'项目官网'
,
'http://www.mofunsky.com/'
),
),
Gaps
.
vGap10
,
ClickItem
(
title:
'作者博客'
,
onTap:
()
=>
_launchWebURL
(
'作者博客'
,
'https://weilu.blog.csdn.net'
)
title:
'自我介绍'
,
onTap:
()
{
Toast
.
show
(
'我们是一首很有诗意的APP~'
);
},
),
],
),
...
...
lib/setting/page/setting_page.dart
View file @
2cb2676
...
...
@@ -11,10 +11,8 @@ import 'package:one_poem/widgets/my_app_bar.dart';
import
'../setting_router.dart'
;
/// design/8设置/index.html
class
SettingPage
extends
StatefulWidget
{
const
SettingPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
...
...
@@ -25,16 +23,28 @@ class _SettingPageState extends State<SettingPage> {
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
const
MyAppBar
(
appBar:
MyAppBar
(
homeMenuHeader:
Container
(
alignment:
Alignment
.
center
,
width:
double
.
infinity
,
child:
const
Text
(
"设置"
,
style:
TextStyle
(
color:
Colors
.
white
,
),
),
),
),
body:
Column
(
children:
<
Widget
>[
Gaps
.
vGap5
,
ClickItem
(
title:
'账号管理'
,
onTap:
()
=>
NavigatorUtils
.
push
(
context
,
SettingRouter
.
accountManagerPage
),
onTap:
()
=>
NavigatorUtils
.
push
(
context
,
SettingRouter
.
accountManagerPage
),
),
if
(
Device
.
isMobile
)
ClickItem
(
if
(
Device
.
isMobile
)
ClickItem
(
title:
'清除缓存'
,
content:
'23.5MB'
,
onTap:
()
{},
...
...
@@ -49,7 +59,8 @@ class _SettingPageState extends State<SettingPage> {
content:
_getCurrentLocale
(),
onTap:
()
=>
NavigatorUtils
.
push
(
context
,
SettingRouter
.
localePage
),
),
if
(
Device
.
isMobile
)
ClickItem
(
if
(
Device
.
isMobile
)
ClickItem
(
title:
'检查更新'
,
onTap:
_showUpdateDialog
,
),
...
...
@@ -61,10 +72,6 @@ class _SettingPageState extends State<SettingPage> {
title:
'退出当前账号'
,
onTap:
_showExitDialog
,
),
if
(
Device
.
isMobile
)
ClickItem
(
title:
'Deer Web版'
,
onTap:
()
=>
NavigatorUtils
.
goWebViewPage
(
context
,
'Flutter Deer'
,
'https://simplezhli.github.io/flutter_deer/'
),
),
],
),
);
...
...
@@ -73,7 +80,7 @@ class _SettingPageState extends State<SettingPage> {
String
_getCurrentTheme
()
{
final
String
?
theme
=
SpUtil
.
getString
(
Constant
.
theme
);
String
themeMode
;
switch
(
theme
)
{
switch
(
theme
)
{
case
'Dark'
:
themeMode
=
'开启'
;
break
;
...
...
@@ -90,7 +97,7 @@ class _SettingPageState extends State<SettingPage> {
String
_getCurrentLocale
()
{
final
String
?
locale
=
SpUtil
.
getString
(
Constant
.
locale
);
String
localeMode
;
switch
(
locale
)
{
switch
(
locale
)
{
case
'zh'
:
localeMode
=
'中文'
;
break
;
...
...
@@ -105,17 +112,13 @@ class _SettingPageState extends State<SettingPage> {
}
void
_showExitDialog
()
{
showDialog
<
void
>(
context:
context
,
builder:
(
_
)
=>
const
ExitDialog
()
);
showDialog
<
void
>(
context:
context
,
builder:
(
_
)
=>
const
ExitDialog
());
}
void
_showUpdateDialog
()
{
showDialog
<
void
>(
context:
context
,
barrierDismissible:
false
,
builder:
(
_
)
=>
const
UpdateDialog
()
);
builder:
(
_
)
=>
const
UpdateDialog
());
}
}
...
...
Please
register
or
login
to post a comment