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)
Row(
children: [
if (!isEditingName)
Flexible(
child: Text(
communityName!,
style: theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
),
if (isEditingName)
SizedBox(
width: screenWidth * 0.3,
child: TextField(
controller: nameController,
decoration: const InputDecoration(
border: InputBorder.none,
isDense: true,
Expanded(
child: Row(
children: [
if (!isEditingName)
Flexible(
child: Text(
communityName!,
style:
theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
),
if (isEditingName)
SizedBox(
width: screenWidth * 0.3,
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) _buildActionButtons(theme),
if (isSave) ...[
const SizedBox(width: 8),
_buildActionButtons(theme),
],
],
),
],
@ -116,21 +126,19 @@ class CommunityStructureHeader extends StatelessWidget {
spacing: 10,
children: [
_buildButton(
label: "Save",
icon: const Icon(Icons.save, size: 18, color: ColorsManager.spaceColor),
onPressed: onSave,
theme: theme
),
label: "Save",
icon: const Icon(Icons.save, size: 18, color: ColorsManager.spaceColor),
onPressed: onSave,
theme: theme),
],
);
}
Widget _buildButton({
required String label,
required Widget icon,
required VoidCallback onPressed,
required ThemeData theme
}) {
Widget _buildButton(
{required String label,
required Widget icon,
required VoidCallback onPressed,
required ThemeData theme}) {
const double buttonHeight = 30;
return ConstrainedBox(
constraints: BoxConstraints(maxWidth: 80, minHeight: buttonHeight),