Refactor PlusButtonWidget and SpaceCardWidget to improve widget structure and interaction handling. Replace GestureDetector with IconButton for better usability and update positioning logic for the PlusButtonWidget, enhancing maintainability and readability.

This commit is contained in:
Faris Armoush
2025-07-15 13:11:22 +03:00
parent c60078c96a
commit e740652507
2 changed files with 11 additions and 21 deletions

View File

@ -2,31 +2,22 @@ import 'package:flutter/material.dart';
import 'package:syncrow_web/utils/color_manager.dart';
class PlusButtonWidget extends StatelessWidget {
final Offset offset;
final void Function() onButtonTap;
final void Function() onTap;
const PlusButtonWidget({
required this.onTap,
super.key,
required this.offset,
required this.onButtonTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onButtonTap,
child: Container(
width: 30,
height: 30,
decoration: const BoxDecoration(
color: ColorsManager.spaceColor,
shape: BoxShape.circle,
),
child: const Icon(
Icons.add,
color: ColorsManager.whiteColors,
size: 20,
),
return IconButton.filled(
onPressed: onTap,
style: IconButton.styleFrom(backgroundColor: ColorsManager.spaceColor),
icon: const Icon(
Icons.add,
color: ColorsManager.whiteColors,
size: 20,
),
);
}

View File

@ -29,10 +29,9 @@ class _SpaceCardWidgetState extends State<SpaceCardWidget> {
widget.buildSpaceContainer(),
if (isHovered)
Positioned(
bottom: 0,
bottom: -5,
child: PlusButtonWidget(
offset: Offset.zero,
onButtonTap: widget.onTap,
onTap: widget.onTap,
),
),
],