diff --git a/sama_chat_client/lib/main.dart b/sama_chat_client/lib/main.dart index e88de83..fed9d9d 100644 --- a/sama_chat_client/lib/main.dart +++ b/sama_chat_client/lib/main.dart @@ -1,6 +1,7 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'sama_firebase_options.dart'; @@ -30,6 +31,12 @@ final GlobalKey navigatorKey = GlobalKey(); Future main() async { WidgetsFlutterBinding.ensureInitialized(); + + await SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + DeviceOrientation.portraitDown, + ]); + await Firebase.initializeApp( options: await SamaFirebaseOptions.currentPlatform, ); diff --git a/sama_chat_client/lib/src/features/profile/view/profile_form.dart b/sama_chat_client/lib/src/features/profile/view/profile_form.dart index 6a2a645..0cbdf6a 100644 --- a/sama_chat_client/lib/src/features/profile/view/profile_form.dart +++ b/sama_chat_client/lib/src/features/profile/view/profile_form.dart @@ -48,7 +48,7 @@ class AvatarNameTile extends StatelessWidget { child: ListTile( titleAlignment: ListTileTitleAlignment.top, title: Padding( - padding: const EdgeInsets.only(top: 8), + padding: const EdgeInsets.only(top: 4), child: _UserAvatar(), ), subtitle: Padding( @@ -66,39 +66,15 @@ class ProfileCard extends StatelessWidget { Widget build(BuildContext context) { return Padding( padding: EdgeInsets.only(bottom: Platform.isIOS ? 0.0 : 4.0), - child: const SizedBox( - width: double.infinity, - child: Card( - child: Padding( - padding: EdgeInsets.all(15), - child: Stack( - children: [ - Card( - color: paleMallow, - margin: EdgeInsets.only(top: 60), - child: Padding( - padding: EdgeInsets.only(top: 100, left: 4, right: 4), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - ConnectionChecker(child: _UsernameForm()), - SizedBox(height: columnItemMargin), - ConnectionChecker(child: _PhoneForm()), - SizedBox(height: columnItemMargin), - ConnectionChecker(child: _EmailForm()), - SizedBox(height: columnItemMargin), - ConnectionChecker(child: _AccountForm()), - ], - ), - ), - ), - Align(alignment: Alignment.bottomRight, child: _LogoutForm()), - Align( - alignment: Alignment.topCenter, - child: ConnectionChecker(child: AvatarNameTile()), - ), - ], - ), + child: Card( + child: Padding( + padding: const EdgeInsets.all(15), + child: Stack( + children: [ + _UserData(), + const Align( + alignment: Alignment.bottomRight, child: _LogoutForm()), + ], ), ), ), @@ -106,6 +82,42 @@ class ProfileCard extends StatelessWidget { } } +class _UserData extends StatelessWidget { + @override + Widget build(BuildContext context) { + return const Align( + alignment: Alignment(0, -0.5), + child: IntrinsicHeight( + child: Stack( + children: [ + Card( + color: paleMallow, + margin: EdgeInsets.only(top: 40), + child: Padding( + padding: EdgeInsets.only(top: 100, left: 4, right: 4), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ConnectionChecker(child: _UsernameForm()), + SizedBox(height: columnItemMargin), + ConnectionChecker(child: _PhoneForm()), + SizedBox(height: columnItemMargin), + ConnectionChecker(child: _EmailForm()), + SizedBox(height: columnItemMargin), + ConnectionChecker(child: _AccountForm()), + ], + ), + ), + ), + Align( + alignment: Alignment(0, -1.1), + child: ConnectionChecker(child: AvatarNameTile()), + ), + ], + ))); + } +} + class _UserAvatar extends StatelessWidget { @override Widget build(BuildContext context) { @@ -435,6 +447,7 @@ class NameDialogInput extends StatelessWidget { ), ), ]), + actionsAlignment: MainAxisAlignment.spaceAround, actions: _formActions(context)); }); } @@ -493,7 +506,7 @@ class InfoDialogInput extends StatelessWidget { ), errorText: state.userPhone.displayError == UserPhoneValidationError.outOfRange - ? 'The phone number should be 3 to 15 digits in length.' + ? 'The phone range 3 to 15 digits.' : null, ), ), @@ -538,6 +551,7 @@ class InfoDialogInput extends StatelessWidget { ), ), ]), + actionsAlignment: MainAxisAlignment.spaceAround, actions: _formActions(context)); }); } @@ -640,6 +654,7 @@ class _ChangePasswordInput extends StatelessWidget { ), ), ]), + actionsAlignment: MainAxisAlignment.spaceAround, actions: _formActions(context)); }); } diff --git a/sama_chat_client/lib/src/shared/ui/view/user_forms.dart b/sama_chat_client/lib/src/shared/ui/view/user_forms.dart index e5f4c71..5722e11 100644 --- a/sama_chat_client/lib/src/shared/ui/view/user_forms.dart +++ b/sama_chat_client/lib/src/shared/ui/view/user_forms.dart @@ -16,14 +16,14 @@ class AvatarForm extends StatelessWidget { color: black, shape: BoxShape.circle, border: Border.all(color: white, width: 2), - boxShadow: [ - BoxShadow( - color: black.withValues(alpha: 0.5), - spreadRadius: 3, - blurRadius: 7, - offset: const Offset(0, 3), // Controls the shadow's position - ), - ], + boxShadow: [ + BoxShadow( + color: black.withValues(alpha: 0.5), + spreadRadius: 3, + blurRadius: 7, + offset: const Offset(0, 3), // Controls the shadow's position + ), + ], ), height: 85.0, width: 85.0, @@ -77,11 +77,13 @@ class UsernameForm extends StatelessWidget { ), ], ), - Text( - userLogin ?? "", - style: - const TextStyle(fontSize: 18, fontWeight: FontWeight.normal), - ), + Padding( + padding: const EdgeInsets.only(left: 4), + child: Text( + userLogin ?? "", + style: const TextStyle( + fontSize: 18, fontWeight: FontWeight.normal), + )), ], )); } @@ -118,13 +120,16 @@ class UserPhoneForm extends StatelessWidget { ), ], ), - Text( - userPhone == null ? userPhoneStub : userPhone!, - style: TextStyle( - fontSize: 18, - fontWeight: - userPhone == null ? FontWeight.w200 : FontWeight.normal), - ), + Padding( + padding: const EdgeInsets.only(left: 4), + child: Text( + userPhone == null ? userPhoneStub : userPhone!, + style: TextStyle( + fontSize: 18, + fontWeight: userPhone == null + ? FontWeight.w200 + : FontWeight.normal), + )), ], )); } @@ -161,13 +166,16 @@ class UserEmailForm extends StatelessWidget { ), ], ), - Text( - userEmail == null ? userEmailStub : userEmail!, - style: TextStyle( - fontSize: 18, - fontWeight: - userEmail == null ? FontWeight.w200 : FontWeight.normal), - ), + Padding( + padding: const EdgeInsets.only(left: 4), + child: Text( + userEmail == null ? userEmailStub : userEmail!, + style: TextStyle( + fontSize: 18, + fontWeight: userEmail == null + ? FontWeight.w200 + : FontWeight.normal), + )), ], )); }