magnetic 0.0.2 magnetic: ^0.0.2 copied to clipboard
The main attractive functionality of these widget is that they are magnetic and basically follow the mouse pointer when it moves on the button area and when the mouse leaves the button area it will re [...]
import 'package:flutter/material.dart';
import 'package:magnetic/magnetic.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: MagneticWidget(
duration: Duration(milliseconds: 100),
child: Icon(
Icons.thumb_up,
size: 100,
),
),
),
);
}
}