common_elements.dart 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/widgets.dart';
  3. Widget nothingToSeeHere({Color textColor}) {
  4. return Center(
  5. child: Padding(
  6. padding: const EdgeInsets.all(8.0),
  7. child: Text(
  8. "Nothing to see here! 👀",
  9. style: TextStyle(
  10. color: textColor.withOpacity(0.35),
  11. ),
  12. ),
  13. ),
  14. );
  15. }
  16. Widget button(
  17. String text, {
  18. double fontSize = 14,
  19. VoidCallback onPressed,
  20. double lineHeight,
  21. EdgeInsets padding,
  22. }) {
  23. return InkWell(
  24. child: OutlinedButton(
  25. style: OutlinedButton.styleFrom(
  26. shape: RoundedRectangleBorder(
  27. borderRadius: BorderRadius.circular(8),
  28. ),
  29. padding: padding ?? EdgeInsets.fromLTRB(50, 16, 50, 16),
  30. textStyle: TextStyle(
  31. fontWeight: FontWeight.w600,
  32. fontFamily: 'Inter-SemiBold',
  33. fontSize: fontSize,
  34. height: lineHeight,
  35. ),
  36. ).copyWith(
  37. backgroundColor: MaterialStateProperty.resolveWith<Color>(
  38. (Set<MaterialState> states) {
  39. if (states.contains(MaterialState.disabled)) {
  40. return Colors.grey;
  41. }
  42. // return Color.fromRGBO(29, 184, 80, 1);
  43. return Colors.white;
  44. },
  45. ),
  46. foregroundColor: MaterialStateProperty.resolveWith<Color>(
  47. (Set<MaterialState> states) {
  48. if (states.contains(MaterialState.disabled)) {
  49. return Colors.white;
  50. }
  51. return Colors.black;
  52. },
  53. ),
  54. alignment: Alignment.center,
  55. ),
  56. child: Text(text),
  57. onPressed: onPressed,
  58. ),
  59. );
  60. }
  61. final emptyContainer = const SizedBox.shrink();
  62. Animatable<Color> passwordStrengthColors = TweenSequence<Color>(
  63. [
  64. TweenSequenceItem(
  65. weight: 1.0,
  66. tween: ColorTween(
  67. begin: Colors.red,
  68. end: Colors.yellow,
  69. ),
  70. ),
  71. TweenSequenceItem(
  72. weight: 1.0,
  73. tween: ColorTween(
  74. begin: Colors.yellow,
  75. end: Colors.lightGreen,
  76. ),
  77. ),
  78. TweenSequenceItem(
  79. weight: 1.0,
  80. tween: ColorTween(
  81. begin: Colors.lightGreen,
  82. end: Color.fromRGBO(45, 194, 98, 1.0),
  83. ),
  84. ),
  85. ],
  86. );