-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add breathing effect to recent activity on desktop
- Loading branch information
1 parent
43071c0
commit c8a868a
Showing
3 changed files
with
179 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class Breathing extends StatefulWidget { | ||
const Breathing({super.key, required this.child}); | ||
|
||
final Widget child; | ||
|
||
@override | ||
State<Breathing> createState() => _BreathingState(); | ||
} | ||
|
||
class _BreathingState extends State<Breathing> { | ||
bool _hovering = false; | ||
@override | ||
Widget build(BuildContext context) { | ||
return MouseRegion( | ||
onEnter: (_) => setState( | ||
() => _hovering = true, | ||
), | ||
onExit: (_) => setState( | ||
() => _hovering = false, | ||
), | ||
child: AnimatedScale( | ||
scale: _hovering ? 1.00 : 0.98, | ||
duration: const Duration( | ||
milliseconds: 200, | ||
), | ||
child: widget.child, | ||
), | ||
); | ||
} | ||
} |