fixed save button position

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

View File

@ -70,12 +70,16 @@ class CommunityStructureHeader extends StatelessWidget {
), ),
if (communityName != null) if (communityName != null)
Row( Row(
children: [
Expanded(
child: Row(
children: [ children: [
if (!isEditingName) if (!isEditingName)
Flexible( Flexible(
child: Text( child: Text(
communityName!, communityName!,
style: theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor), style:
theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
), ),
@ -89,11 +93,12 @@ class CommunityStructureHeader extends StatelessWidget {
border: InputBorder.none, border: InputBorder.none,
isDense: true, isDense: true,
), ),
style: theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor), style:
theme.textTheme.bodyLarge?.copyWith(color: ColorsManager.blackColor),
onSubmitted: onNameSubmitted, onSubmitted: onNameSubmitted,
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 2),
GestureDetector( GestureDetector(
onTap: onEditName, onTap: onEditName,
child: SvgPicture.asset( child: SvgPicture.asset(
@ -102,8 +107,13 @@ class CommunityStructureHeader extends StatelessWidget {
height: 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),
],
], ],
), ),
], ],
@ -119,18 +129,16 @@ class CommunityStructureHeader extends StatelessWidget {
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),