Skip to content

Commit

Permalink
Add delete button to edit page with other details
Browse files Browse the repository at this point in the history
  • Loading branch information
AshutoshPatole committed Nov 19, 2021
1 parent 8ac5700 commit 52264d2
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 3 deletions.
71 changes: 68 additions & 3 deletions lib/views/edit_profile_page/edit_profile_page_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'package:zerosandones/theme/app_theme.dart';
Expand Down Expand Up @@ -59,9 +60,73 @@ class EditProfilePageView extends StatelessWidget {
itemName: "Name", itemData: viewModel.user.displayName!),
ProfileRow(
itemName: "Email", itemData: viewModel.user.email!),
ProfileRow(
itemName: "Phone Number",
itemData: viewModel.user.phoneNumber ?? "N/A"),
Stack(
children: [
ProfileRow(
itemName: "Phone Number",
itemData: viewModel.user.phoneNumber ?? "N/A"),
Positioned(
left: _size.width * 0.31,
bottom: 8,
child: GestureDetector(
onTap: () {
viewModel.navigateToPhoneAuthenticationPage();
},
child: const Icon(
CupertinoIcons.pencil_circle,
size: 20,
color: AppTheme.primaryColor,
),
),
)
],
),
SizedBox(
height: _size.height * 0.1,
),
Align(
alignment: Alignment.center,
child: TextButton(
child: const Text(
"Delete Account",
style: TextStyle(
color: Colors.red,
fontSize: 18.0,
fontWeight: FontWeight.w700,
),
),
onPressed: () {
// ON HOLD
// TODO: Implement delete account firebase extension
},
),
),
SizedBox(
height: _size.height * 0.1,
),
Align(
alignment: Alignment.center,
child: Text(
viewModel.user.uid,
style: const TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w500,
),
),
),
SizedBox(
height: _size.height * 0.02,
),
const Align(
alignment: Alignment.center,
child: Text(
"App Version 0.0.1",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w500,
),
),
)
],
),
),
Expand Down
8 changes: 8 additions & 0 deletions lib/views/edit_profile_page/edit_profile_page_view_model.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:logger/logger.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:zerosandones/core/locator.dart';
import 'package:zerosandones/core/logger.dart';
import 'package:zerosandones/core/router_constants.dart';

class EditProfilePageViewModel extends BaseViewModel {
late Logger log;
Expand All @@ -10,4 +13,9 @@ class EditProfilePageViewModel extends BaseViewModel {
log = getLogger(runtimeType.toString());
}
User user = FirebaseAuth.instance.currentUser!;
final NavigationService _navigationService = locator<NavigationService>();

navigateToPhoneAuthenticationPage() {
_navigationService.navigateTo(phoneAuthPageViewRoute);
}
}

0 comments on commit 52264d2

Please sign in to comment.