mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
56 lines
1.4 KiB
Dart
56 lines
1.4 KiB
Dart
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({
|
|
super.key,
|
|
required this.index,
|
|
required this.direction,
|
|
required this.offset,
|
|
required this.screenSize,
|
|
required this.onButtonTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Positioned(
|
|
left: offset.dx,
|
|
top: offset.dy,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Offset newPosition;
|
|
switch (direction) {
|
|
case 'left':
|
|
newPosition = const Offset(-200, 0);
|
|
break;
|
|
case 'right':
|
|
newPosition = const Offset(200, 0);
|
|
break;
|
|
case 'down':
|
|
newPosition = const 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),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|