adguard-home-manager/lib/screens/clients/client/settings_tile.dart
Juan Gilsanz Polo 5a13d52598 Small fix
2023-10-23 18:12:21 +02:00

66 lines
No EOL
1.9 KiB
Dart

import 'package:flutter/material.dart';
class SettingsTile extends StatelessWidget {
final String label;
final bool? value;
final void Function(bool)? onChange;
final bool useGlobalSettingsFiltering;
const SettingsTile({
Key? key,
required this.label,
required this.value,
this.onChange,
required this.useGlobalSettingsFiltering
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
child: InkWell(
onTap: onChange != null
? value != null ? () => onChange!(!value!) : null
: null,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 42,
vertical: 5
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
label,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface,
),
),
),
useGlobalSettingsFiltering == false
? Switch(
value: value!,
onChanged: onChange,
)
: Padding(
padding: const EdgeInsets.symmetric(
vertical: 14,
horizontal: 12
),
child: Text(
"Global",
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
),
),
)
],
),
),
),
);
}
}