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 {
|
|
|
|
final Widget title;
|
|
|
|
final Widget subtitle;
|
2022-08-21 14:52:17 +02:00
|
|
|
final bool value;
|
|
|
|
final Function(bool) onTap;
|
2022-09-19 10:39:25 +02:00
|
|
|
final EdgeInsetsGeometry? padding;
|
2022-08-21 14:52:17 +02:00
|
|
|
|
2022-09-02 15:35:25 +02:00
|
|
|
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);
|
|
|
|
|
|
|
|
@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,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|