diff --git a/lib/presentation/settings/mobile/settings_view_mobile.dart b/lib/presentation/settings/mobile/settings_view_mobile.dart index 4e346ee9..44fcd73d 100644 --- a/lib/presentation/settings/mobile/settings_view_mobile.dart +++ b/lib/presentation/settings/mobile/settings_view_mobile.dart @@ -30,8 +30,8 @@ class _SettingsViewMobileState extends State { }, child: Container( padding: const EdgeInsets.all(16), - height: 260, child: Column( + mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/presentation/settings/mobile/update_profile_screen_mobile.dart b/lib/presentation/settings/mobile/update_profile_screen_mobile.dart index 6e569a84..2c8cf748 100644 --- a/lib/presentation/settings/mobile/update_profile_screen_mobile.dart +++ b/lib/presentation/settings/mobile/update_profile_screen_mobile.dart @@ -54,239 +54,242 @@ class _UpdateProfileScreenMobileState extends State { @override Widget build(BuildContext context) { return Scaffold( - resizeToAvoidBottomInset: false, - appBar: CustomMobileAppBar( - logoPath: Assets.mobile.logoUpdateProfile.path, - actions: [ - IconButton( - onPressed: () { - SettingsBottomSheet().settingsBottomSheet(context); - }, - icon: const Icon( - Icons.settings_outlined, - color: AppColor.appBlack, - ), - ), - ], - leading: IconButton( + resizeToAvoidBottomInset: false, + appBar: CustomMobileAppBar( + logoPath: Assets.mobile.logoUpdateProfile.path, + actions: [ + IconButton( onPressed: () { - Navigator.pop(context); + SettingsBottomSheet().settingsBottomSheet(context); }, icon: const Icon( - Icons.arrow_back, + Icons.settings_outlined, color: AppColor.appBlack, ), ), + ], + leading: IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: const Icon( + Icons.arrow_back, + color: AppColor.appBlack, + ), ), - body: BlocListener( - bloc: locator(), - listener: (context, state) { - if (state is UpdateProfileLoading) { - showDialog( - context: context, - builder: (context) { - return const Center( - child: CircularProgressIndicator( - valueColor: AlwaysStoppedAnimation( - AppColor.appPrimary, - ), + ), + body: SingleChildScrollView( + child: BlocListener( + bloc: locator(), + listener: (context, state) { + if (state is UpdateProfileLoading) { + showDialog( + context: context, + builder: (context) { + return const Center( + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation( + AppColor.appPrimary, ), - ); - }); - } - if (state is UpdateProfileSuccess) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(state.toString()), - ), - ); - context.pop(); - } - }, - child: BlocBuilder( - bloc: locator(), - builder: (context, authState) { - authState as Authenticated; - return Padding( - padding: const EdgeInsets.all(30), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - onTap: () async { - final ImagePicker picker = ImagePicker(); - final img = await picker - .pickImage( - source: ImageSource.gallery, - ) - .then((value) => value!.readAsBytes()); - setState(() { - image = img; - }); - image != null - ? showDialogAlertProfileImage( - // ignore: use_build_context_synchronously - context, - "Update ProfilePic", - image != null - ? CircleAvatar( - radius: 100, - backgroundImage: - MemoryImage(image!)) - : CircleAvatar( - radius: 100, - backgroundImage: - CachedNetworkImageProvider( - authState - .user.profilePictureUrl ?? - defaultProfilePicture, - ), + ), + ); + }); + } + if (state is UpdateProfileSuccess) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(state.toString()), + ), + ); + context.pop(); + } + }, + child: BlocBuilder( + bloc: locator(), + builder: (context, authState) { + authState as Authenticated; + return Padding( + padding: const EdgeInsets.all(30), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () async { + final ImagePicker picker = ImagePicker(); + final img = await picker + .pickImage( + source: ImageSource.gallery, + ) + .then((value) => value!.readAsBytes()); + setState(() { + image = img; + }); + image != null + ? showDialogAlertProfileImage( + // ignore: use_build_context_synchronously + context, + "Update ProfilePic", + image != null + ? CircleAvatar( + radius: 100, + backgroundImage: + MemoryImage(image!)) + : CircleAvatar( + radius: 100, + backgroundImage: + CachedNetworkImageProvider( + authState + .user.profilePictureUrl ?? + defaultProfilePicture, ), - image!, - ) - // File(image!.path)) - : null; - }, - child: Stack(children: [ - CircleAvatar( - radius: 50, - backgroundImage: CachedNetworkImageProvider( - authState.user.profilePictureUrl ?? - defaultProfilePicture, - ), + ), + image!, + ) + // File(image!.path)) + : null; + }, + child: Stack(children: [ + CircleAvatar( + radius: 50, + backgroundImage: CachedNetworkImageProvider( + authState.user.profilePictureUrl ?? + defaultProfilePicture, ), - Positioned( - right: 0, - bottom: 0, - child: Container( - height: 25, - width: 25, - decoration: BoxDecoration( - border: - Border.all(color: AppColor.appWhite), - borderRadius: const BorderRadius.all( - Radius.circular(15)), - color: AppColor.appPrimary), - child: const Icon( - Icons.photo_camera_outlined, - size: 15, - ), + ), + Positioned( + right: 0, + bottom: 0, + child: Container( + height: 25, + width: 25, + decoration: BoxDecoration( + border: + Border.all(color: AppColor.appWhite), + borderRadius: const BorderRadius.all( + Radius.circular(15)), + color: AppColor.appPrimary), + child: const Icon( + Icons.photo_camera_outlined, + size: 15, ), ) - ]), - ), - const SizedBox( - height: 15, - ), - CustomListTile( - onClick: () { - showDialogAlert( - context, - "Update Name", - "Name", - nameController, - (value) { - if (value!.isEmpty) { - return 'Name cannot be empty'; - } - return null; - }, - ); - }, - leadingIcon: CircleAvatar( - radius: 25, - backgroundImage: CachedNetworkImageProvider( - authState.user.profilePictureUrl ?? - defaultProfilePicture, - )), - title: "Name", - subtitle: authState.user.name, - ), - const SizedBox( - height: 15, + )]) ), - CustomListTile( - onClick: () { - showDialogAlert(context, "Update Username", - "Username", usernameController, (value) { + const SizedBox( + height: 15, + ), + CustomListTile( + onClick: () { + showDialogAlert( + context, + "Update Name", + "Name", + nameController, + (value) { if (value!.isEmpty) { - return 'Username cannot be empty'; + return 'Name cannot be empty'; } return null; - }); - }, - leadingIcon: const Icon( - Icons.person_outline_rounded, - size: 35, - ), - title: "Username", - subtitle: "@${authState.user.username!}", - ), - const SizedBox( - height: 15, - ), - CustomListTile( - onClick: () { - showDialogAlert(context, "Update Status", "Status", - statusController, (value) { - if (value!.isEmpty) { - return 'Status cannot be empty'; - } - return null; - }); - }, - leadingIcon: - const Icon(Icons.badge_outlined, size: 35), - title: "Status", - subtitle: authState.user.status, - ), - const SizedBox( - height: 15, + }, + ); + }, + leadingIcon: CircleAvatar( + radius: 25, + backgroundImage: CachedNetworkImageProvider( + authState.user.profilePictureUrl ?? + defaultProfilePicture, + )), + title: "Name", + subtitle: authState.user.name, + ), + const SizedBox( + height: 15, + ), + CustomListTile( + onClick: () { + showDialogAlert(context, "Update Username", + "Username", usernameController, (value) { + if (value!.isEmpty) { + return 'Username cannot be empty'; + } + return null; + }); + }, + leadingIcon: const Icon( + Icons.person_outline_rounded, + size: 35, ), - CustomListTile( - onClick: () { - showDialogAlert(context, "Update Email", "Email", - emailController, (value) { + title: "Username", + subtitle: "@${authState.user.username!}", + ), + const SizedBox( + height: 15, + ), + CustomListTile( + onClick: () { + showDialogAlert(context, "Update Status", "Status", + statusController, (value) { + if (value!.isEmpty) { + return 'Status cannot be empty'; + } + return null; + }); + }, + leadingIcon: + const Icon(Icons.badge_outlined, size: 35), + title: "Status", + subtitle: authState.user.status, + ), + const SizedBox( + height: 15, + ), + CustomListTile( + onClick: () { + showDialogAlert(context, "Update Email", "Email", + emailController, (value) { + if (value!.isEmpty) { + return 'Email cannot be empty'; + } else if (!value.contains('@')) { + return 'Invalid email'; + } + return null; + }); + }, + leadingIcon: const Icon(Icons.mail_outline, size: 35), + title: "Email", + subtitle: authState.user.email, + ), + const SizedBox( + height: 15, + ), + CustomListTile( + onClick: () { + showDialogAlert( + context, + "Update Password", + "Password", + passwordController, + (value) { if (value!.isEmpty) { - return 'Email cannot be empty'; - } else if (!value.contains('@')) { - return 'Invalid email'; + return 'Password cannot be empty'; + } else if (value.length < 6) { + return 'Password must be at least 6 characters'; } return null; - }); - }, - leadingIcon: const Icon(Icons.mail_outline, size: 35), - title: "Email", - subtitle: authState.user.email, - ), - const SizedBox( - height: 15, - ), - CustomListTile( - onClick: () { - showDialogAlert( - context, - "Update Password", - "Password", - passwordController, - (value) { - if (value!.isEmpty) { - return 'Password cannot be empty'; - } else if (value.length < 6) { - return 'Password must be at least 6 characters'; - } - return null; - }, - ); - }, - leadingIcon: const Icon(Icons.password, size: 35), - title: "Password", - ), - ], - )); - }, - ))); + }, + ); + }, + leadingIcon: const Icon(Icons.password, size: 35), + title: "Password", + ), + ], + )); + }, + ), + ), + ), + ); } } diff --git a/pubspec.lock b/pubspec.lock index 681c4f03..796d33ca 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -342,22 +342,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" - device_frame: - dependency: transitive - description: - name: device_frame - sha256: d031a06f5d6f4750009672db98a5aa1536aa4a231713852469ce394779a23d75 - url: "https://pub.dev" - source: hosted - version: "1.2.0" - device_preview: - dependency: "direct main" - description: - name: device_preview - sha256: a694acdd3894b4c7d600f4ee413afc4ff917f76026b97ab06575fe886429ef19 - url: "https://pub.dev" - source: hosted - version: "1.2.0" easy_sidemenu: dependency: "direct main" description: