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(),
),
_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(
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(),
),
],
),
),
Expand Down

0 comments on commit 2aa4c35

Please sign in to comment.