Refactor SpaceDetailsActionButtons and SpaceIconPicker: Adjust layout properties for improved responsiveness and user experience. Set mainAxisSize to min in SpaceDetailsActionButtons and simplify the layout in SpaceIconPicker for better alignment and interaction. This enhances maintainability and adheres to Clean Architecture principles.

This commit is contained in:
Faris Armoush
2025-07-03 16:15:31 +03:00
parent b857736e10
commit 757a96ed9f
2 changed files with 48 additions and 51 deletions

View File

@ -16,6 +16,7 @@ class SpaceDetailsActionButtons extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 10, spacing: 10,
children: [ children: [

View File

@ -17,64 +17,60 @@ class SpaceIconPicker extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Center(
mainAxisAlignment: MainAxisAlignment.center, child: Stack(
children: [
const SizedBox(height: 50), alignment: Alignment.center,
Stack( children: [
alignment: Alignment.center, Container(
children: [ width: context.screenWidth * 0.175,
Container( height: context.screenHeight * 0.175,
width: context.screenWidth * 0.1, decoration: const BoxDecoration(
height: context.screenWidth * 0.1, color: ColorsManager.boxColor,
decoration: const BoxDecoration( shape: BoxShape.circle,
color: ColorsManager.boxColor,
shape: BoxShape.circle,
),
), ),
SvgPicture.asset( padding: const EdgeInsets.all(24),
child: SvgPicture.asset(
iconPath, iconPath,
width: context.screenWidth * 0.04, width: context.screenWidth * 0.08,
height: context.screenWidth * 0.04, height: context.screenHeight * 0.08,
), ),
Positioned( ),
top: 20, Positioned.directional(
right: 20, top: 12,
child: InkWell( start: context.screenHeight * 0.06,
onTap: () { textDirection: Directionality.of(context),
showDialog<String?>( child: InkWell(
context: context, onTap: () {
builder: (context) => SpaceIconSelectionDialog( showDialog<String?>(
selectedIcon: iconPath, context: context,
), builder: (context) => SpaceIconSelectionDialog(
).then((value) { selectedIcon: iconPath,
if (value != null) { ),
if (context.mounted) { ).then((value) {
context.read<SpaceDetailsModelBloc>().add( if (value != null) {
UpdateSpaceDetailsIcon(value), if (context.mounted) {
); context.read<SpaceDetailsModelBloc>().add(
} UpdateSpaceDetailsIcon(value),
);
} }
}); }
}, });
child: Container( },
width: 24, child: Container(
height: 24, decoration: const BoxDecoration(
decoration: const BoxDecoration( shape: BoxShape.circle,
color: Colors.white, ),
shape: BoxShape.circle, child: SvgPicture.asset(
), Assets.iconEdit,
child: SvgPicture.asset( width: 16,
Assets.iconEdit, height: 16,
width: 16,
height: 16,
),
), ),
), ),
), ),
], ),
), ],
], ),
); );
} }
} }