Skip to content

Commit

Permalink
feat: show delete account button only in iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
sboh1214 committed Aug 17, 2023
1 parent fbb684c commit 2aa4c35
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions lib/pages/user_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:otlplus/constants/text_styles.dart';
Expand Down Expand Up @@ -67,27 +69,28 @@ class UserPage extends StatelessWidget {
},
'user.logout'.tr(),

Check warning on line 70 in lib/pages/user_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/user_page.dart#L70

Added line #L70 was not covered by tests
),
_buildAccount(
Icons.highlight_off,
() async {
showGeneralDialog(
context: context,
barrierColor: Colors.black.withOpacity(0.2),
barrierDismissible: true,
barrierLabel: MaterialLocalizations.of(context)
.modalBarrierDismissLabel,
pageBuilder: (context, _, __) => DeleteDialog(
text: 'user.ask_delete_account'.tr(),
onDelete: () {
context.read<AuthModel>().logout();
context.read<InfoModel>().deleteAccount();
Navigator.pop(context);
},
),
);
},
'user.delete_account'.tr(),
),
if (Platform.isIOS)
_buildAccount(

Check warning on line 73 in lib/pages/user_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/user_page.dart#L72-L73

Added lines #L72 - L73 were not covered by tests
Icons.highlight_off,
() async {
showGeneralDialog(

Check warning on line 76 in lib/pages/user_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/user_page.dart#L75-L76

Added lines #L75 - L76 were not covered by tests
context: context,
barrierColor: Colors.black.withOpacity(0.2),

Check warning on line 78 in lib/pages/user_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/user_page.dart#L78

Added line #L78 was not covered by tests
barrierDismissible: true,
barrierLabel: MaterialLocalizations.of(context)
.modalBarrierDismissLabel,
pageBuilder: (context, _, __) => DeleteDialog(
text: 'user.ask_delete_account'.tr(),
onDelete: () {
context.read<AuthModel>().logout();
context.read<InfoModel>().deleteAccount();
Navigator.pop(context);

Check warning on line 87 in lib/pages/user_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/user_page.dart#L80-L87

Added lines #L80 - L87 were not covered by tests
},
),
);
},
'user.delete_account'.tr(),

Check warning on line 92 in lib/pages/user_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/user_page.dart#L92

Added line #L92 was not covered by tests
),
],
),
),
Expand Down

0 comments on commit 2aa4c35

Please sign in to comment.