diff --git a/sama_chat_client/lib/src/features/conversation_group_create/view/group_create_form.dart b/sama_chat_client/lib/src/features/conversation_group_create/view/group_create_form.dart index ce9912ce..3dbbfbce 100644 --- a/sama_chat_client/lib/src/features/conversation_group_create/view/group_create_form.dart +++ b/sama_chat_client/lib/src/features/conversation_group_create/view/group_create_form.dart @@ -85,23 +85,21 @@ class GroupCreateFormState extends State { return previous.participants != current.participants; }, builder: (context, state) { return Visibility( - visible: !keyboardIsOpenCtx(context), - child: Visibility( - visible: state.participants.isValid, - child: IntrinsicWidth( - child: ButtonForm( - onPressed: () { - _showGroupDetails(context); - }, - backgroundColor: WidgetStatePropertyAll( - state.participants.isValid - ? slateBlue - : whiteAluminum), - foregroundColor: WidgetStatePropertyAll( - state.participants.isValid ? white : gainsborough), - hint: 'Next'), - ), - )); + visible: !keyboardIsOpenCtx(context) && state.participants.isValid, + child: IntrinsicWidth( + child: ButtonForm( + onPressed: () { + _showGroupDetails(context); + }, + backgroundColor: WidgetStatePropertyAll( + state.participants.isValid ? slateBlue : whiteAluminum), + foregroundColor: WidgetStatePropertyAll( + state.participants.isValid ? white : gainsborough), + text: 'Next', + textStyle: const TextStyle( + fontWeight: FontWeight.w600, fontSize: 16)), + ), + ); })); } } @@ -133,7 +131,9 @@ void _showGroupDetails(BuildContext context) { }, backgroundColor: const WidgetStatePropertyAll(slateBlue), foregroundColor: const WidgetStatePropertyAll(white), - hint: 'Create'), + text: 'Create', + textStyle: const TextStyle( + fontWeight: FontWeight.w600, fontSize: 16)), )), ))); } @@ -232,7 +232,7 @@ class _GroupNameInput extends StatelessWidget { onChanged: (groupname) => context.read().add(GroupnameChanged(groupname)), iconData: Icons.group, - hint: 'Groupname', + text: 'Groupname', error: state.groupname.displayError != null ? state.groupname.displayError == GroupnameValidationError.short ? 'Group name is too short' diff --git a/sama_chat_client/lib/src/features/conversations_list/widgets/avatar_letter_icon.dart b/sama_chat_client/lib/src/features/conversations_list/widgets/avatar_letter_icon.dart index 35a735a6..5078004f 100644 --- a/sama_chat_client/lib/src/features/conversations_list/widgets/avatar_letter_icon.dart +++ b/sama_chat_client/lib/src/features/conversations_list/widgets/avatar_letter_icon.dart @@ -8,7 +8,7 @@ class AvatarLetterIcon extends StatelessWidget { required this.name, this.lastName, super.key, - this.size = const Size(55, 60), + this.size = const Size(55, 55), this.padding = EdgeInsets.zero, this.backgroundColor = black, this.textColor = dullGray, diff --git a/sama_chat_client/lib/src/features/group_info/view/group_info_form.dart b/sama_chat_client/lib/src/features/group_info/view/group_info_form.dart index bbc48e6c..a3c6f9c2 100644 --- a/sama_chat_client/lib/src/features/group_info/view/group_info_form.dart +++ b/sama_chat_client/lib/src/features/group_info/view/group_info_form.dart @@ -8,12 +8,13 @@ import 'package:go_router/go_router.dart'; import '../../../navigation/constants.dart'; import '../../../repository/global_search/global_search_repository.dart'; -import '../../../shared/auth/bloc/auth_bloc.dart'; import '../../../shared/ui/colors.dart'; import '../../../shared/ui/view/participants_forms.dart'; +import '../../../shared/ui/view/text_button_forms.dart'; import '../../../shared/ui/view/user_forms.dart'; import '../../../shared/utils/screen_factor.dart'; import '../../../shared/utils/string_utils.dart'; +import '../../../shared/widget/keyboard_listener.dart'; import '../../conversations_list/widgets/avatar_letter_icon.dart'; import '../../search/bloc/global_search_bloc.dart'; import '../../search/view/search_bar.dart'; @@ -57,17 +58,12 @@ class AvatarDescriptionTile extends StatelessWidget { context.read().state.conversation.owner?.id == context.read().state.currentUser?.id; return ListTile( - titleAlignment: ListTileTitleAlignment.top, - title: Center( - child: Padding( - padding: const EdgeInsets.only(top: 8), - child: _ChatAvatar(isOwner: isOwner)), - ), - subtitle: Padding( - padding: const EdgeInsets.only(bottom: 4), - child: _ChatNameDescription(isOwner: isOwner), - ), - ); + titleAlignment: ListTileTitleAlignment.top, + title: Center( + child: Padding( + padding: const EdgeInsets.only(bottom: 8), + child: _ChatAvatar(isOwner: isOwner)), + )); }); } } @@ -93,146 +89,6 @@ class _ChatAvatar extends StatelessWidget { } } -class _ChatNameDescription extends StatelessWidget { - final bool isOwner; - - const _ChatNameDescription({required this.isOwner}); - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) => - previous.description != current.description && - current.description.isPure, - builder: (context, state) { - return Align( - alignment: Alignment.center, - child: TextButton( - onPressed: isOwner - ? () { - showDialog( - context: context, - builder: (_) { - return BlocProvider.value( - value: BlocProvider.of(context), - child: const NameDialogInput(), - ); - }); - } - : null, - style: TextButton.styleFrom( - minimumSize: Size.zero, - tapTargetSize: MaterialTapTargetSize.shrinkWrap, - alignment: Alignment.center), - child: Text( - state.description.value.isEmpty - ? "Description" - : state.description.value, - style: TextStyle( - fontSize: 18, - color: signalBlack, - fontWeight: state.description.value.isEmpty - ? FontWeight.w200 - : FontWeight.normal), - maxLines: 3, - overflow: TextOverflow.ellipsis, - ), - )); - }); - } -} - -class NameDialogInput extends StatelessWidget { - const NameDialogInput({super.key}); - - @override - Widget build(BuildContext context) { - var groupNameTxt = TextEditingController() - ..text = context.read().state.name.value; - var descriptionTxt = TextEditingController() - ..text = context.read().state.description.value; - - return BlocBuilder( - buildWhen: (previous, current) => - previous.name != current.name || - previous.description != current.description, - builder: (context, state) { - return AlertDialog( - title: const Text('Edit chat information'), - actionsPadding: const EdgeInsets.only(bottom: 8), - contentPadding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - content: Column(mainAxisSize: MainAxisSize.min, children: [ - Container( - padding: const EdgeInsets.all(8), - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(12)), - color: gainsborough, - ), - child: TextField( - keyboardType: TextInputType.text, - controller: groupNameTxt, - style: const TextStyle(fontSize: 18), - onSubmitted: (value) => - ScaffoldMessenger.of(context).hideCurrentSnackBar(), - onChanged: (groupname) => context - .read() - .add(GroupNameChanged(groupname)), - decoration: InputDecoration( - border: InputBorder.none, - contentPadding: const EdgeInsets.only(bottom: 4), - label: const Text( - 'Group name', - style: TextStyle(color: dullGray, fontSize: 16), - ), - errorText: state.name.displayError == - GroupnameValidationError.empty - ? 'group name is empty' - : state.name.displayError == - GroupnameValidationError.short - ? 'group name is too short' - : null, - ), - ), - ), - const SizedBox(height: columnItemMargin), - Container( - padding: const EdgeInsets.all(8), - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(12)), - color: gainsborough, - ), - child: TextField( - keyboardType: TextInputType.text, - controller: descriptionTxt, - style: const TextStyle(fontSize: 18), - onSubmitted: (value) => - ScaffoldMessenger.of(context).hideCurrentSnackBar(), - onChanged: (description) => context - .read() - .add(GroupDescriptionChanged(description)), - decoration: InputDecoration( - border: InputBorder.none, - contentPadding: const EdgeInsets.only(bottom: 4), - label: const Text( - 'Description', - style: TextStyle(color: dullGray, fontSize: 16), - ), - errorText: state.description.displayError == - GroupDescriptionValidationError.empty - ? 'group description is empty' - : state.description.displayError == - GroupDescriptionValidationError.short - ? 'group description is too short' - : null, - ), - ), - ), - ]), - actions: _formActions(context)); - }); - } -} - class GroupInfoCard extends StatelessWidget { const GroupInfoCard({super.key}); @@ -246,24 +102,111 @@ class GroupInfoCard extends StatelessWidget { var currentUserId = context.read().state.currentUser?.id ?? ''; var isOwner = ownerId == currentUserId; + + var groupNameTxt = TextEditingController() + ..text = context.read().state.name.value; + var descriptionTxt = TextEditingController() + ..text = context.read().state.description.value; return Padding( padding: EdgeInsets.only(bottom: Platform.isIOS ? 0.0 : 4.0), - child: SizedBox( - width: double.infinity, - child: Card( - child: Padding( + child: Card( + child: Padding( padding: const EdgeInsets.all(15), child: Column(children: [ const AvatarDescriptionTile(), - _ParticipantsHeaderForm(isOwner: isOwner), + Card( + color: paleMallow, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsetsGeometry.symmetric( + horizontal: 8), + child: TextField( + keyboardType: TextInputType.text, + controller: groupNameTxt, + style: const TextStyle(fontSize: 18), + onSubmitted: (value) => + ScaffoldMessenger.of(context) + .hideCurrentSnackBar(), + onChanged: (groupname) => context + .read() + .add(GroupNameChanged(groupname)), + decoration: InputDecoration( + fillColor: paleMallow, + border: InputBorder.none, + label: const Text( + 'Group name', + style: TextStyle( + color: dullGray, fontSize: 16), + ), + errorText: state.name.displayError == + GroupnameValidationError.empty + ? 'group name is empty' + : state.name.displayError == + GroupnameValidationError.short + ? 'group name is too short' + : null, + ), + ), + ), + const Divider( + indent: 8, + endIndent: 8, + color: slateBlue, + thickness: 1, + ), + Padding( + padding: const EdgeInsetsGeometry.symmetric( + horizontal: 8), + child: TextField( + keyboardType: TextInputType.text, + controller: descriptionTxt, + style: const TextStyle(fontSize: 18), + onSubmitted: (value) => + ScaffoldMessenger.of(context) + .hideCurrentSnackBar(), + onChanged: (description) => context + .read() + .add(GroupDescriptionChanged( + description)), + decoration: InputDecoration( + fillColor: paleMallow, + border: InputBorder.none, + label: const Text( + 'Description', + style: TextStyle( + color: dullGray, fontSize: 16), + ), + errorText: state + .description.displayError == + GroupDescriptionValidationError + .empty + ? 'group description is empty' + : state.description.displayError == + GroupDescriptionValidationError + .short + ? 'group description is too short' + : null, + ), + ), + ), + ], + )), + const SizedBox(height: 30), Expanded( - child: _ParticipantsListForm( - isOwner: isOwner, - ownerId: ownerId, - currentUserId: currentUserId)), - ]), - ), - ))); + child: Card( + color: paleMallow, + child: Column(children: [ + _ParticipantsHeaderForm(isOwner: isOwner), + Expanded( + child: _ParticipantsListForm( + isOwner: isOwner, + ownerId: ownerId, + currentUserId: currentUserId)), + ]), + )), + ])))); }); } } @@ -279,13 +222,12 @@ class _ParticipantsHeaderForm extends StatelessWidget { return ListTile( contentPadding: const EdgeInsets.all(8.0), leading: Text( - '${state.participants.value.length} members', + '${state.participants.value.length} ${state.participants.value.length > 1 ? 'members' : 'member'}', style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 20), ), trailing: isOwner ? IconButton( style: TextButton.styleFrom( - minimumSize: Size.zero, padding: EdgeInsets.zero, tapTargetSize: MaterialTapTargetSize.shrinkWrap), icon: const Icon(Icons.person_add_alt_outlined, @@ -395,7 +337,7 @@ void _showSearchScreenDialog(BuildContext context) { var currentParticipants = List.of( state.participants.value..remove(state.currentUser)); return ParticipantsForm( - users: currentParticipants + users: List.of(currentParticipants) ..addAll(state.addParticipants.value), nonRemovableUsers: currentParticipants, onAddParticipants: (user) { @@ -421,24 +363,44 @@ void _showSearchScreenDialog(BuildContext context) { }), ), ), - floatingActionButton: Visibility( - visible: !keyboardIsOpenCtx(context), - child: FloatingActionButton( - backgroundColor: dullGray, - tooltip: 'Add participants', - onPressed: () { - showDialog( - context: context, - builder: (_) { - return BlocProvider.value( - value: BlocProvider.of(context), - child: _AddParticipantsDialog(), - ); - }); - }, - child: const Icon(Icons.check, color: white, size: 28), - ), - ), + floatingActionButton: StatefulBuilder(builder: (_, setState) { + return BlocProvider.value( + value: BlocProvider.of(context), + child: BlocBuilder( + builder: (context, state) { + return KeyboardVisibilityListener( + listener: (isKeyboardVisible) { + setState(() {}); + }, + child: Visibility( + visible: !keyboardIsOpen() && state.isValid, + child: IntrinsicWidth( + child: ButtonForm( + onPressed: () { + showDialog( + context: context, + builder: (_) { + return BlocProvider.value( + value: BlocProvider.of< + GroupInfoBloc>(context), + child: + _AddParticipantsDialog(), + ); + }); + }, + backgroundColor: + const WidgetStatePropertyAll( + slateBlue), + foregroundColor: + const WidgetStatePropertyAll(white), + text: 'Done', + textStyle: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 16))))); + }, + ), + ); + }), )))); } @@ -462,6 +424,7 @@ class _AddParticipantsDialog extends StatelessWidget { title: const Text('Add participants', style: TextStyle(fontSize: 20)), content: const Text('Add selected users to the chat?', style: TextStyle(fontSize: 16)), + actionsAlignment: MainAxisAlignment.spaceAround, actions: _formActions(context)); } } @@ -474,6 +437,7 @@ class _RemoveParticipantsDialog extends StatelessWidget { const Text('Remove user from chat', style: TextStyle(fontSize: 20)), content: const Text('Do you want to delete this user?', style: TextStyle(fontSize: 16)), + actionsAlignment: MainAxisAlignment.spaceAround, actions: _formActions(context)); } } diff --git a/sama_chat_client/lib/src/features/login/view/login_form.dart b/sama_chat_client/lib/src/features/login/view/login_form.dart index 68463aff..45d84bfc 100644 --- a/sama_chat_client/lib/src/features/login/view/login_form.dart +++ b/sama_chat_client/lib/src/features/login/view/login_form.dart @@ -161,7 +161,7 @@ class _UsernameInput extends StatelessWidget { onChanged: (username) => context.read().add(LoginUsernameChanged(username)), iconData: Icons.person_outlined, - hint: 'Username', + text: 'Username', error: state.username.displayError != null ? state.username.displayError == UsernameValidationError.short ? 'User name is too short' @@ -207,7 +207,7 @@ class _PasswordInputState extends State<_PasswordInput> { size: 22, ), ), - hint: 'Password', + text: 'Password', error: state.password.displayError != null ? state.password.displayError == PasswordValidationError.short ? 'Password is too short' @@ -235,7 +235,7 @@ class _EmailInput extends StatelessWidget { context.read().add(LoginEmailChanged(email)), iconData: Icons.email_outlined, keyboardType: TextInputType.emailAddress, - hint: 'Email', + text: 'Email', error: state.email.displayError != null ? state.email.displayError == EmailValidationError.empty ? 'Email is too short' @@ -274,7 +274,7 @@ class _LoginButton extends StatelessWidget { isSignInValid || isSignUpValid ? slateBlue : whiteAluminum), foregroundColor: WidgetStatePropertyAll( isSignInValid || isSignUpValid ? white : gainsborough), - hint: isSignup ? 'Create account' : 'Login'); + text: isSignup ? 'Create account' : 'Login'); }, ); } diff --git a/sama_chat_client/lib/src/features/reset_password/view/send_email_form.dart b/sama_chat_client/lib/src/features/reset_password/view/send_email_form.dart index 0f4e629b..98c15699 100644 --- a/sama_chat_client/lib/src/features/reset_password/view/send_email_form.dart +++ b/sama_chat_client/lib/src/features/reset_password/view/send_email_form.dart @@ -59,7 +59,7 @@ class _EmailInput extends StatelessWidget { context.read().add(EmailChanged(email)), iconData: Icons.email_outlined, keyboardType: TextInputType.emailAddress, - hint: 'Email', + text: 'Email', error: state.email.displayError != null ? state.email.displayError == EmailValidationError.empty ? 'Email is too short' @@ -114,7 +114,7 @@ class _ContinueButton extends StatelessWidget { state.isEmailValid ? slateBlue : whiteAluminum), foregroundColor: WidgetStatePropertyAll( state.isEmailValid ? white : gainsborough), - hint: 'Continue'); + text: 'Continue'); }, )); } diff --git a/sama_chat_client/lib/src/features/reset_password/view/send_otp_form.dart b/sama_chat_client/lib/src/features/reset_password/view/send_otp_form.dart index f1cf83b2..408f5a8a 100644 --- a/sama_chat_client/lib/src/features/reset_password/view/send_otp_form.dart +++ b/sama_chat_client/lib/src/features/reset_password/view/send_otp_form.dart @@ -96,7 +96,7 @@ class _ContinueButton extends StatelessWidget { state.isOTPValid ? slateBlue : whiteAluminum), foregroundColor: WidgetStatePropertyAll( state.isOTPValid ? white : gainsborough), - hint: 'Continue'); + text: 'Continue'); }, ); } diff --git a/sama_chat_client/lib/src/features/reset_password/view/send_reset_password_form.dart b/sama_chat_client/lib/src/features/reset_password/view/send_reset_password_form.dart index 9b48acd7..88dcd380 100644 --- a/sama_chat_client/lib/src/features/reset_password/view/send_reset_password_form.dart +++ b/sama_chat_client/lib/src/features/reset_password/view/send_reset_password_form.dart @@ -85,7 +85,7 @@ class _PasswordInputState extends State<_PasswordInput> { color: dullGray, ), ), - hint: 'Password', + text: 'Password', error: state.password.displayError != null ? state.password.displayError == PasswordValidationError.short ? 'Password is too short' @@ -124,7 +124,7 @@ class _ConfirmPasswordInputState extends State<_ConfirmPasswordInput> { .read() .add(ConfirmPasswordChanged(psw)), iconData: Icons.lock_outline, - hint: 'Confirm password', + text: 'Confirm password', error: state.confirmPassword.displayError != null ? state.confirmPassword.displayError == ConfirmPasswordValidationError.empty @@ -174,7 +174,7 @@ class _ContinueButton extends StatelessWidget { state.isPasswordValid ? slateBlue : whiteAluminum), foregroundColor: WidgetStatePropertyAll( state.isPasswordValid ? white : gainsborough), - hint: 'Continue'); + text: 'Continue'); }, ); } diff --git a/sama_chat_client/lib/src/features/user_info/view/user_info_form.dart b/sama_chat_client/lib/src/features/user_info/view/user_info_form.dart index 5e1a8591..96535a49 100644 --- a/sama_chat_client/lib/src/features/user_info/view/user_info_form.dart +++ b/sama_chat_client/lib/src/features/user_info/view/user_info_form.dart @@ -23,25 +23,6 @@ class UserInfoForm extends StatelessWidget { } } -class AvatarTileFrom extends StatelessWidget { - final UserModel user; - - const AvatarTileFrom({required this.user, super.key}); - - @override - Widget build(BuildContext context) { - return ListTile( - titleAlignment: ListTileTitleAlignment.top, - title: Center( - child: Padding( - padding: const EdgeInsets.only(top: 8, bottom: 32), - child: AvatarForm(avatar: user.avatar?.imageUrl), - ), - ), - ); - } -} - class UserInfoCard extends StatelessWidget { final UserModel user; @@ -50,33 +31,44 @@ class UserInfoCard extends StatelessWidget { @override Widget build(BuildContext context) { return Padding( - padding: EdgeInsets.only(bottom: Platform.isIOS ? 0.0 : 4.0), - child: SizedBox( - width: double.infinity, - height: double.infinity, + padding: EdgeInsets.only(bottom: Platform.isIOS ? 0.0 : 4.0), child: Card( - child: Padding( - padding: const EdgeInsets.all(15), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - AvatarTileFrom(user: user), - UsernameForm(userLogin: user.login), - const SizedBox(height: columnItemMargin), - UserPhoneForm(userPhone: user.phone), - const SizedBox(height: columnItemMargin), - UserEmailForm(userEmail: user.email), - const SizedBox(height: columnItemMargin), - Expanded( - child: Align( - alignment: Alignment.bottomLeft, - child: _StartConversationForm(user: user))) - ], - ), - ), - ), - ), - ); + child: Padding( + padding: const EdgeInsets.all(15), + child: Stack(children: [ + Align( + alignment: const Alignment(0, -0.5), + child: IntrinsicHeight( + child: Stack(children: [ + Card( + color: paleMallow, + margin: const EdgeInsets.only(top: 40), + child: Padding( + padding: const EdgeInsets.only( + top: 50, left: 4, right: 4, bottom: 30), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + UsernameForm(userLogin: user.login), + const SizedBox(height: columnItemMargin), + UserPhoneForm(userPhone: user.phone), + const SizedBox(height: columnItemMargin), + UserEmailForm(userEmail: user.email), + ], + ), + ), + ), + Align( + alignment: const Alignment(0, -1.03), + child: AvatarForm(avatar: user.avatar?.imageUrl), + ), + ]), + ), + ), + Align( + alignment: Alignment.bottomRight, + child: _StartConversationForm(user: user)) + ])))); } } @@ -106,9 +98,11 @@ class _StartConversationForm extends StatelessWidget { ); } }, - child: TextButton( - child: const Text("Start a conversation", + child: TextButton.icon( + label: const Text("Start a conversation", style: TextStyle(fontSize: 20, color: slateBlue)), + icon: const Icon(Icons.arrow_forward, color: slateBlue, size: 25), + iconAlignment: IconAlignment.end, onPressed: () => context.read().add( ConversationCreated(user: user, type: 'u'), ))); diff --git a/sama_chat_client/lib/src/features/user_info/view/user_info_page.dart b/sama_chat_client/lib/src/features/user_info/view/user_info_page.dart index c00355dd..c1a21472 100644 --- a/sama_chat_client/lib/src/features/user_info/view/user_info_page.dart +++ b/sama_chat_client/lib/src/features/user_info/view/user_info_page.dart @@ -14,7 +14,7 @@ class UserInfoPage extends StatelessWidget { const UserInfoPage({required this.user, super.key}); static BlocProvider route(Object? extra) { - UserModel user = extra as UserModel; + UserModel user = extra != null ? extra as UserModel : UserModel(); return BlocProvider( create: (context) => ConversationCreateBloc( conversationRepository: diff --git a/sama_chat_client/lib/src/shared/ui/view/participants_forms.dart b/sama_chat_client/lib/src/shared/ui/view/participants_forms.dart index 8bf36835..ebf09f0f 100644 --- a/sama_chat_client/lib/src/shared/ui/view/participants_forms.dart +++ b/sama_chat_client/lib/src/shared/ui/view/participants_forms.dart @@ -218,6 +218,7 @@ class _ParticipantsListItem extends StatelessWidget { ), child: Stack(fit: StackFit.loose, children: [ Card( + color: removable ? null : gainsborough, elevation: 4.0, margin: const EdgeInsets.all(4.0), child: Padding( @@ -256,9 +257,9 @@ class _ParticipantsListItem extends StatelessWidget { onTap: () { onRemoveParticipants(user); }, - child: const Icon(Icons.cancel_outlined, + child: const Icon(Icons.cancel, size: 18, - color: semiBlack, + color: slateBlue, fontWeight: FontWeight.w100), ))) : const SizedBox.shrink(), diff --git a/sama_chat_client/lib/src/shared/ui/view/text_button_forms.dart b/sama_chat_client/lib/src/shared/ui/view/text_button_forms.dart index 699a0dbf..436f7374 100644 --- a/sama_chat_client/lib/src/shared/ui/view/text_button_forms.dart +++ b/sama_chat_client/lib/src/shared/ui/view/text_button_forms.dart @@ -5,7 +5,7 @@ import '../colors.dart'; class TextFieldForm extends StatelessWidget { final ValueChanged onChanged; final IconData iconData; - final String hint; + final String text; final TextInputType? keyboardType; final String? error; final Widget? suffix; @@ -15,7 +15,7 @@ class TextFieldForm extends StatelessWidget { {super.key, required this.onChanged, required this.iconData, - required this.hint, + required this.text, this.keyboardType, this.error, this.suffix, @@ -52,7 +52,7 @@ class TextFieldForm extends StatelessWidget { ), Expanded( child: Text( - error ?? hint, + error ?? text, style: TextStyle( color: error != null ? red : dullGray, fontSize: 16), overflow: TextOverflow.ellipsis, @@ -72,14 +72,16 @@ class ButtonForm extends StatelessWidget { final VoidCallback? onPressed; final WidgetStateProperty? backgroundColor; final WidgetStateProperty? foregroundColor; - final String hint; + final String text; + final TextStyle? textStyle; const ButtonForm( {super.key, required this.onPressed, required this.backgroundColor, required this.foregroundColor, - required this.hint}); + required this.text, + this.textStyle}); @override Widget build(BuildContext context) { @@ -102,7 +104,10 @@ class ButtonForm extends StatelessWidget { ), ), onPressed: onPressed, - child: Text(hint), + child: Text( + text, + style: textStyle, + ), ), ); }