fixed save button position

This commit is contained in:
hannathkadher
2024-11-27 11:45:19 +04:00
parent 35557193f5
commit ee50c414c3

View File

@ -71,39 +71,49 @@ class CommunityStructureHeader extends StatelessWidget {
if (communityName != null) if (communityName != null)
Row( Row(
children: [ children: [
if (!isEditingName) Expanded(
Flexible( child: Row(
child: Text( children: [
communityName!, if (!isEditingName)
style: theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor), Flexible(
overflow: TextOverflow.ellipsis, child: Text(
maxLines: 1, communityName!,
), style:
), theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor),
if (isEditingName) overflow: TextOverflow.ellipsis,
SizedBox( maxLines: 1,
width: screenWidth * 0.3, ),
child: TextField( ),
controller: nameController, if (isEditingName)
decoration: const InputDecoration( SizedBox(
border: InputBorder.none, width: screenWidth * 0.3,
isDense: true, child: TextField(
controller: nameController,
decoration: const InputDecoration(
border: InputBorder.none,
isDense: true,
),
style:
theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor),
onSubmitted: onNameSubmitted,
),
),
const SizedBox(width: 2),
GestureDetector(
onTap: onEditName,
child: SvgPicture.asset(
Assets.iconEdit,
width: 16,
height: 16,
),
), ),
style: theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor), ],
onSubmitted: onNameSubmitted,
),
),
const SizedBox(width: 8),
GestureDetector(
onTap: onEditName,
child: SvgPicture.asset(
Assets.iconEdit,
width: 16,
height: 16,
), ),
), ),
const Spacer(flex: 3), // Pushes the Save button to the right if (isSave) ...[
if (isSave) _buildActionButtons(theme), const SizedBox(width: 8),
_buildActionButtons(theme),
],
], ],
), ),
], ],
@ -116,21 +126,19 @@ class CommunityStructureHeader extends StatelessWidget {
spacing: 10, spacing: 10,
children: [ children: [
_buildButton( _buildButton(
label: "Save", label: "Save",
icon: const Icon(Icons.save, size: 18, color: ColorsManager.spaceColor), icon: const Icon(Icons.save, size: 18, color: ColorsManager.spaceColor),
onPressed: onSave, onPressed: onSave,
theme: theme theme: theme),
),
], ],
); );
} }
Widget _buildButton({ Widget _buildButton(
required String label, {required String label,
required Widget icon, required Widget icon,
required VoidCallback onPressed, required VoidCallback onPressed,
required ThemeData theme required ThemeData theme}) {
}) {
const double buttonHeight = 30; const double buttonHeight = 30;
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints(maxWidth: 80, minHeight: buttonHeight), constraints: BoxConstraints(maxWidth: 80, minHeight: buttonHeight),