Commit b8385fb487b26adcb919695fe700da7d7e8ba6c2

Authored by 刘宏哲
1 parent 1dd8d8af

feat(app): bug fixed

@@ -37,7 +37,7 @@ class LoginView extends GetView<LoginController> { @@ -37,7 +37,7 @@ class LoginView extends GetView<LoginController> {
37 ? constraints.maxWidth 37 ? constraints.maxWidth
38 : screenSize.width; 38 : screenSize.width;
39 final buttonWidth = math.min(280.0, math.max(0.0, width - 64.0)); 39 final buttonWidth = math.min(280.0, math.max(0.0, width - 64.0));
40 - final rightOffset = (width - buttonWidth) / 2; 40 + // final rightOffset = (width - buttonWidth) / 2;
41 double bottom(double value) => bottomInset + value; 41 double bottom(double value) => bottomInset + value;
42 final l10n = context.l10n; 42 final l10n = context.l10n;
43 return Obx(() { 43 return Obx(() {
@@ -59,48 +59,39 @@ class LoginView extends GetView<LoginController> { @@ -59,48 +59,39 @@ class LoginView extends GetView<LoginController> {
59 begin: Alignment(0.50, -0.00), 59 begin: Alignment(0.50, -0.00),
60 end: Alignment(0.50, 1.00), 60 end: Alignment(0.50, 1.00),
61 colors: [ 61 colors: [
62 - const Color(0xFFEEE6FF),  
63 - const Color(0xFFF8F6FF) 62 + Color(0xFFEEE6FF), Color(0xFFF8F6FF)
64 ]), 63 ]),
65 ), 64 ),
66 )), 65 )),
67 ], 66 ],
68 ), 67 ),
69 - // Welcome texts  
70 - if (!isOhos() &&  
71 - !controller.environmentConfig.hideChooseRegion)  
72 - Positioned(  
73 - right: 20,  
74 - top: MediaQuery.paddingOf(context).top,  
75 - child: GestureDetector(  
76 - onTap: () => Get.bottomSheet(  
77 - const _ServiceRegionBottomSheet(),  
78 - backgroundColor: Colors.transparent,  
79 - barrierColor: Colors.black.withValues(alpha: 0.5),  
80 - enableDrag: true,  
81 - isScrollControlled: true,  
82 - ),  
83 - child: Text(  
84 - '🌏',  
85 - textAlign: TextAlign.right,  
86 - style: TextStyle(  
87 - color: Colors.black,  
88 - fontSize: 23,  
89 - fontWeight: FontWeight.w400,  
90 - ),  
91 - ),  
92 - )),  
93 - Positioned(  
94 - bottom: bottom(isOhos()  
95 - ? 233  
96 - : (region == AppRegion.china ? 253 : 273)),  
97 - left: 0,  
98 - right: 0,  
99 - child: Column(  
100 - mainAxisSize: MainAxisSize.min,  
101 - crossAxisAlignment: CrossAxisAlignment.center,  
102 - children: [  
103 - Image.asset( 68 + Column(
  69 + mainAxisAlignment: MainAxisAlignment.end,
  70 + crossAxisAlignment: CrossAxisAlignment.center,
  71 + children: [
  72 + // Debug button for environment switching
  73 + controller.environmentConfig.isDebug
  74 + ? Center(
  75 + child: TextButton(
  76 + onPressed: controller.onDebugPressed,
  77 + style: TextButton.styleFrom(
  78 + foregroundColor: Colors.red,
  79 + textStyle: const TextStyle(
  80 + fontSize: 18,
  81 + fontWeight: FontWeight.w600,
  82 + ),
  83 + ),
  84 + child: Obx(() {
  85 + final environmentConfig =
  86 + Get.find<AppEnvironmentConfig>();
  87 + return Text(environmentConfig
  88 + .environment.value.name
  89 + .toUpperCase());
  90 + }),
  91 + ),
  92 + )
  93 + : const SizedBox.shrink(),
  94 + Image.asset(
104 'assets/images/common/ic_double_feel_text.png', 95 'assets/images/common/ic_double_feel_text.png',
105 width: 160, 96 width: 160,
106 height: 42, 97 height: 42,
@@ -125,16 +116,9 @@ class LoginView extends GetView<LoginController> { @@ -125,16 +116,9 @@ class LoginView extends GetView<LoginController> {
125 ), 116 ),
126 ), 117 ),
127 ), 118 ),
128 - ],  
129 - ),  
130 - ),  
131 -  
132 - // Login buttons – add new methods here as Column children  
133 - Positioned(  
134 - bottom: bottom(85),  
135 - left: 0,  
136 - right: 0,  
137 - child: Center( 119 + SizedBox(height: 12),
  120 +// buttons
  121 + Center(
138 child: Column( 122 child: Column(
139 mainAxisSize: MainAxisSize.min, 123 mainAxisSize: MainAxisSize.min,
140 children: [ 124 children: [
@@ -147,8 +131,7 @@ class LoginView extends GetView<LoginController> { @@ -147,8 +131,7 @@ class LoginView extends GetView<LoginController> {
147 Get.find<LocalStorage>().lastLoginMethod == 131 Get.find<LocalStorage>().lastLoginMethod ==
148 'phone', 132 'phone',
149 lastUsedLabel: l10n.loginLastUsed, 133 lastUsedLabel: l10n.loginLastUsed,
150 - ),  
151 - const SizedBox(height: 12), 134 + ),
152 ], 135 ],
153 if (region == AppRegion.global && !isOhos()) ...[ 136 if (region == AppRegion.global && !isOhos()) ...[
154 _LoginMethodButton( 137 _LoginMethodButton(
@@ -159,8 +142,7 @@ class LoginView extends GetView<LoginController> { @@ -159,8 +142,7 @@ class LoginView extends GetView<LoginController> {
159 Get.find<LocalStorage>().lastLoginMethod == 142 Get.find<LocalStorage>().lastLoginMethod ==
160 'email', 143 'email',
161 lastUsedLabel: l10n.loginLastUsed, 144 lastUsedLabel: l10n.loginLastUsed,
162 - ),  
163 - const SizedBox(height: 12), 145 + ),
164 _LoginMethodButton( 146 _LoginMethodButton(
165 width: buttonWidth, 147 width: buttonWidth,
166 label: l10n.continueWithGoogle, 148 label: l10n.continueWithGoogle,
@@ -194,23 +176,22 @@ class LoginView extends GetView<LoginController> { @@ -194,23 +176,22 @@ class LoginView extends GetView<LoginController> {
194 fontWeight: FontWeight.w700, 176 fontWeight: FontWeight.w700,
195 ), 177 ),
196 ), 178 ),
197 - ),  
198 - const SizedBox(height: 12) 179 + ),
199 ], 180 ],
200 - if (isIOS()) ...[ 181 +
  182 + if (region == AppRegion.china) ...[
201 _LoginMethodButton( 183 _LoginMethodButton(
202 width: buttonWidth, 184 width: buttonWidth,
203 - label: l10n.loginWithApple,  
204 - onPressed: controller.onAppleLoginPressed, 185 + label: '通过微信登录',
  186 + onPressed: controller.onWechatLoginPressed,
205 isLastUsed: 187 isLastUsed:
206 Get.find<LocalStorage>().lastLoginMethod == 188 Get.find<LocalStorage>().lastLoginMethod ==
207 - 'apple', 189 + 'wechat',
208 lastUsedLabel: l10n.loginLastUsed, 190 lastUsedLabel: l10n.loginLastUsed,
209 icon: Image.asset( 191 icon: Image.asset(
210 - 'assets/images/common/ic_apple.png', 192 + 'assets/images/common/ic_wechat.png',
211 width: 24, 193 width: 24,
212 - height: 24,  
213 - color: context.colors.textPrimary, 194 + height: 24,
214 ), 195 ),
215 buttonStyle: ElevatedButton.styleFrom( 196 buttonStyle: ElevatedButton.styleFrom(
216 backgroundColor: Colors.white, 197 backgroundColor: Colors.white,
@@ -234,19 +215,20 @@ class LoginView extends GetView<LoginController> { @@ -234,19 +215,20 @@ class LoginView extends GetView<LoginController> {
234 ), 215 ),
235 ), 216 ),
236 ], 217 ],
237 - if (isOhos()) ...[ 218 + if (isIOS()) ...[
238 _LoginMethodButton( 219 _LoginMethodButton(
239 width: buttonWidth, 220 width: buttonWidth,
240 - label: '通过微信登录',  
241 - onPressed: controller.onWechatLoginPressed, 221 + label: l10n.loginWithApple,
  222 + onPressed: controller.onAppleLoginPressed,
242 isLastUsed: 223 isLastUsed:
243 Get.find<LocalStorage>().lastLoginMethod == 224 Get.find<LocalStorage>().lastLoginMethod ==
244 - 'wechat', 225 + 'apple',
245 lastUsedLabel: l10n.loginLastUsed, 226 lastUsedLabel: l10n.loginLastUsed,
246 icon: Image.asset( 227 icon: Image.asset(
247 - 'assets/images/common/ic_wechat.png', 228 + 'assets/images/common/ic_apple.png',
248 width: 24, 229 width: 24,
249 height: 24, 230 height: 24,
  231 + color: context.colors.textPrimary,
250 ), 232 ),
251 buttonStyle: ElevatedButton.styleFrom( 233 buttonStyle: ElevatedButton.styleFrom(
252 backgroundColor: Colors.white, 234 backgroundColor: Colors.white,
@@ -269,44 +251,39 @@ class LoginView extends GetView<LoginController> { @@ -269,44 +251,39 @@ class LoginView extends GetView<LoginController> {
269 ), 251 ),
270 ), 252 ),
271 ), 253 ),
272 - ] 254 + ],
273 ], 255 ],
274 ), 256 ),
275 - ),  
276 - ),  
277 - // Terms agreement text + checkbox  
278 - Positioned(  
279 - bottom: bottom(0),  
280 - left: 0,  
281 - right: 0,  
282 - child: const AgreementText(), 257 + ),
  258 +// Terms agreement text + checkbox
  259 + AgreementText(),
  260 + SizedBox(height: bottomInset),
  261 + ],
