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 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: [ 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); } }