mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 22:09:40 +00:00
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:
@ -2,31 +2,22 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
class PlusButtonWidget extends StatelessWidget {
|
class PlusButtonWidget extends StatelessWidget {
|
||||||
final Offset offset;
|
final void Function() onTap;
|
||||||
final void Function() onButtonTap;
|
|
||||||
|
|
||||||
const PlusButtonWidget({
|
const PlusButtonWidget({
|
||||||
|
required this.onTap,
|
||||||
super.key,
|
super.key,
|
||||||
required this.offset,
|
|
||||||
required this.onButtonTap,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return IconButton.filled(
|
||||||
onTap: onButtonTap,
|
onPressed: onTap,
|
||||||
child: Container(
|
style: IconButton.styleFrom(backgroundColor: ColorsManager.spaceColor),
|
||||||
width: 30,
|
icon: const Icon(
|
||||||
height: 30,
|
Icons.add,
|
||||||
decoration: const BoxDecoration(
|
color: ColorsManager.whiteColors,
|
||||||
color: ColorsManager.spaceColor,
|
size: 20,
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: const Icon(
|
|
||||||
Icons.add,
|
|
||||||
color: ColorsManager.whiteColors,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,9 @@ class _SpaceCardWidgetState extends State<SpaceCardWidget> {
|
|||||||
widget.buildSpaceContainer(),
|
widget.buildSpaceContainer(),
|
||||||
if (isHovered)
|
if (isHovered)
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: -5,
|
||||||
child: PlusButtonWidget(
|
child: PlusButtonWidget(
|
||||||
offset: Offset.zero,
|
onTap: widget.onTap,
|
||||||
onButtonTap: widget.onTap,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user