You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App/lib/widgets/others/floating_button_search.dart

99 lines
3.0 KiB
Dart

import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart';
import 'package:diplomaticquarterapp/widgets/robo-search/search.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class FloatingSearchButton extends StatefulWidget {
@override
_FloatingSearchButton createState() => _FloatingSearchButton();
}
class _FloatingSearchButton extends State<FloatingSearchButton>
with TickerProviderStateMixin {
Offset position = Offset(30.0, 40.0);
AlignmentDirectional _ironManAlignment = AlignmentDirectional(0.0, 0.7);
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return Positioned(
left: position.dx,
top: position.dy,
child: Draggable(
feedback: Container(child: getStack()),
child: Container(
child: AnimatedContainer(
duration: Duration(seconds: 2),
alignment: _ironManAlignment,
child: getStack(),
)),
childWhenDragging: Container(
color: Colors.transparent,
),
onDragEnd: (details) {
setState(() {
position = details.offset;
});
}));
// Draggable(
// feedback: getStack(),
// childWhenDragging: Container(),
// child: getStack(),
// onDragEnd: (drag) {
// setState(() {
// top = top + drag.offset.dy < 0 ? 0 : top + drag.offset.dy;
// left = left + drag.offset.dx < 0 ? 0 : left + drag.offset.dx;
// });
// });
}
Widget getStack() {
return Container(
height: 150,
width: 150,
child: Stack(
children: <Widget>[
Positioned(
top: 10,
right: 0,
child: GestureDetector(
onTap: () {
print("hi");
setState(() {
_ironManAlignment = AlignmentDirectional(0.0, -0.20);
});
}, // handle your image tap here
child: Image.asset(
'assets/images/CloseIcon.png',
fit: BoxFit.cover, // this is the solution for border
width: 30.0,
height: 30.0,
)),
),
GestureDetector(
onTap: () {
// animationController.forward();
}, // handle your image tap here
child: SvgPicture.asset('assets/images/robort_svg.svg'))
// new RawMaterialButton(
// // shape: new CircleBorder(),
// elevation: 1.0,
// child: SvgPicture.asset('assets/images/robort_svg.svg'),
// onPressed: () {},
// ),
],
));
}
roboSearch(context) {
var dialog = RoboSearch(context: context);
dialog.showAlertDialog(context);
}
}