117 lines
3.6 KiB
Dart
Executable File
117 lines
3.6 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
import '../../../../tools/titleAppBar.dart';
|
|
import '../../../../translations/trans_lib.dart';
|
|
|
|
class MotorPowerPage extends StatefulWidget {
|
|
const MotorPowerPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<MotorPowerPage> createState() => _MotorPowerPageState();
|
|
}
|
|
|
|
class _MotorPowerPageState extends State<MotorPowerPage> {
|
|
bool isCheck = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: TitleAppBar(
|
|
barTitle: TranslationLoader.lanKeys!.motorPowerSetting!.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Column(
|
|
children: [
|
|
SizedBox(
|
|
height: 40.h,
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 40.w),
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
TranslationLoader.lanKeys!.motorPowerSettingTip!.tr,
|
|
style: TextStyle(
|
|
fontSize: 24.sp,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w500),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 40.h,
|
|
),
|
|
_buildTipsView('${TranslationLoader.lanKeys!.miniwatt!.tr}\n', TranslationLoader.lanKeys!.miniwattTip!.tr, isCheck),
|
|
SizedBox(
|
|
height: 20.h,
|
|
),
|
|
_buildTipsView('${TranslationLoader.lanKeys!.highPower!.tr}\n',
|
|
TranslationLoader.lanKeys!.highPowerTip!.tr, !isCheck)
|
|
],
|
|
));
|
|
}
|
|
|
|
Widget _buildTipsView(String titleStr, String subTitle, bool isClick) {
|
|
return GestureDetector(
|
|
child: Container(
|
|
width: ScreenUtil().screenWidth - 40.w,
|
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
|
padding: EdgeInsets.only(
|
|
left: 20.w, top: 30.h, bottom: 30.h, right: 15.w),
|
|
decoration: BoxDecoration(
|
|
color: isClick
|
|
? AppColors.blueViewBgColor
|
|
: AppColors.greyBackgroundColor,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
isClick
|
|
? Image.asset(
|
|
'images/mine/icon_mine_blueSelect.png',
|
|
width: 20.w,
|
|
height: 14.w,
|
|
)
|
|
: SizedBox(
|
|
width: 20.w,
|
|
height: 14.w,
|
|
),
|
|
SizedBox(width: 20.w),
|
|
SizedBox(
|
|
width: ScreenUtil().screenWidth - 40.w - 20.w*4,
|
|
child: _buildRichText(titleStr, subTitle, isClick)
|
|
),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {
|
|
setState(() {
|
|
isCheck = !isCheck;
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _buildRichText(String titleStr, String subTitle, bool isClick) {
|
|
//高亮样式
|
|
final TextStyle titleStyle = TextStyle(
|
|
color: isClick ? AppColors.blueTextTipsColor : Colors.black,
|
|
fontSize: 24.sp,
|
|
fontWeight: FontWeight.w500);
|
|
//默认样式
|
|
final TextStyle subTipsStyle = TextStyle(
|
|
color: isClick
|
|
? AppColors.blueTextTipsColor
|
|
: AppColors.placeholderTextColor,
|
|
fontSize: 20.sp);
|
|
|
|
late InlineSpan tipsPreviewSpan = TextSpan(children: [
|
|
TextSpan(text: titleStr, style: titleStyle),
|
|
TextSpan(text: subTitle, style: subTipsStyle),
|
|
]);
|
|
return RichText(text: tipsPreviewSpan);
|
|
}
|
|
}
|