remove boxed layout of nested option

This commit is contained in:
grummbeer 2023-02-12 12:59:51 +01:00
parent 38cb44a89c
commit df8c7b1c30

View File

@ -650,7 +650,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
context, onChanged != null)), context, onChanged != null)),
), ),
], ],
).paddingSymmetric(horizontal: 10), ).paddingOnly(right: 10),
onTap: () => onChanged?.call(value), onTap: () => onChanged?.call(value),
)) ))
.toList(); .toList();
@ -675,6 +675,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
if (usePassword) radios[0], if (usePassword) radios[0],
if (usePassword) if (usePassword)
_SubLabeledWidget( _SubLabeledWidget(
context,
'One-time password length', 'One-time password length',
Row( Row(
children: [ children: [
@ -756,9 +757,10 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
controller.text = data['port'].toString(); controller.text = data['port'].toString();
return Offstage( return Offstage(
offstage: !enabled, offstage: !enabled,
child: Row(children: [ child: _SubLabeledWidget(
_SubLabeledWidget( context,
'Port', 'Port',
Row(children: [
SizedBox( SizedBox(
width: 80, width: 80,
child: TextField( child: TextField(
@ -772,14 +774,13 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
textAlign: TextAlign.end, textAlign: TextAlign.end,
decoration: const InputDecoration( decoration: const InputDecoration(
hintText: '21118', hintText: '21118',
border: InputBorder.none, border: OutlineInputBorder(),
contentPadding: EdgeInsets.only(right: 5), contentPadding:
EdgeInsets.only(bottom: 10, top: 10, right: 10),
isCollapsed: true, isCollapsed: true,
), ),
).marginOnly(right: 15),
), ),
),
enabled: enabled && !locked,
).marginOnly(left: 5),
Obx(() => ElevatedButton( Obx(() => ElevatedButton(
onPressed: applyEnabled.value && enabled && !locked onPressed: applyEnabled.value && enabled && !locked
? () async { ? () async {
@ -792,8 +793,10 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
child: Text( child: Text(
translate('Apply'), translate('Apply'),
), ),
).marginOnly(left: 20)) ))
]), ]),
enabled: enabled && !locked,
),
); );
}, },
), ),
@ -1614,44 +1617,19 @@ Widget _SubButton(String label, Function() onPressed, [bool enabled = true]) {
} }
// ignore: non_constant_identifier_names // ignore: non_constant_identifier_names
Widget _SubLabeledWidget(String label, Widget child, {bool enabled = true}) { Widget _SubLabeledWidget(BuildContext context, String label, Widget child,
RxBool hover = false.obs; {bool enabled = true}) {
return Row( return Row(
children: [ children: [
MouseRegion( Text(
onEnter: (_) => hover.value = true,
onExit: (_) => hover.value = false,
child: Obx(
() {
return Container(
height: 32,
decoration: BoxDecoration(
border: Border.all(
color: hover.value && enabled
? const Color(0xFFD7D7D7)
: const Color(0xFFCBCBCB),
width: hover.value && enabled ? 2 : 1)),
child: Row(
children: [
Container(
height: 28,
color: (hover.value && enabled)
? const Color(0xFFD7D7D7)
: const Color(0xFFCBCBCB),
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(
horizontal: 5, vertical: 2),
child: Text(
'${translate(label)}: ', '${translate(label)}: ',
style: const TextStyle(fontWeight: FontWeight.w300), style: TextStyle(color: _disabledTextColor(context, enabled)),
),
SizedBox(
width: 10,
), ),
).paddingAll(2),
child, child,
], ],
));
},
)),
],
).marginOnly(left: _kContentHSubMargin); ).marginOnly(left: _kContentHSubMargin);
} }