mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
Init repo
This commit is contained in:
commit
764b6034e3
566 changed files with 212335 additions and 0 deletions
40
lib/util/mouse_parking.dart
Normal file
40
lib/util/mouse_parking.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class MouseParking extends ConsumerStatefulWidget {
|
||||
final Function(PointerEvent)? onHover;
|
||||
const MouseParking({this.onHover, super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<ConsumerStatefulWidget> createState() => _MouseParkingState();
|
||||
}
|
||||
|
||||
class _MouseParkingState extends ConsumerState<MouseParking> {
|
||||
bool parked = false;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: MouseRegion(
|
||||
onEnter: (event) => setState(() => parked = true),
|
||||
onExit: (event) => setState(() => parked = false),
|
||||
onHover: widget.onHover,
|
||||
cursor: SystemMouseCursors.none,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(20)),
|
||||
color: parked ? Theme.of(context).colorScheme.primary.withOpacity(0.5) : Colors.black12,
|
||||
),
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.mouse_rounded),
|
||||
Icon(Icons.local_parking),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue