Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sama_chat_client/lib/main.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -30,6 +31,12 @@ final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();

await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);

await Firebase.initializeApp(
options: await SamaFirebaseOptions.currentPlatform,
);
Expand Down
85 changes: 50 additions & 35 deletions sama_chat_client/lib/src/features/profile/view/profile_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -66,46 +66,58 @@ 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()),
],
),
),
),
);
}
}

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) {
Expand Down Expand Up @@ -435,6 +447,7 @@ class NameDialogInput extends StatelessWidget {
),
),
]),
actionsAlignment: MainAxisAlignment.spaceAround,
actions: _formActions(context));
});
}
Expand Down Expand Up @@ -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,
),
),
Expand Down Expand Up @@ -538,6 +551,7 @@ class InfoDialogInput extends StatelessWidget {
),
),
]),
actionsAlignment: MainAxisAlignment.spaceAround,
actions: _formActions(context));
});
}
Expand Down Expand Up @@ -640,6 +654,7 @@ class _ChangePasswordInput extends StatelessWidget {
),
),
]),
actionsAlignment: MainAxisAlignment.spaceAround,
actions: _formActions(context));
});
}
Expand Down
62 changes: 35 additions & 27 deletions sama_chat_client/lib/src/shared/ui/view/user_forms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
)),
],
));
}
Expand Down Expand Up @@ -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),
)),
],
));
}
Expand Down Expand Up @@ -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),
)),
],
));
}
Expand Down