2022-10-19 14:12:53 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:adguard_home_manager/widgets/custom_radio.dart';
|
|
|
|
|
|
|
|
class CustomRadioListTile extends StatelessWidget {
|
|
|
|
final String groupValue;
|
|
|
|
final String value;
|
|
|
|
final Color radioBackgroundColor;
|
|
|
|
final String title;
|
|
|
|
final String? subtitle;
|
|
|
|
final void Function(String) onChanged;
|
|
|
|
|
|
|
|
const CustomRadioListTile({
|
2024-09-11 18:13:26 +02:00
|
|
|
super.key,
|
2022-10-19 14:12:53 +02:00
|
|
|
required this.groupValue,
|
|
|
|
required this.value,
|
|
|
|
required this.radioBackgroundColor,
|
|
|
|
required this.title,
|
|
|
|
this.subtitle,
|
|
|
|
required this.onChanged,
|
2024-09-11 18:13:26 +02:00
|
|
|
});
|
2022-10-19 14:12:53 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Material(
|
|
|
|
color: Colors.transparent,
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () => onChanged(value),
|
|
|
|
child: Padding(
|
2022-11-05 01:09:09 +01:00
|
|
|
padding: const EdgeInsets.symmetric(
|
2022-11-05 03:56:04 +01:00
|
|
|
horizontal: 16,
|
2022-11-05 01:09:09 +01:00
|
|
|
vertical: 12
|
|
|
|
),
|
2022-10-19 14:12:53 +02:00
|
|
|
child: Row(
|
2022-11-05 04:10:49 +01:00
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
2022-10-19 14:12:53 +02:00
|
|
|
children: [
|
2022-11-05 04:10:49 +01:00
|
|
|
const SizedBox(width: 8),
|
|
|
|
CustomRadio(
|
|
|
|
value: value,
|
|
|
|
groupValue: groupValue,
|
|
|
|
backgroundColor: radioBackgroundColor,
|
|
|
|
),
|
|
|
|
const SizedBox(width: 24),
|
2023-05-01 02:50:42 +02:00
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2022-10-19 14:12:53 +02:00
|
|
|
SizedBox(
|
|
|
|
width: MediaQuery.of(context).size.width-110,
|
|
|
|
child: Text(
|
2023-05-01 02:50:42 +02:00
|
|
|
title,
|
2022-10-21 11:26:14 +02:00
|
|
|
style: TextStyle(
|
2023-05-01 02:50:42 +02:00
|
|
|
fontSize: 16,
|
|
|
|
color: Theme.of(context).colorScheme.onSurface
|
2022-10-19 14:12:53 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-05-01 02:50:42 +02:00
|
|
|
if (subtitle != null) ...[
|
|
|
|
const SizedBox(height: 5),
|
|
|
|
SizedBox(
|
|
|
|
width: MediaQuery.of(context).size.width-110,
|
|
|
|
child: Text(
|
|
|
|
subtitle!,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).listTileTheme.textColor,
|
|
|
|
fontSize: 14
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
],
|
|
|
|
),
|
2022-11-05 03:56:04 +01:00
|
|
|
),
|
2022-10-19 14:12:53 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|