Browse Source

修改设备设置

newdev_shunjiawei
tanlongsheng 11 months ago
parent
commit
bbbdaf55bf
  1. 124
      lib/modules/eq_settings/views/widgets/select_equalizer_widget.dart

124
lib/modules/eq_settings/views/widgets/select_equalizer_widget.dart

@ -19,6 +19,8 @@ class _SelectEqualizerWidgetState extends State<SelectEqualizerWidget> {
List _values = []; List _values = [];
bool isEdit = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -59,6 +61,28 @@ class _SelectEqualizerWidgetState extends State<SelectEqualizerWidget> {
), ),
), ),
centerTitle: true, centerTitle: true,
actions: [
GestureDetector(
onTap: () {
setState(() {
isEdit = !isEdit;
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w,
vertical: 6.w,
),
child: Text(
isEdit ? 'cancel'.tr : 'edit'.tr,
style: TextStyle(
color: isDarkMode ? Colors.white : Colors.black87,
fontSize: 16.sp,
),
),
),
),
],
); );
} }
@ -174,39 +198,69 @@ class _SelectEqualizerWidgetState extends State<SelectEqualizerWidget> {
'value': option['value'], 'value': option['value'],
}); });
}, },
child: Container( child: Stack(
width: 110.w, children: [
height: 110.w, Container(
alignment: Alignment.center, width: 110.w,
decoration: BoxDecoration( height: 110.w,
color: isSelected alignment: Alignment.center,
? Colors.green decoration: BoxDecoration(
: isDarkMode color: isSelected
? Colors.white.withValues(alpha: 0.05) ? Colors.green
: Colors.white, : isDarkMode
borderRadius: BorderRadius.circular(8.w), ? Colors.white.withValues(alpha: 0.05)
boxShadow: [ : Colors.white,
BoxShadow( borderRadius: BorderRadius.circular(8.w),
color: isDarkMode boxShadow: [
? Colors.black.withValues(alpha: 0.2) BoxShadow(
: Colors.black.withValues(alpha: 0.05), color: isDarkMode
blurRadius: 10, ? Colors.black.withValues(alpha: 0.2)
offset: const Offset(0, 4), : Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
), ),
], child: Text(
), option['label'],
child: Text( style: TextStyle(
option['label'], fontSize: 16.sp,
style: TextStyle( fontWeight: FontWeight.w600,
fontSize: 16.sp, color: isSelected
fontWeight: FontWeight.w600,
color: isSelected
? Colors.white
: isDarkMode
? Colors.white ? Colors.white
: Colors.black, : isDarkMode
? Colors.white
: Colors.black,
),
),
), ),
), if (isEdit && !option['default'])
Positioned(
top: 4.w,
right: 4.w,
child: GestureDetector(
onTap: () {
setState(() {
_templateData['options'].remove(option);
});
},
child: Container(
width: 24.w,
height: 24.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(12.w),
),
child: Icon(
Icons.close,
size: 16.sp,
color: Colors.white,
),
),
),
),
],
), ),
); );
} }
@ -222,7 +276,15 @@ class _SelectEqualizerWidgetState extends State<SelectEqualizerWidget> {
), ),
), ),
).then((value) { ).then((value) {
if (value != null) {} if (value != null) {
setState(() {
_templateData['options'].add(<String, Object>{
'label': value,
'value': List.from(_values),
'default': false,
});
});
}
}); });
} }
} }

Loading…
Cancel
Save