mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-25 20:59:39 +00:00
add loading indicator and state for deleting acount
This commit is contained in:
@ -198,6 +198,7 @@ class SecurityBloc extends Bloc<SecurityEvent, SecurityState> {
|
|||||||
|
|
||||||
Future<void> onDeleteAccountEvent(
|
Future<void> onDeleteAccountEvent(
|
||||||
DeleteAccountEvent event, Emitter<SecurityState> emit) async {
|
DeleteAccountEvent event, Emitter<SecurityState> emit) async {
|
||||||
|
emit(LoadingForgetState());
|
||||||
try {
|
try {
|
||||||
await AuthenticationAPI.deleteAccount();
|
await AuthenticationAPI.deleteAccount();
|
||||||
emit(ChangedPassState());
|
emit(ChangedPassState());
|
||||||
|
@ -37,9 +37,18 @@ class DeleteAccountPage extends StatelessWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
BlocBuilder<SecurityBloc, SecurityState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is LoadingForgetState) {
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.read<SecurityBloc>().add(DeleteAccountEvent());
|
context
|
||||||
|
.read<SecurityBloc>()
|
||||||
|
.add(DeleteAccountEvent());
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: ColorsManager.blueColor,
|
backgroundColor: ColorsManager.blueColor,
|
||||||
@ -58,6 +67,8 @@ class DeleteAccountPage extends StatelessWidget {
|
|||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: ColorsManager.onPrimaryColor),
|
color: ColorsManager.onPrimaryColor),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user