import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_logic.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_state.dart'; import 'package:star_lock/tools/commonDataManage.dart'; import 'package:star_lock/tools/storage.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; class ValueAddedServicesListPage extends StatefulWidget { const ValueAddedServicesListPage({Key? key}) : super(key: key); @override State createState() => _ValueAddedServicesPageListState(); } class _ValueAddedServicesPageListState extends State { final ValueAddedServicesListLogic logic = Get.put(ValueAddedServicesListLogic()); final ValueAddedServicesListState state = Get.find().state; @override void initState() { super.initState(); logic.getServicePackageBuyUrl(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( barTitle: TranslationLoader.lanKeys!.valueAddedServices!.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: ListView( children: [ _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_note.png'), TranslationLoader.lanKeys!.note!.tr, () { Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage, arguments: {'type': 1}); }), _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_email.png'), TranslationLoader.lanKeys!.mail!.tr, () { Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage, arguments: {'type': 2}); }), _valueAddedServicesItem( Image.asset( 'images/mine/icon_mine_valueAddedServices_realName.png'), TranslationLoader.lanKeys!.realNameAuthentication!.tr, () { Get.toNamed(Routers.valueAddedServicesRealNamePage); }), _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_vip.png'), TranslationLoader.lanKeys!.advancedFunction!.tr, () async { final bool? isVip = await Storage.getBool(saveIsVip); if (isVip == null || !isVip) { // if (CommonDataManage().currentKeyInfo.isLockOwner != 1) { // logic.showToast('请先添加锁'); // } else { //刷新购买状态 final result = await Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { 'webBuyType': XSConstantMacro.webBuyTypeVip, }); if (result != null && result.isNotEmpty) { logic.getUserInfoRequest(); } // } } else { Get.toNamed(Routers.valueAddedServicesHighFunctionPage); } }), // _valueAddedServicesItem( // Image.asset('images/mine/icon_mine_valueAddedServices_push.png'), // TranslationLoader.lanKeys!.pushMessage!.tr, () { // Navigator.pushNamed(context, Routers.gatewayDetailPage); // }), // _valueAddedServicesItem( // Image.asset( // 'images/mine/icon_mine_valueAddedServices_checkIn.png'), // TranslationLoader.lanKeys!.checkingIn!.tr, () { // Navigator.pushNamed(context, Routers.gatewayDetailPage); // }), _valueAddedServicesItem( Image.asset( 'images/mine/icon_mine_valueAddedServices_storage.png'), TranslationLoader.lanKeys!.recordsRetention!.tr, () { EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds); }), _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_vip.png'), '可视对讲', () { EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds); }), _valueAddedServicesItem( Text( 'A', style: TextStyle( color: Colors.white, fontSize: 38.sp, fontWeight: FontWeight.w600), ), 'Amazon Alexa', () { EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds); }), _valueAddedServicesItem( Text( 'G', style: TextStyle( color: Colors.white, fontSize: 38.sp, fontWeight: FontWeight.w600), ), 'Google Home', () { EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds); }), ], ), ); } Widget _valueAddedServicesItem( Widget widget, String gateWayName, Function() action) { return GestureDetector( onTap: action, child: Container( margin: EdgeInsets.only(top: 20.h, right: 20.w, left: 20.w), padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 16.h, bottom: 16.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10.w), ), child: Row( children: [ Container( width: 50.w, height: 50.w, padding: EdgeInsets.all(12.h), decoration: BoxDecoration( color: AppColors.mainColor, borderRadius: BorderRadius.circular(40.w)), child: Center(child: widget), ), SizedBox( width: 20.w, ), Expanded( child: Text( gateWayName, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600), ), ), SizedBox(width: 20.h), Image.asset( 'images/icon_right_grey.png', width: 12.w, height: 21.w, ) ], ), ), ); } }