circle_app/circle_app/lib/app/setup/view.dart

189 lines
6.3 KiB
Dart

import 'package:circle_app/components/my_app_bar.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../router/app_routers.dart';
import 'logic.dart';
class SetupPage extends StatelessWidget {
const SetupPage({Key? key}) : super(key: key);
final int heightView= 40;
@override
Widget build(BuildContext context) {
// _getFormat(context);
return GetBuilder<SetupLogic>(builder: (logic) {
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(getBaseImage("home_back")),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: const MyAppBar(centerTitle: '设置',),
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: const [
// GestureDetector(
// onTap: () {
//
// },
// child: Image.asset(
// getNavigatorImage("back"), // 将 @mipmap/icon_back 替换为相应的图像路径
// width: 24, // 将 @dimen/dp_24 替换为相应的值
// height: 24, // 将 @dimen/dp_24 替换为相应的值
// ),
// ),
// Spacer(),
// Text(
// '设置',
// style: TextStyle(
// color: Color(0xFFF7FAFA), // 将 #fff7fafa 替换为相应的颜色值
// fontSize: 18.sp, // 将 18sp 替换为相应的值
// ),
// ),
// Spacer(),
],
),
// 将 @dimen/dp_16 替换为相应的值
SizedBox(
height: heightView.sp,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Get.toNamed(AppRoutes.AccountActivity);
// controller.state.hearUrl
},
child: _buildItemRow('账号中心', getHomeImage("icon_in")),
),
),
// _buildItemRow('隐私设置', getHomeImage("icon_in")),
// SizedBox(height: 16.sp),
// _buildItemRow('聊天设置', getHomeImage("icon_in")),
// SizedBox(height: 16.sp),
// GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: () {
// Get.toNamed(AppRoutes.PrivacyActivity);
// },
// child: _buildItemRow('隐私设置', getHomeImage("icon_in")),
// ),
// SizedBox(height: 16.sp),
SizedBox(
height: heightView.sp,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Get.toNamed(AppRoutes.BlackActivity);
},
child: _buildItemRow('黑名单', getHomeImage("icon_in")),
),
),
// _buildItemRow('系统权限管理', getHomeImage("icon_in")),
// SizedBox(height: 16.sp),
SizedBox(
height: heightView.sp,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
logic.startCaching();
},
child: _buildCacheItemRow('清除缓存', getHomeImage("icon_in"), context, logic),
),
),
SizedBox(
height: heightView.sp,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Get.toNamed(AppRoutes.AboutAppActivity);
},
child: _buildItemRow('关于微乐园', getHomeImage("icon_in")),
),
),
],
),
),),
);
});
}
Widget _buildItemRow(String text, String imagePath) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 16.sp),
// 将 @dimen/dp_16 替换为相应的值
child: Row(
children: [
Text(
text,
style: TextStyle(
color: const Color(0xFFF7FAFA), // 将 #fff7fafa 替换为相应的颜色值
fontSize: 16.sp, // 将 16sp 替换为相应的值
),
),
const Spacer(),
Image.asset(
imagePath,
width: 20.sp, // 将相应的值替换为图像的宽度
height: 20.sp, // 将相应的值替换为图像的高度
),
],
),
);
}
Widget _buildCacheItemRow(String text, String imagePath, BuildContext context,
SetupLogic logic) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 16.sp),
// 将 @dimen/dp_16 替换为相应的值
child: Row(
children: [
Text(
text,
style: TextStyle(
color: const Color(0xFFF7FAFA), // 将 #fff7fafa 替换为相应的颜色值
fontSize: 16.sp, // 将 16sp 替换为相应的值
),
),
const Spacer(),
// _getFormat(context),
Text(
logic.cache, // 将 'XXX' 替换为相应的缓存大小值
style: TextStyle(
color: const Color(0xFFB7BECC), // 将 #ffb7becc 替换为相应的颜色值
fontSize: 14.sp, // 将 14sp 替换为相应的值
),
),
SizedBox(width: 8.sp), // 将 @dimen/dp_8 替换为相应的值
Image.asset(
imagePath,
width: 20.sp, // 将相应的值替换为图像的宽度
height: 20.sp, // 将相应的值替换为图像的高度
),
],
),
);
}
}