2022-08-21 14:52:17 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/settingsView/custom_switch.dart';
|
|
|
|
|
2022-09-02 15:35:25 +02:00
|
|
|
class CustomSwitchTile extends StatelessWidget {
|
|
|
|
const CustomSwitchTile({
|
2022-08-21 14:52:17 +02:00
|
|
|
Key? key,
|
|
|
|
required this.title,
|
|
|
|
required this.subtitle,
|
|
|
|
required this.value,
|
|
|
|
required this.onTap,
|
2022-09-19 10:39:25 +02:00
|
|
|
this.padding,
|
2022-08-21 14:52:17 +02:00
|
|
|
}) : super(key: key);
|
2023-01-30 13:35:06 +01:00
|
|
|
final Widget title;
|
|
|
|
final Widget subtitle;
|
|
|
|
final bool value;
|
|
|
|
final Function(bool) onTap;
|
|
|
|
final EdgeInsetsGeometry? padding;
|
2022-08-21 14:52:17 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ListTile(
|
2022-09-19 10:39:25 +02:00
|
|
|
contentPadding: padding ?? EdgeInsets.zero,
|
2022-09-02 15:35:25 +02:00
|
|
|
title: title,
|
|
|
|
subtitle: subtitle,
|
2022-09-19 10:39:25 +02:00
|
|
|
onTap: () => onTap(!value),
|
2022-08-21 14:52:17 +02:00
|
|
|
trailing: CustomSwitch(
|
|
|
|
value: value,
|
|
|
|
onChanged: onTap,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|