adguard-home-manager/lib/screens/settings/encryption/master_switch.dart

70 lines
2.2 KiB
Dart
Raw Normal View History

2022-10-23 19:27:23 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class EncryptionMasterSwitch extends StatelessWidget {
final bool value;
final void Function(bool) onChange;
const EncryptionMasterSwitch({
Key? key,
required this.value,
required this.onChange
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
top: 10,
2022-11-05 04:10:49 +01:00
left: 16,
right: 16
2022-10-23 19:27:23 +02:00
),
child: Material(
2023-01-25 20:51:23 +01:00
color: Theme.of(context).colorScheme.primary.withOpacity(0.1),
2022-10-23 19:27:23 +02:00
borderRadius: BorderRadius.circular(28),
child: InkWell(
onTap: () => onChange(!value),
borderRadius: BorderRadius.circular(28),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 12
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
AppLocalizations.of(context)!.enableEncryption,
2022-11-05 01:09:09 +01:00
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface
2022-10-23 19:27:23 +02:00
),
),
const SizedBox(height: 3),
Text(
AppLocalizations.of(context)!.enableEncryptionTypes,
style: TextStyle(
fontSize: 14,
2022-11-05 02:35:35 +01:00
color: Theme.of(context).listTileTheme.textColor
2022-10-23 19:27:23 +02:00
),
)
],
),
),
Switch(
value: value,
onChanged: (value) => onChange(value),
2023-01-25 20:51:23 +01:00
activeColor: Theme.of(context).colorScheme.primary,
2022-10-23 19:27:23 +02:00
),
],
),
),
),
),
);
}
}