logo_widget.dart 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import 'package:flutter/material.dart';
  2. class LogoWidget extends StatelessWidget{
  3. const LogoWidget({super.key});
  4. @override
  5. Widget build(BuildContext context) {
  6. return SizedBox(
  7. width: double.infinity,
  8. child: Column(
  9. mainAxisAlignment: MainAxisAlignment.start,
  10. crossAxisAlignment: CrossAxisAlignment.center,
  11. children: [
  12. const SizedBox(height: 60),
  13. Image.asset('assets/images/sign_in_logo.png', height: 54),
  14. const SizedBox(
  15. height: 23,
  16. )
  17. ],
  18. ),
  19. );
  20. }
  21. }
  22. class TextDecoration extends InputDecoration {
  23. const TextDecoration({required String hintText})
  24. : super(
  25. hintText: hintText,
  26. border: const OutlineInputBorder(),
  27. isDense: true,
  28. );
  29. }
  30. class GetCodeButton extends StatelessWidget {
  31. final Duration codeRetryLeft;
  32. final VoidCallback onPressed;
  33. const GetCodeButton(
  34. { super.key,
  35. required this.codeRetryLeft,
  36. required this.onPressed});
  37. @override
  38. Widget build(BuildContext context) {
  39. final isEnable = codeRetryLeft.inSeconds <= 0;
  40. final onPressed = isEnable ?
  41. this.onPressed
  42. : () {};
  43. final bkColor = isEnable ? const Color(0xff19be30) : const Color(
  44. 0xffc2c2c2);
  45. final foregroundColor = isEnable ? Colors.white : Colors.white;
  46. final text = isEnable ? '获取验证码' : '请稍后(${codeRetryLeft
  47. .inSeconds})';
  48. return ElevatedButton(
  49. onPressed: onPressed,
  50. style: ElevatedButton.styleFrom(
  51. backgroundColor: bkColor,
  52. shape: RoundedRectangleBorder(
  53. borderRadius: BorderRadius.circular(2.0)),
  54. foregroundColor: foregroundColor,
  55. padding: EdgeInsets.zero),
  56. child: Text(text));
  57. }
  58. }
  59. class SignInButton extends StatelessWidget {
  60. final double? height;
  61. final double? width;
  62. final VoidCallback? onPressed;
  63. final Widget? child;
  64. final Color color1;
  65. final Color color2;
  66. const SignInButton({
  67. super.key,
  68. required this.onPressed,
  69. required this.child,
  70. required this.color1,
  71. required this.color2,
  72. this.width,
  73. this.height,
  74. });
  75. @override
  76. Widget build(BuildContext context) {
  77. return GestureDetector(
  78. onTap: onPressed,
  79. child:Container(
  80. height: height,
  81. width: width,
  82. alignment: Alignment.center,
  83. decoration: BoxDecoration(
  84. gradient: LinearGradient(colors: [
  85. color1,
  86. color2,
  87. ]),
  88. borderRadius: BorderRadius.circular(6.0)
  89. ),
  90. child: child,
  91. )
  92. );
  93. }
  94. }