button_cancel.dart 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import 'package:flutter/material.dart';
  2. class CancelButton extends StatelessWidget {
  3. final VoidCallback callback;
  4. final String content;
  5. final double width;
  6. final double height;
  7. final double fontSize;
  8. CancelButton({
  9. @required this.callback,
  10. @required this.content,
  11. this.width = double.infinity,
  12. this.height = 44,
  13. this.fontSize = 28,
  14. });
  15. @override
  16. Widget build(BuildContext context) {
  17. return InkWell(
  18. onTap: this.callback,
  19. child: Container(
  20. width: width,
  21. height: height,
  22. decoration: BoxDecoration(
  23. color: Color(0xffF1F1F1),
  24. borderRadius: BorderRadius.all(Radius.circular(100)),
  25. ),
  26. child: Container(
  27. alignment: Alignment.center,
  28. child: Text(
  29. content,
  30. style: TextStyle(color: Color(0xff666666), fontSize: 14),
  31. ),
  32. ),
  33. ),
  34. );
  35. }
  36. }
  37. class FeelCancelButton extends StatelessWidget {
  38. final VoidCallback callback;
  39. final String content;
  40. final double width;
  41. final double height;
  42. final double fontSize;
  43. final Color color;
  44. final Color borderColor;
  45. final Color textColor;
  46. static const finalColor = Color(0xffffffff);
  47. static const finalBorderColor = Color(0xFFFFC400);
  48. static const finalTextColor = Color(0xFFFFC400);
  49. FeelCancelButton(
  50. {@required this.callback,
  51. @required this.content,
  52. this.width = double.infinity,
  53. this.height = 44,
  54. this.fontSize = 28,
  55. this.color = finalColor,
  56. this.textColor = finalTextColor,
  57. this.borderColor = finalBorderColor});
  58. @override
  59. Widget build(BuildContext context) {
  60. return InkWell(
  61. onTap: this.callback,
  62. child: Container(
  63. width: width,
  64. height: height,
  65. decoration: BoxDecoration(
  66. color: color,
  67. borderRadius: BorderRadius.all(Radius.circular(100)),
  68. border: Border.all(
  69. color: finalBorderColor,
  70. width: .5,
  71. ),
  72. ),
  73. child: Container(
  74. alignment: Alignment.center,
  75. child: Text(
  76. content,
  77. style: TextStyle(color: textColor, fontSize: 14),
  78. ),
  79. ),
  80. ),
  81. );
  82. }
  83. }