cursor_follow 0.0.0 cursor_follow: ^0.0.0 copied to clipboard
A cursor follow in desktop
example/lib/main.dart
// ignore_for_file: library_private_types_in_public_api
import 'package:cursor_follow/cursor_follow.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const AnimatedCursor(child: MyHomePage(title: 'Flutter Demo Home Page')),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
AnimatedCursorMouseRegion(
decoration: BoxDecoration(
border: Border.all(color: Colors.white54, width: 2),
borderRadius: BorderRadius.circular(8),
color: Colors.white10,
),
child: CupertinoButton(
color: Colors.redAccent,
onPressed: () {
if (kDebugMode) {
print('Hello');
}
},
child: const Text('Click me!'),
),
),
const SizedBox(height: 50),
AnimatedCursorMouseRegion(
decoration: BoxDecoration(
border: Border.all(color: Colors.white54, width: 2),
color: Colors.white10,
),
child: Container(
height: 50,
width: 50,
color: Colors.blue,
child: const Center(child: Text('Hello')),
),
),
],
),
),
);
}
}