feat(mobile-next): 导入官方 openim-flutter-demo 固定基线 3.8.3-patch.3 并完成双构建
- 上游: github.com/OpenIMSDK/openim-flutter-demo tag 3.8.3-patch.3 commit b3dfdb1e8aaeaaf6f0793e10cadd20d5c184a31f - 并行目录 mobile-next/ 原样导入(含 LICENSE),不覆盖现网 mobile/ - 锁定 Flutter 3.24.5 / Dart 3.5.4 / JDK 17 / Gradle 7.6.3 / AGP 7.3.1 - 实测 Android debug 与 release 构建均成功(见 docs/mobile-next-baseline-import.md) - 本提交可单独回退:git revert 1db1229(重写前) Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'change_pwd_logic.dart';
|
||||
|
||||
class ChangePwdBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => ChangePwdLogic());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
|
||||
import '../../../routes/app_navigator.dart';
|
||||
|
||||
class ChangePwdLogic extends GetxController {
|
||||
final oldPwdCtrl = TextEditingController();
|
||||
final newPwdCtrl = TextEditingController();
|
||||
final againPwdCtrl = TextEditingController();
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
oldPwdCtrl.dispose();
|
||||
newPwdCtrl.dispose();
|
||||
againPwdCtrl.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
void confirm() async {
|
||||
if (oldPwdCtrl.text.isEmpty) {
|
||||
IMViews.showToast(StrRes.plsEnterOldPwd);
|
||||
return;
|
||||
}
|
||||
if (!IMUtils.isValidPassword(newPwdCtrl.text)) {
|
||||
IMViews.showToast(StrRes.wrongPasswordFormat);
|
||||
return;
|
||||
}
|
||||
if (newPwdCtrl.text.isEmpty) {
|
||||
IMViews.showToast(StrRes.plsEnterNewPwd);
|
||||
return;
|
||||
}
|
||||
if (againPwdCtrl.text.isEmpty) {
|
||||
IMViews.showToast(StrRes.plsEnterConfirmPwd);
|
||||
return;
|
||||
}
|
||||
if (newPwdCtrl.text != againPwdCtrl.text) {
|
||||
IMViews.showToast(StrRes.twicePwdNoSame);
|
||||
return;
|
||||
}
|
||||
|
||||
final result = await LoadingView.singleton.wrap(
|
||||
asyncFunction: () => Apis.changePassword(
|
||||
userID: OpenIM.iMManager.userID,
|
||||
newPassword: newPwdCtrl.text,
|
||||
currentPassword: oldPwdCtrl.text,
|
||||
),
|
||||
);
|
||||
if (result) {
|
||||
IMViews.showToast(StrRes.changedSuccessfully);
|
||||
await LoadingView.singleton.wrap(asyncFunction: () async {
|
||||
await OpenIM.iMManager.logout();
|
||||
await DataSp.removeLoginCertificate();
|
||||
PushController.logout();
|
||||
});
|
||||
AppNavigator.startLogin();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
|
||||
import 'change_pwd_logic.dart';
|
||||
|
||||
class ChangePwdPage extends StatelessWidget {
|
||||
final logic = Get.find<ChangePwdLogic>();
|
||||
|
||||
ChangePwdPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TouchCloseSoftKeyboard(
|
||||
child: Scaffold(
|
||||
appBar: TitleBar.back(
|
||||
title: StrRes.changePassword,
|
||||
right: StrRes.determine.toText
|
||||
..style = Styles.ts_0C1C33_17sp
|
||||
..onTap = logic.confirm,
|
||||
),
|
||||
backgroundColor: Styles.c_F8F9FA,
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
12.verticalSpace,
|
||||
_buildItemView(
|
||||
label: StrRes.oldPwd,
|
||||
controller: logic.oldPwdCtrl,
|
||||
autofocus: true,
|
||||
isTopRadius: true,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 26.w, right: 10.w),
|
||||
color: Styles.c_E8EAEF,
|
||||
height: .5,
|
||||
),
|
||||
_buildItemView(
|
||||
label: StrRes.newPwd,
|
||||
controller: logic.newPwdCtrl,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 26.w, right: 10.w),
|
||||
color: Styles.c_E8EAEF,
|
||||
height: .5,
|
||||
),
|
||||
_buildItemView(
|
||||
label: StrRes.confirmNewPwd,
|
||||
controller: logic.againPwdCtrl,
|
||||
isBottomRadius: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItemView({
|
||||
required String label,
|
||||
TextEditingController? controller,
|
||||
bool autofocus = false,
|
||||
bool isTopRadius = false,
|
||||
bool isBottomRadius = false,
|
||||
}) =>
|
||||
Container(
|
||||
height: 60.h,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
margin: EdgeInsets.symmetric(horizontal: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Styles.c_FFFFFF,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(isTopRadius ? 6.r : 0),
|
||||
topRight: Radius.circular(isTopRadius ? 6.r : 0),
|
||||
bottomRight: Radius.circular(isBottomRadius ? 6.r : 0),
|
||||
bottomLeft: Radius.circular(isBottomRadius ? 6.r : 0),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
label.toText..style = Styles.ts_0C1C33_17sp,
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
autofocus: autofocus,
|
||||
textInputAction: TextInputAction.next,
|
||||
textAlign: TextAlign.end,
|
||||
style: Styles.ts_0C1C33_17sp,
|
||||
decoration: const InputDecoration(
|
||||
isDense: true,
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user