Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit ec067c1e
authored
2025-12-11 15:21:48 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新绑定的手机号
1 parent
4b6090c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
3 deletions
lib/bloc/setting/account_phone_cubit.dart
lib/ui/pages/setting/account_page.dart
lib/ui/pages/setting/account_phone_page.dart
lib/bloc/setting/account_phone_cubit.dart
View file @
ec067c1
...
...
@@ -10,6 +10,7 @@ import 'package:shared_preferences/shared_preferences.dart';
class
AccountPhoneState
extends
Equatable
{
final
String
phone
;
final
bool
allowBind
;
final
bool
showSnackBar
;
final
String
snackBarMsg
;
...
...
@@ -18,6 +19,7 @@ class AccountPhoneState extends Equatable {
const
AccountPhoneState
({
this
.
phone
=
''
,
this
.
allowBind
=
false
,
this
.
showSnackBar
=
false
,
this
.
snackBarMsg
=
''
,
this
.
allowSend
=
true
,
...
...
@@ -26,6 +28,7 @@ class AccountPhoneState extends Equatable {
AccountPhoneState
copyWith
({
String
?
phone
,
bool
?
allowBind
,
bool
?
showSnackBar
,
String
?
snackBarMsg
,
bool
?
allowSend
,
...
...
@@ -33,6 +36,7 @@ class AccountPhoneState extends Equatable {
})
{
return
AccountPhoneState
(
phone:
phone
??
this
.
phone
,
allowBind:
allowBind
??
this
.
allowBind
,
showSnackBar:
showSnackBar
??
this
.
showSnackBar
,
snackBarMsg:
snackBarMsg
??
this
.
snackBarMsg
,
allowSend:
allowSend
??
this
.
allowSend
,
...
...
@@ -43,6 +47,7 @@ class AccountPhoneState extends Equatable {
@override
List
<
Object
?>
get
props
=>
[
phone
,
allowBind
,
showSnackBar
,
snackBarMsg
,
allowSend
,
...
...
@@ -72,6 +77,10 @@ class AccountPhoneCubit extends Cubit<AccountPhoneState> {
_phoneAuthRepository
=
getIt
.
get
<
PhoneAuthRepository
>();
}
void
change
(){
emit
(
state
.
copyWith
(
allowBind:
true
));
}
/// 开始倒计时
void
startCountdown
()
{
countdown
=
60
;
...
...
lib/ui/pages/setting/account_page.dart
View file @
ec067c1
...
...
@@ -63,7 +63,9 @@ class AccountPage extends StatelessWidget {
leading:
Icon
(
Icons
.
mobile_friendly
),
title:
Text
(
'手机号绑定'
),
subtitle:
Text
(
state
.
phone
!=
''
?
'
${state.phone.substring(0, 3)}
****
${state.phone.substring(7, 11)}
'
:
'未绑定'
,
state
.
phone
!=
''
?
'
${state.phone.substring(0, 3)}
****
${state.phone.substring(7, 11)}
'
:
'未绑定'
,
style:
TextStyle
(
fontSize:
14.0
,
color:
Colors
.
grey
,
...
...
@@ -86,7 +88,7 @@ class AccountPage extends StatelessWidget {
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
CircularProgressIndicator
(),
CircularProgressIndicator
(
color:
Color
(
0xFF7691FA
)
),
SizedBox
(
height:
16
),
Text
(
'加载中...'
),
],
...
...
lib/ui/pages/setting/account_phone_page.dart
View file @
ec067c1
...
...
@@ -27,7 +27,7 @@ class AccountPhonePage extends StatelessWidget {
color:
Colors
.
white
,
// 设置返回图标按钮的颜色
),
),
body:
state
.
phone
!=
''
body:
(
state
.
phone
!=
''
&&
!
state
.
allowBind
)
?
Center
(
child:
Column
(
children:
[
SizedBox
(
height:
120
),
...
...
@@ -39,6 +39,35 @@ class AccountPhonePage extends StatelessWidget {
fontWeight:
FontWeight
.
bold
,
),
),
SizedBox
(
height:
100
),
Padding
(
padding:
EdgeInsets
.
all
(
80
),
child:
SizedBox
(
width:
double
.
infinity
,
height:
47
,
child:
ElevatedButton
(
onPressed:
()
{
context
.
read
<
AccountPhoneCubit
>().
change
();
},
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
Color
(
0xFF7691FA
),
foregroundColor:
Colors
.
white
,
textStyle:
TextStyle
(
fontSize:
19
),
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
23.5
),
),
),
child:
Text
(
'更换绑定手机号'
,
style:
TextStyle
(
fontSize:
19
,
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFFFFFFF
),
),
strutStyle:
StrutStyle
(
height:
22
/
19
),
),
),
)),
]),
)
:
Padding
(
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment