You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.8 KiB
98 lines
2.8 KiB
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../controllers/eq_settings_controller.dart';
|
|
|
|
class EqSettingsView extends GetView<EqSettingsController> {
|
|
const EqSettingsView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return Scaffold(
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
|
|
appBar: _buildAppBar(isDarkMode),
|
|
body: SafeArea(
|
|
top: false,
|
|
child: _buildBody(isDarkMode),
|
|
),
|
|
);
|
|
}
|
|
|
|
// 构建应用栏
|
|
PreferredSizeWidget _buildAppBar(bool isDarkMode) {
|
|
return AppBar(
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.white,
|
|
surfaceTintColor: Colors.transparent,
|
|
elevation: 0.5,
|
|
leading: IconButton(
|
|
icon: Icon(
|
|
Icons.arrow_back_ios,
|
|
color: isDarkMode ? Colors.white : Colors.black,
|
|
size: 20.sp,
|
|
),
|
|
onPressed: () => Get.back(),
|
|
),
|
|
title: Text(
|
|
'设备设置',
|
|
style: TextStyle(
|
|
fontSize: 17.sp,
|
|
fontWeight: FontWeight.w600,
|
|
color: isDarkMode ? Colors.white : Colors.black,
|
|
),
|
|
),
|
|
centerTitle: true,
|
|
);
|
|
}
|
|
|
|
// 构建主体内容
|
|
Widget _buildBody(bool isDarkMode) {
|
|
return Obx(
|
|
() => ListView.builder(
|
|
itemCount: controller.uiList.length,
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 5.w),
|
|
itemBuilder: (BuildContext context, int index) {
|
|
Map data = controller.uiList[index];
|
|
return _item(isDarkMode, data);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _item(bool isDarkMode, Map data) {
|
|
return Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w),
|
|
margin: EdgeInsets.symmetric(vertical: 5.w),
|
|
decoration: BoxDecoration(
|
|
color: isDarkMode ? Colors.white.withValues(alpha: 0.05) : Colors.white,
|
|
borderRadius: BorderRadius.circular(8.w),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: isDarkMode
|
|
? Colors.black.withValues(alpha: 0.2)
|
|
: Colors.black.withValues(alpha: 0.05),
|
|
blurRadius: 10,
|
|
offset: const Offset(0, 4),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (data['title'] != null)
|
|
Text(
|
|
data['title'],
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w600,
|
|
color: isDarkMode ? Colors.white : Colors.black,
|
|
),
|
|
),
|
|
...data['templates'].map((e) => controller.getTemplate(e)).toList(),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|