logo_widget.dart 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import 'package:track_common/widget/prelude.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.imagesIcLoginLogo, package: package, 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, required this.codeRetryLeft, required this.onPressed});
  35. @override
  36. Widget build(BuildContext context) {
  37. final isEnable = codeRetryLeft.inSeconds <= 0;
  38. final onPressed = isEnable ? this.onPressed : () {};
  39. final bkColor =
  40. isEnable ? const Color(0xff19be30) : const Color(0xffc2c2c2);
  41. final foregroundColor = isEnable ? Colors.white : Colors.white;
  42. final text = isEnable ? '获取验证码' : '请稍后(${codeRetryLeft.inSeconds})';
  43. return ElevatedButton(
  44. onPressed: onPressed,
  45. style: ElevatedButton.styleFrom(
  46. backgroundColor: bkColor,
  47. shape: RoundedRectangleBorder(
  48. borderRadius: BorderRadius.circular(2.0)),
  49. foregroundColor: foregroundColor,
  50. padding: EdgeInsets.zero),
  51. child: Text(text));
  52. }
  53. }
  54. class SignInButton extends StatelessWidget {
  55. final double? height;
  56. final double? width;
  57. final VoidCallback? onPressed;
  58. final Widget? child;
  59. final Color color1;
  60. final Color color2;
  61. const SignInButton({
  62. super.key,
  63. required this.onPressed,
  64. required this.child,
  65. required this.color1,
  66. required this.color2,
  67. this.width,
  68. this.height,
  69. });
  70. @override
  71. Widget build(BuildContext context) {
  72. return GestureDetector(
  73. onTap: onPressed,
  74. child: Container(
  75. height: height,
  76. width: width,
  77. alignment: Alignment.center,
  78. decoration: BoxDecoration(
  79. gradient: LinearGradient(colors: [
  80. color1,
  81. color2,
  82. ]),
  83. borderRadius: BorderRadius.circular(6.0)),
  84. child: child,
  85. ));
  86. }
  87. }