283 ), 262 ),
284 -  
285 - if (controller.environmentConfig.isDebug) 263 + // Welcome texts
  264 + if (!isOhos() &&
  265 + !controller.environmentConfig.hideChooseRegion)
286 Positioned( 266 Positioned(
287 - left: 0,  
288 - right: 0,  
289 - bottom: bottom(0),  
290 - child: Center(  
291 - child: TextButton(  
292 - onPressed: controller.onDebugPressed,  
293 - style: TextButton.styleFrom(  
294 - foregroundColor: context.colors.textSecondary  
295 - .withValues(alpha: 0.55),  
296 - textStyle: const TextStyle(  
297 - fontSize: 12,  
298 - fontWeight: FontWeight.w600, 267 + right: 20,
  268 + top: MediaQuery.paddingOf(context).top,
  269 + child: GestureDetector(
  270 + onTap: () => Get.bottomSheet(
  271 + const _ServiceRegionBottomSheet(),
  272 + backgroundColor: Colors.transparent,
  273 + barrierColor: Colors.black.withValues(alpha: 0.5),
  274 + enableDrag: true,
  275 + isScrollControlled: true,
  276 + ),
  277 + child: Text(
  278 + '🌏',
  279 + textAlign: TextAlign.right,
  280 + style: TextStyle(
  281 + color: Colors.black,
  282 + fontSize: 23,
  283 + fontWeight: FontWeight.w400,
299 ), 284 ),
300 ), 285 ),
301 - child: Obx(() {  
302 - final environmentConfig =  
303 - Get.find<AppEnvironmentConfig>();  
304 - return Text(  
305 - environmentConfig.environment.value.name);  
306 - }),  
307 - ),  
308 - ),  
309 - ), 286 + )),
310 ], 287 ],
311 ); 288 );
312 }); 289 });
@@ -593,11 +570,11 @@ class _LoginMethodButton extends StatelessWidget { @@ -593,11 +570,11 @@ class _LoginMethodButton extends StatelessWidget {
593 onPressed: onPressed, 570 onPressed: onPressed,
594 icon: icon, 571 icon: icon,
595 buttonStyle: buttonStyle, 572 buttonStyle: buttonStyle,
596 - ), 573 + ).marginOnly(top: 12),
597 if (isLastUsed) 574 if (isLastUsed)
598 Positioned( 575 Positioned(
599 right: -4, 576 right: -4,
600 - top: -8, 577 + top: 8,
601 child: Container( 578 child: Container(
602 padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), 579 padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
603 decoration: ShapeDecoration( 580 decoration: ShapeDecoration(