step_nickname_view.dart 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import 'package:flutter/src/widgets/framework.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:keyboard/base/base_view.dart';
  4. import 'package:keyboard/module/new_user/new_user_controller.dart';
  5. import 'package:flutter/material.dart';
  6. import '../../../../resource/string.gen.dart';
  7. class StepNicknameView extends BaseView<NewUserController>{
  8. const StepNicknameView({super.key});
  9. @override
  10. Color backgroundColor() {
  11. return Colors.transparent;
  12. }
  13. @override
  14. Widget buildBody(BuildContext context) {
  15. return Column(
  16. crossAxisAlignment: CrossAxisAlignment.start,
  17. children: [
  18. Container(
  19. margin: EdgeInsets.only(left: 30.w, right: 30.w),
  20. child: Column(
  21. crossAxisAlignment: CrossAxisAlignment.start,
  22. children: [
  23. Text(
  24. StringName.newUserNicknameTitle,
  25. style: TextStyle(
  26. color: Colors.black.withAlpha(204),
  27. fontSize: 22.sp,
  28. fontWeight: FontWeight.w500,
  29. height: 0,
  30. ),
  31. ),
  32. SizedBox(height: 7.h),
  33. Text(
  34. StringName.newUserNicknameDesc,
  35. style: TextStyle(
  36. color: Colors.black.withAlpha(153),
  37. fontSize: 14.sp,
  38. fontWeight: FontWeight.w400,
  39. ),
  40. ),
  41. ],
  42. ),
  43. ),
  44. SizedBox(height: 72.w),
  45. _buildContent(context),
  46. ],
  47. );
  48. }
  49. Widget _buildContent(BuildContext context) {
  50. return Container(
  51. margin: EdgeInsets.only( left: 27.w, right: 27.w),
  52. alignment: Alignment.center,
  53. child: Container(
  54. height: 48.h,
  55. alignment: Alignment.center,
  56. child: TextField(
  57. controller: controller.textEditingController,
  58. // maxLength: maxLength,
  59. maxLines: 1,
  60. onChanged: (value) {
  61. controller.nickname.value = value;
  62. },
  63. cursorColor: Color(0xFF7B7DFF),
  64. textAlign: TextAlign.center,
  65. textAlignVertical: TextAlignVertical.center,
  66. decoration: InputDecoration(
  67. counterText: "",
  68. hintText: "请输入你的昵称",
  69. hintStyle: TextStyle(
  70. color: Colors.black.withAlpha(77),
  71. fontSize: 18.sp,
  72. fontWeight: FontWeight.w500,
  73. ),
  74. border: UnderlineInputBorder(
  75. borderSide: BorderSide(
  76. color: Colors.black.withAlpha(26),
  77. width: 1.w,
  78. ),
  79. ),
  80. focusedBorder: UnderlineInputBorder(
  81. borderSide: BorderSide(
  82. color: Colors.black.withAlpha(26),
  83. width: 1.w,
  84. ),
  85. ),
  86. enabledBorder: UnderlineInputBorder(
  87. borderSide: BorderSide(
  88. color: Colors.black.withAlpha(26),
  89. width: 1.w,
  90. ),
  91. ),
  92. filled: true,
  93. fillColor: Colors.transparent,
  94. ),
  95. ),
  96. ),
  97. );
  98. }
  99. }