mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 01:56:24 +00:00
added position elements to space
This commit is contained in:
55
lib/pages/spaces_management/view/plus_button_widget.dart
Normal file
55
lib/pages/spaces_management/view/plus_button_widget.dart
Normal file
@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
|
||||
class PlusButtonWidget extends StatelessWidget {
|
||||
final int index;
|
||||
final String direction;
|
||||
final Offset offset;
|
||||
final Size screenSize;
|
||||
final Function(int index, Offset newPosition, String direction) onButtonTap;
|
||||
|
||||
const PlusButtonWidget({
|
||||
Key? key,
|
||||
required this.index,
|
||||
required this.direction,
|
||||
required this.offset,
|
||||
required this.screenSize,
|
||||
required this.onButtonTap,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Positioned(
|
||||
left: offset.dx,
|
||||
top: offset.dy,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Offset newPosition;
|
||||
switch (direction) {
|
||||
case 'left':
|
||||
newPosition = Offset(-200, 0);
|
||||
break;
|
||||
case 'right':
|
||||
newPosition = Offset(200, 0);
|
||||
break;
|
||||
case 'down':
|
||||
newPosition = Offset(0, 150);
|
||||
break;
|
||||
default:
|
||||
newPosition = Offset.zero;
|
||||
}
|
||||
onButtonTap(index, newPosition, direction);
|
||||
},
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: const BoxDecoration(
|
||||
color: ColorsManager.secondaryColor,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(Icons.add, color: Colors.white, size: 20),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user