common_elements.dart 2.2 KB

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