floating_draggable_advn 1.0.6
floating_draggable_advn: ^1.0.6 copied to clipboard
A flutter package for floating draggable widget. By this package a developer can implement a widget which can be draggable inside the screen freely.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:floating_draggable_advn/floating_draggable_advn.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Floating Draggable Widget',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool isShowMessage = true;
@override
void initState() {
// Future.delayed(const Duration(seconds: 10), () {
// setState(() {
// isShowMessage = false;
// });
// });
super.initState();
}
@override
Widget build(BuildContext context) {
return FloatingDraggableADVN(
floatingWidgets: [
FloatingActionButton(
onPressed: () {},
backgroundColor: Colors.transparent,
child: Image.asset("assets/images/chatbot.gif"),
),
FloatingActionButton(
onPressed: () {},
backgroundColor: Colors.transparent,
child: Image.asset("assets/images/vong_xoay.gif"),
)
],
floatingWidgetPositions: const [
Offset(200, 200),
Offset(300, 400),
],
// floatingWidget: FloatingActionButton(
// onPressed: () {},
// backgroundColor: Colors.transparent,
// child: Image.asset("assets/images/chatbot.gif"),
// ),
// floatingWidgetHeight: 90,
// floatingWidgetWidth: 90,
floatingWidgetHeights: const [90, 90],
floatingWidgetWidths: const [90, 60],
// deleteWidgetDecoration: const BoxDecoration(
// gradient: LinearGradient(
// colors: [Colors.white12, Colors.grey],
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// stops: [.0, 1],
// ),
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(50),
// topRight: Radius.circular(50),
// ),
// ),
// onDeleteWidget: () {
// debugPrint('Widget deleted');
// },
// deleteWidget: Container(
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// border: Border.all(width: 2, color: Colors.black87),
// ),
// child: const Icon(Icons.close, color: Colors.black87),
// ),
child: Scaffold(
appBar: AppBar(
title: const Text('Floating Animated Widget'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Floating Animated Widget',
style: Theme.of(context).textTheme.headline6,
),
],
),
),
),
);
}
}