step_birthday_view.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import 'package:flutter_screenutil/flutter_screenutil.dart';
  2. import 'package:keyboard/base/base_view.dart';
  3. import 'package:keyboard/module/new_user/new_user_controller.dart';
  4. import 'package:get/get.dart';
  5. import 'package:flutter/material.dart';
  6. import '../../../../resource/assets.gen.dart';
  7. import '../../../../resource/string.gen.dart';
  8. import '../../../../utils/styles.dart';
  9. import '../../../../widget/birthday_date_picker.dart';
  10. class StepBirthdayView extends BaseView<NewUserController> {
  11. const StepBirthdayView({super.key});
  12. @override
  13. Color backgroundColor() {
  14. return Colors.transparent;
  15. }
  16. @override
  17. Widget buildBody(BuildContext context) {
  18. return Column(
  19. crossAxisAlignment: CrossAxisAlignment.start,
  20. children: [
  21. Container(
  22. margin: EdgeInsets.only(left: 30.w, right: 30.w),
  23. child: Column(
  24. crossAxisAlignment: CrossAxisAlignment.start,
  25. children: [
  26. Row(children: [
  27. Text(
  28. StringName.newUserBirthdayTitle,
  29. style: TextStyle(
  30. color: Colors.black.withAlpha(204),
  31. fontSize: 22.sp,
  32. fontWeight: FontWeight.w500,
  33. height: 0,
  34. ),
  35. ),
  36. Assets.images.iconNewUserBirthdayLogo.image(
  37. width: 50.w,
  38. height: 36.w,
  39. fit: BoxFit.contain,
  40. ),
  41. ],),
  42. SizedBox(height: 7.h),
  43. Text(
  44. StringName.newUserBirthdayDesc,
  45. style: TextStyle(
  46. color: Colors.black.withAlpha(153),
  47. fontSize: 14.sp,
  48. fontWeight: FontWeight.w400,
  49. ),
  50. ),
  51. ],
  52. ),
  53. ),
  54. SizedBox(height: 72.w),
  55. _buildContent(context),
  56. ],
  57. );
  58. }
  59. _buildContent(BuildContext context) {
  60. return Column(
  61. children: [
  62. Container(child: _datePicker(context)),
  63. SizedBox(height: 20.h),
  64. Obx(() {
  65. return Row(
  66. mainAxisAlignment: MainAxisAlignment.center,
  67. children: [
  68. // 星座
  69. Container(
  70. width: 26.r,
  71. height: 26.r,
  72. decoration: ShapeDecoration(
  73. color: Colors.white,
  74. shape: OvalBorder(
  75. side: BorderSide(width: 1.r, color: Colors.white),
  76. ),
  77. shadows: [
  78. BoxShadow(
  79. color: Color(0x30A46EFE),
  80. blurRadius: 2.r,
  81. offset: Offset(0, 2),
  82. spreadRadius: 0,
  83. ),
  84. ],
  85. ),
  86. child: Container(
  87. margin: EdgeInsets.all(2.r),
  88. width: 22.r,
  89. height: 22.r,
  90. decoration: ShapeDecoration(
  91. gradient: LinearGradient(
  92. begin: Alignment.centerLeft,
  93. end: Alignment.centerRight,
  94. colors: [
  95. const Color(0xFF7D46FC),
  96. const Color(0xFFBC87FF),
  97. ],
  98. ),
  99. shape: OvalBorder(),
  100. shadows: [
  101. BoxShadow(
  102. color: Color(0x30A46EFE),
  103. blurRadius: 2.r,
  104. offset: Offset(0, 2.08),
  105. spreadRadius: 0,
  106. ),
  107. ],
  108. ),
  109. child: Center(
  110. child: controller.constellation.value.image.image(
  111. width: 14.r,
  112. height: 14.r,
  113. fit: BoxFit.contain,
  114. ),
  115. ),
  116. ),
  117. ),
  118. SizedBox(width: 7.w),
  119. Text(
  120. controller.constellation.value.name,
  121. style: Styles.getTextStyleBlack204W500(14.sp),
  122. ),
  123. ],
  124. );
  125. }),
  126. ],
  127. );
  128. }
  129. SizedBox _datePicker(BuildContext context) {
  130. var widget = SizedBox(
  131. height: 150.h,
  132. width: 320.w,
  133. // child: DatePickerWidget(),
  134. child: BirthdayDatePicker(
  135. initialDate: controller.initialDate,
  136. minimumDate: controller.minimumDate,
  137. maximumDate: DateTime.now(),
  138. onDateChanged: (date) {
  139. controller.updateConstellation(date);
  140. },
  141. ),
  142. );
  143. return widget;
  144. }
  145. }