fix:增加第三方平台设置
This commit is contained in:
parent
f037cb3c28
commit
ba2eac4cee
@ -1,8 +1,19 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_state.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_state.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
class ThirdPartyPlatformLogic {
|
class ThirdPartyPlatformLogic extends BaseGetXController {
|
||||||
ThirdPartyPlatformState state = ThirdPartyPlatformState();
|
ThirdPartyPlatformState state = ThirdPartyPlatformState();
|
||||||
|
|
||||||
void savePlatFormSetting() {
|
void savePlatFormSetting() {
|
||||||
|
// showEasyLoading();
|
||||||
|
// showToast('功能暂未开放'.tr);
|
||||||
|
// dismissEasyLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
dismissEasyLoading();
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_logic.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_state.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_state.dart';
|
||||||
|
import 'package:star_lock/tools/commonItem.dart';
|
||||||
import 'package:star_lock/tools/titleAppBar.dart';
|
import 'package:star_lock/tools/titleAppBar.dart';
|
||||||
|
|
||||||
class ThirdPartyPlatformPage extends StatefulWidget {
|
class ThirdPartyPlatformPage extends StatefulWidget {
|
||||||
@ -48,41 +49,45 @@ class _ThirdPartyPlatformPageState extends State<ThirdPartyPlatformPage> {
|
|||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: state.platFormSet.length,
|
itemCount: state.platFormSet.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return InkWell(
|
// 判断是否是最后一个元素(索引等于 itemCount - 1)
|
||||||
onTap: () {
|
final isLastItem = index == state.platFormSet.length - 1;
|
||||||
|
|
||||||
|
// 获取当前平台数据(假设 platFormSet 是 RxList<Platform>)
|
||||||
|
final platform = state.platFormSet.value[index];
|
||||||
|
return CommonItem(
|
||||||
|
leftTitel: state.platFormSet.value[index],
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: !isLastItem,
|
||||||
|
// 最后一个元素不显示分割线(取反)
|
||||||
|
isHaveDirection: false,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: Radio<String>(
|
||||||
|
// Radio 的值:使用平台的唯一标识(如 id)
|
||||||
|
value: platform,
|
||||||
|
// 当前选中的值:与 selectPlatFormIndex 关联的 id
|
||||||
|
groupValue:
|
||||||
|
state.platFormSet.value[state.selectPlatFormIndex.value],
|
||||||
|
// 选中颜色(可选,默认主题色)
|
||||||
|
activeColor: AppColors.mainColor,
|
||||||
|
// 点击 Radio 时回调(更新选中索引)
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value != null) {
|
||||||
|
setState(() {
|
||||||
|
// 找到当前选中平台的索引(根据 id 匹配)
|
||||||
|
final newIndex =
|
||||||
|
state.platFormSet.value.indexWhere((p) => p == value);
|
||||||
|
if (newIndex != -1) {
|
||||||
|
state.selectPlatFormIndex.value = newIndex;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
action: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.selectPlatFormIndex.value = index;
|
state.selectPlatFormIndex.value = index;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
|
||||||
width: 1.sw,
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
vertical: 12.h,
|
|
||||||
horizontal: 24.w,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
state.platFormSet[index],
|
|
||||||
style: TextStyle(
|
|
||||||
wordSpacing: 2.w,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: state.selectPlatFormIndex.value == index,
|
|
||||||
child: Icon(
|
|
||||||
Icons.check_circle,
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
size: 30.sp,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
|
import 'package:star_lock/translations/app_dept.dart';
|
||||||
|
|
||||||
class ThirdPartyPlatformState {
|
class ThirdPartyPlatformState {
|
||||||
ThirdPartyPlatformState() {
|
ThirdPartyPlatformState() {
|
||||||
@ -11,8 +14,11 @@ class ThirdPartyPlatformState {
|
|||||||
|
|
||||||
// 响应式字符串集合(自动触发 UI 更新)
|
// 响应式字符串集合(自动触发 UI 更新)
|
||||||
final RxList<String> platFormSet = List.of({
|
final RxList<String> platFormSet = List.of({
|
||||||
|
'锁通通'.tr,
|
||||||
'涂鸦智能'.tr,
|
'涂鸦智能'.tr,
|
||||||
}).obs;
|
}).obs;
|
||||||
|
|
||||||
RxInt selectPlatFormIndex = 999.obs;
|
RxInt selectPlatFormIndex = 0.obs;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user