step_nickname_view.dart 3.2 KB

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