revanced-manager/lib/ui/widgets/settingsView/custom_switch_tile.dart

33 lines
774 B
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_switch.dart';
class CustomSwitchTile extends StatelessWidget {
const CustomSwitchTile({
2023-11-11 13:07:32 +01:00
super.key,
required this.title,
required this.subtitle,
required this.value,
required this.onTap,
this.padding,
2023-11-11 13:07:32 +01:00
});
final Widget title;
final Widget subtitle;
final bool value;
final Function(bool) onTap;
final EdgeInsetsGeometry? padding;
@override
Widget build(BuildContext context) {
return ListTile(
contentPadding: padding ?? EdgeInsets.zero,
title: title,
subtitle: subtitle,
onTap: () => onTap(!value),
trailing: CustomSwitch(
value: value,
onChanged: onTap,
),
);
}
}