-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from takenet/release/0.3.1
Release/0.3.1
- Loading branch information
Showing
8 changed files
with
155 additions
and
53 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,44 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class DSHighlightController extends GetxController { | ||
final List<Map<String, AnimationController>> _animations = []; | ||
|
||
void highlight(final String key) { | ||
Future.delayed( | ||
const Duration(milliseconds: 600), | ||
() => _highlight(key), | ||
); | ||
} | ||
|
||
AnimationController? getController(final String key) { | ||
return _animations | ||
.firstWhereOrNull( | ||
(element) => element.keys.first.contains(key.toString())) | ||
?.values | ||
.first; | ||
} | ||
|
||
void add(final String key, final AnimationController controller) => | ||
_animations.add( | ||
{ | ||
key.toString(): controller, | ||
}, | ||
); | ||
|
||
void _highlight(final String key) { | ||
var controller = _animations | ||
.firstWhereOrNull( | ||
(element) => element.keys.first.contains(key.toString())) | ||
?.values | ||
.first; | ||
|
||
if (controller != null) { | ||
controller.value = 1; | ||
Future.delayed( | ||
Duration(seconds: 2), | ||
() => controller.value = 0, | ||
); | ||
} | ||
} | ||
} |
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,47 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../../controllers/chat/ds_highlight.controller.dart'; | ||
|
||
class DSHighlight extends StatefulWidget { | ||
final Widget child; | ||
final DSHighlightController controller; | ||
|
||
const DSHighlight({ | ||
super.key, | ||
required this.child, | ||
required this.controller, | ||
}); | ||
|
||
@override | ||
State<DSHighlight> createState() => _DSTesteState(); | ||
} | ||
|
||
class _DSTesteState extends State<DSHighlight> with TickerProviderStateMixin { | ||
late AnimationController? animationController; | ||
|
||
@override | ||
void initState() { | ||
animationController = | ||
widget.controller.getController(widget.key.toString()); | ||
|
||
if (animationController == null) { | ||
animationController = AnimationController(vsync: this); | ||
widget.controller.add(widget.key.toString(), animationController!); | ||
} | ||
|
||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return DecoratedBoxTransition( | ||
decoration: DecorationTween( | ||
begin: BoxDecoration(), | ||
end: BoxDecoration( | ||
color: Colors.black.withValues(alpha: 0.1), | ||
), | ||
).animate(animationController!), | ||
child: widget.child, | ||
); | ||
} | ||
} |
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