项目作者: HitenDev

项目描述 :
flutter animation effects | custom widget | custom renderobject
高级语言: Dart
项目地址: git://github.com/HitenDev/flutter_effects.git
创建时间: 2019-03-07T10:00:54Z
项目社区:https://github.com/HitenDev/flutter_effects

开源协议:Apache License 2.0

下载


flutter effects

A flutter package which contains a collection of some cool and beautiful effects; support android and ios .

Screenshot

type support child screenshot
diffscale text
borderline any
rainbow text
explosion any
anvil any
scratchcard any
more more waiting

Usage

diffscale

  1. void initState() {
  2. super.initState();
  3. sentences = [
  4. "What is design?",
  5. "Design is not just",
  6. "what it looks like and feels like.",
  7. "Design is how it works. \n- Steve Jobs",
  8. "Older people",
  9. "sit down and ask,",
  10. "'What is it?'",
  11. "but the boy asks,",
  12. "What can I do with it?. \n- Steve Jobs",
  13. "Swift",
  14. "Objective-C",
  15. "iPhone",
  16. "iPad",
  17. "Mac Mini",
  18. "MacBook Pro",
  19. "Mac Pro",
  20. "爱老婆",
  21. "老婆和女儿"
  22. ];
  23. }
  24. DiffScaleText(
  25. text: sentences[diffScaleNext % sentences.length],
  26. textStyle: TextStyle(fontSize: 20, color: Colors.blue),
  27. )

Note:the variable diffScaleNext control next position;

borderline

  1. LineBorderText(
  2. child: Text(
  3. "Border Effect",
  4. style: TextStyle(fontSize: 20),
  5. ),
  6. autoAnim: true)

rainbow

  1. RainbowText(colors: [
  2. Color(0xFFFF2B22),
  3. Color(0xFFFF7F22),
  4. Color(0xFFEDFF22),
  5. Color(0xFF22FF22),
  6. Color(0xFF22F4FF),
  7. Color(0xFF5400F7),
  8. ], text: "Welcome to BBT", loop: true)

explosion

  1. ExplosionWidget(
  2. tag: "Explosion Text",
  3. child: Container(
  4. alignment: Alignment.center,
  5. color: Colors.blueAccent,
  6. child: Text(
  7. "Explosion Text",
  8. style: TextStyle(
  9. fontSize: 20,
  10. color: Colors.red,
  11. fontWeight: FontWeight.bold),
  12. )))

anvil

  1. AnvilEffectWidget(child: Text(
  2. "👉AnvilEffect👈",
  3. style: TextStyle(color: Colors.white, fontSize: 20),
  4. )

scratchcard

  1. ScratchCardWidget(
  2. strokeWidth: 20,
  3. threshold: 0.5,
  4. foreground: (canvas, size, offset) {
  5. if (_image != null) {
  6. double scale;
  7. double dx = 0;
  8. double dy = 0;
  9. if (_image.width * size.height >
  10. size.width * _image.height) {
  11. scale = size.height / _image.height;
  12. dx = (size.width - _image.width * scale) / 2;
  13. } else {
  14. scale = size.width / _image.width;
  15. dy = (size.height - _image.height * scale) / 2;
  16. }
  17. canvas.save();
  18. canvas.translate(dx, dy);
  19. canvas.scale(scale, scale);
  20. canvas.drawImage(_image, Offset(0, 0), new Paint());
  21. canvas.restore();
  22. } else {
  23. canvas.drawRect(
  24. Rect.fromLTWH(0, 0, size.width, size.height),
  25. Paint()
  26. ..color = Colors.grey);
  27. }
  28. },
  29. child: Container(
  30. color: Colors.blueAccent,
  31. alignment: Alignment.center,
  32. child: Image.asset(
  33. "assets/images/icon_sm_sigin_status_three.png",
  34. fit: BoxFit.scaleDown, height: 20,),
  35. ))
  • strokeWidth : paint’s strokewidth
  • threshold : the threshold to clear the foreground covering
  • foreground : draw foreground covering
  • child : draw child

More flutter effects are under development, so stay tuned! please follow me.
" class="reference-link">
More flutter effects are under development, so stay tuned! please follow me.

Author

License

This project is licensed under the Apache Software License, Version 2.0.

See LICENSE for full of the license text.