user_info_page.dart 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/src/widgets/framework.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:keyboard/module/user_info/user_info_controller.dart';
  5. import 'package:get/get.dart';
  6. import 'package:keyboard/resource/string.gen.dart';
  7. import 'package:keyboard/utils/styles.dart';
  8. import '../../base/base_page.dart';
  9. import '../../resource/assets.gen.dart';
  10. import '../../router/app_pages.dart';
  11. import '../../widget/commonAppBar.dart';
  12. class UserInfoPage extends BasePage<UserInfoController> {
  13. const UserInfoPage({super.key});
  14. /// 跳转
  15. static start() {
  16. Get.toNamed(RoutePath.userInfo);
  17. }
  18. @override
  19. bool immersive() {
  20. return false;
  21. }
  22. @override
  23. statusBarDarkFont() {
  24. return true;
  25. }
  26. @override
  27. Color backgroundColor() {
  28. return const Color(0xFFF6F5FA);
  29. }
  30. @override
  31. Widget buildBody(BuildContext context) {
  32. return Scaffold(
  33. backgroundColor: backgroundColor(),
  34. appBar: CommonAppBar(
  35. title: StringName.userInfo,
  36. backgroundColor: () {
  37. return Colors.transparent;
  38. },
  39. onBack: () {
  40. controller.clickBack();
  41. },
  42. ),
  43. body: Column(
  44. children: [
  45. Container(
  46. margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 20.w),
  47. padding: EdgeInsets.all(16.w),
  48. decoration: ShapeDecoration(
  49. color: Colors.white,
  50. shape: RoundedRectangleBorder(
  51. borderRadius: BorderRadius.circular(12.r),
  52. ),
  53. ),
  54. child: Column(
  55. mainAxisSize: MainAxisSize.min,
  56. crossAxisAlignment: CrossAxisAlignment.start,
  57. children: [
  58. Text(
  59. StringName.personalInfo,
  60. style: TextStyle(
  61. color: const Color(0xFFBBBCCC),
  62. fontSize: 14.sp,
  63. fontWeight: FontWeight.w500,
  64. ),
  65. ),
  66. SizedBox(height: 24.h),
  67. Row(
  68. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  69. children: [
  70. Text(
  71. StringName.loginAccount,
  72. style: Styles.getTextStyleBlack204W400(14.sp),
  73. ),
  74. Text(
  75. controller.userInfo?.account ?? "",
  76. style: TextStyle(
  77. color: Colors.black.withAlpha(102),
  78. fontSize: 14.sp,
  79. fontWeight: FontWeight.w400,
  80. ),
  81. ),
  82. ],
  83. ),
  84. ],
  85. ),
  86. ),
  87. SizedBox(height: 8.h),
  88. _buildDeprecateButton(),
  89. const Spacer(),
  90. _buildLogoutButton(),
  91. ],
  92. ),
  93. );
  94. }
  95. Widget _buildLogoutButton() {
  96. return Row(
  97. children: [
  98. Expanded(
  99. child: Container(
  100. margin: EdgeInsets.only(bottom: 20.w, left: 16.w, right: 16.w),
  101. height: 48.h,
  102. child: Material(
  103. color: const Color(0xFFEDE8FF),
  104. borderRadius: BorderRadius.circular(50.r),
  105. child: InkWell(
  106. splashColor: Color(0xFFB983FF),
  107. borderRadius: BorderRadius.circular(50.r),
  108. onTap: () {
  109. controller.clickLogout();
  110. },
  111. child: Row(
  112. mainAxisAlignment: MainAxisAlignment.center,
  113. children: [
  114. Container(
  115. width: 22.w,
  116. height: 22.w,
  117. margin: EdgeInsets.only(right: 6.w),
  118. child: Assets.images.iconUserInfoLogout.image(
  119. width: 22.w,
  120. height: 22.w,
  121. fit: BoxFit.contain,
  122. ),
  123. ),
  124. Text(
  125. StringName.logout,
  126. textAlign: TextAlign.center,
  127. style: TextStyle(
  128. color: const Color(0xFF7D46FC),
  129. fontSize: 16.sp,
  130. fontWeight: FontWeight.w500,
  131. height: 1.25,
  132. ),
  133. ),
  134. ],
  135. ),
  136. ),
  137. ),
  138. ),
  139. ),
  140. ],
  141. );
  142. }
  143. Widget _buildDeprecateButton() {
  144. return Padding(
  145. padding: EdgeInsets.symmetric(horizontal: 16.w),
  146. child: Material(
  147. color: Colors.white,
  148. borderRadius: BorderRadius.circular(12.r),
  149. child: InkWell(
  150. borderRadius: BorderRadius.circular(12.r),
  151. onTap: () {
  152. controller.clickDeprecate();
  153. },
  154. child: Padding(
  155. padding: EdgeInsets.all(16.w),
  156. child: Row(
  157. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  158. children: [
  159. Text(
  160. StringName.loginDeleteAccount,
  161. style: Styles.getTextStyleBlack204W400(14.sp),
  162. ),
  163. Assets.images.iconUserInfoArrowLeft.image(
  164. width: 20.w,
  165. height: 20.w,
  166. ),
  167. ],
  168. ),
  169. ),
  170. ),
  171. ),
  172. );
  173. }
  174. }