mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-25 08:22:26 +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(
|
||||
DeleteAccountEvent event, Emitter<SecurityState> emit) async {
|
||||
emit(LoadingForgetState());
|
||||
try {
|
||||
await AuthenticationAPI.deleteAccount();
|
||||
emit(ChangedPassState());
|
||||
|
@ -37,27 +37,38 @@ class DeleteAccountPage extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<SecurityBloc>().add(DeleteAccountEvent());
|
||||
BlocBuilder<SecurityBloc, SecurityState>(
|
||||
builder: (context, state) {
|
||||
if (state is LoadingForgetState) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
return ElevatedButton(
|
||||
onPressed: () {
|
||||
context
|
||||
.read<SecurityBloc>()
|
||||
.add(DeleteAccountEvent());
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorsManager.blueColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
fixedSize: Size(
|
||||
MediaQuery.sizeOf(context).width * 0.8,
|
||||
40,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'Delete Account',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorsManager.onPrimaryColor),
|
||||
),
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorsManager.blueColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
fixedSize: Size(
|
||||
MediaQuery.sizeOf(context).width * 0.8,
|
||||
40,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'Delete Account',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorsManager.onPrimaryColor),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
Reference in New Issue
Block a user