Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. class ReachableIcon extends StatefulWidget {
  2. final Widget child;
  3. final int index;
  4. final VoidCallback onSelect;
  5.  
  6. ReachableIcon({
  7. @required this.child,
  8. @required this.index,
  9. @required this.onSelect,
  10. });
  11.  
  12. @override
  13. _ReachableIconState createState() => _ReachableIconState();
  14. }
  15.  
  16. class _ReachableIconState extends State<ReachableIcon> {
  17. bool _isFocused = false;
  18.  
  19. @override
  20. Widget build(BuildContext context) {
  21. return Reachable(
  22. index: widget.index,
  23. onSelect: widget.onSelect,
  24. onFocusChanged: (isFocused) {
  25. setState(() => _isFocused = isFocused);
  26. },
  27. child: AnimatedContainer(
  28. duration: Duration(milliseconds: 200),
  29. decoration: BoxDecoration(
  30. color: _isFocused ? Colors.black45 : Colors.transparent,
  31. shape: BoxShape.circle,
  32. ),
  33. padding: EdgeInsets.all(16),
  34. alignment: Alignment.center,
  35. child: widget.child,
  36. ),
  37. );
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement