From 8ac5700c1082a6958ca1949ca94a307489700dc2 Mon Sep 17 00:00:00 2001 From: AshutoshPatole Date: Thu, 18 Nov 2021 20:34:43 +0530 Subject: [PATCH] Basic profile screen done --- lib/views/drawer_page/drawer_ui.dart | 38 +++++++------ .../edit_profile_page_view.dart | 57 ++++++++++++++++++- .../edit_profile_page_view_model.dart | 2 + lib/widgets/dumb_widgets/profile_row.dart | 34 +++++++++++ 4 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 lib/widgets/dumb_widgets/profile_row.dart diff --git a/lib/views/drawer_page/drawer_ui.dart b/lib/views/drawer_page/drawer_ui.dart index 32ca8de..7463e31 100644 --- a/lib/views/drawer_page/drawer_ui.dart +++ b/lib/views/drawer_page/drawer_ui.dart @@ -40,7 +40,7 @@ class _HomeDrawerState extends State { ), DrawerList( index: DrawerIndex.feedback, - labelName: 'FeedBack', + labelName: 'Advice', icon: const Icon(CupertinoIcons.chat_bubble_text), ), DrawerList( @@ -102,22 +102,26 @@ class _HomeDrawerState extends State { }, child: Stack( children: [ - Container( - height: size.height * 0.125, - width: size.width * 0.25, - decoration: BoxDecoration( - shape: BoxShape.circle, - boxShadow: [ - BoxShadow( - color: AppTheme.grey - .withOpacity(0.6), - offset: const Offset(2.0, 4.0), - blurRadius: 8), - ], - ), - child: CircleAvatar( - foregroundImage: NetworkImage( - "${model.user!.photoURL}"), + Hero( + tag: "photoURL", + child: Container( + height: size.height * 0.125, + width: size.width * 0.25, + decoration: BoxDecoration( + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + color: AppTheme.grey + .withOpacity(0.6), + offset: + const Offset(2.0, 4.0), + blurRadius: 8), + ], + ), + child: CircleAvatar( + foregroundImage: NetworkImage( + "${model.user!.photoURL}"), + ), ), ), const Positioned( diff --git a/lib/views/edit_profile_page/edit_profile_page_view.dart b/lib/views/edit_profile_page/edit_profile_page_view.dart index 23e241b..79483e4 100644 --- a/lib/views/edit_profile_page/edit_profile_page_view.dart +++ b/lib/views/edit_profile_page/edit_profile_page_view.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stacked/stacked.dart'; +import 'package:zerosandones/theme/app_theme.dart'; +import 'package:zerosandones/widgets/dumb_widgets/profile_row.dart'; import 'edit_profile_page_view_model.dart'; class EditProfilePageView extends StatelessWidget { @@ -7,11 +9,62 @@ class EditProfilePageView extends StatelessWidget { @override Widget build(BuildContext context) { + Size _size = MediaQuery.of(context).size; return ViewModelBuilder.reactive( builder: (BuildContext context, EditProfilePageViewModel viewModel, _) { return Scaffold( - body: Center( - child: Text('EditProfilePage View'), + body: SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Profile", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24.0, + ), + ), + SizedBox( + height: _size.height * 0.05, + ), + Align( + alignment: Alignment.center, + child: Hero( + tag: "photoURL", + child: Container( + height: _size.height * 0.2, + width: _size.width * 0.35, + decoration: BoxDecoration( + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + color: AppTheme.grey.withOpacity(0.6), + offset: const Offset(2.0, 4.0), + blurRadius: 8), + ], + ), + child: CircleAvatar( + foregroundImage: + NetworkImage("${viewModel.user.photoURL}"), + ), + ), + ), + ), + SizedBox( + height: _size.height * 0.05, + ), + ProfileRow( + itemName: "Name", itemData: viewModel.user.displayName!), + ProfileRow( + itemName: "Email", itemData: viewModel.user.email!), + ProfileRow( + itemName: "Phone Number", + itemData: viewModel.user.phoneNumber ?? "N/A"), + ], + ), + ), ), ); }, diff --git a/lib/views/edit_profile_page/edit_profile_page_view_model.dart b/lib/views/edit_profile_page/edit_profile_page_view_model.dart index 9274a71..32028f5 100644 --- a/lib/views/edit_profile_page/edit_profile_page_view_model.dart +++ b/lib/views/edit_profile_page/edit_profile_page_view_model.dart @@ -1,3 +1,4 @@ +import 'package:firebase_auth/firebase_auth.dart'; import 'package:logger/logger.dart'; import 'package:stacked/stacked.dart'; import 'package:zerosandones/core/logger.dart'; @@ -8,4 +9,5 @@ class EditProfilePageViewModel extends BaseViewModel { EditProfilePageViewModel() { log = getLogger(runtimeType.toString()); } + User user = FirebaseAuth.instance.currentUser!; } diff --git a/lib/widgets/dumb_widgets/profile_row.dart b/lib/widgets/dumb_widgets/profile_row.dart new file mode 100644 index 0000000..9b49233 --- /dev/null +++ b/lib/widgets/dumb_widgets/profile_row.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +class ProfileRow extends StatelessWidget { + final String itemName; + final String itemData; + const ProfileRow({Key? key, required this.itemName, required this.itemData}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + itemName, + style: const TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w400, + ), + ), + Text( + itemData, + style: const TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w700, + ), + ), + ], + ), + ); + } +}