2023-06-17 20:57:57 +03:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:iconsax/iconsax.dart';
|
|
|
|
|
|
|
|
class SettingLinks extends StatelessWidget {
|
|
|
|
const SettingLinks({
|
|
|
|
super.key,
|
|
|
|
required this.icon,
|
|
|
|
required this.text,
|
2023-07-09 23:41:51 +03:00
|
|
|
this.switcher = false,
|
|
|
|
this.dropdown = false,
|
|
|
|
this.info = false,
|
|
|
|
this.infoSettings = false,
|
2023-06-17 20:57:57 +03:00
|
|
|
this.dropdownName,
|
|
|
|
this.dropdownList,
|
|
|
|
this.dropdownCange,
|
|
|
|
this.value,
|
|
|
|
this.onPressed,
|
|
|
|
this.onChange,
|
|
|
|
this.textInfo,
|
|
|
|
});
|
|
|
|
final Widget icon;
|
|
|
|
final String text;
|
|
|
|
final bool switcher;
|
|
|
|
final bool dropdown;
|
|
|
|
final bool info;
|
2023-07-09 23:41:51 +03:00
|
|
|
final bool infoSettings;
|
2023-06-17 20:57:57 +03:00
|
|
|
final String? textInfo;
|
|
|
|
final String? dropdownName;
|
|
|
|
final List<String>? dropdownList;
|
|
|
|
final Function(String?)? dropdownCange;
|
|
|
|
final bool? value;
|
|
|
|
final Function()? onPressed;
|
|
|
|
final Function(bool)? onChange;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-07-10 21:33:43 +03:00
|
|
|
return Card(
|
2023-06-17 20:57:57 +03:00
|
|
|
margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
2023-07-10 21:33:43 +03:00
|
|
|
child: ListTile(
|
|
|
|
onTap: onPressed,
|
|
|
|
leading: icon,
|
|
|
|
title: Text(
|
|
|
|
text,
|
|
|
|
style: context.textTheme.titleMedium,
|
|
|
|
overflow: TextOverflow.visible,
|
|
|
|
),
|
|
|
|
trailing: switcher
|
|
|
|
? Transform.scale(
|
|
|
|
scale: 0.8,
|
|
|
|
child: Switch(
|
|
|
|
value: value!,
|
|
|
|
onChanged: onChange,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: dropdown
|
|
|
|
? DropdownButton<String>(
|
|
|
|
underline: Container(),
|
|
|
|
value: dropdownName,
|
|
|
|
items: dropdownList!
|
|
|
|
.map<DropdownMenuItem<String>>((String value) {
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
value: value,
|
|
|
|
child: Text(value),
|
|
|
|
);
|
|
|
|
}).toList(),
|
|
|
|
onChanged: dropdownCange,
|
2023-06-17 20:57:57 +03:00
|
|
|
)
|
2023-07-10 21:33:43 +03:00
|
|
|
: info
|
|
|
|
? infoSettings
|
|
|
|
? Wrap(
|
|
|
|
children: [
|
|
|
|
Padding(
|
2023-07-09 23:41:51 +03:00
|
|
|
padding: const EdgeInsets.only(right: 5),
|
|
|
|
child: Text(
|
|
|
|
textInfo!,
|
2023-07-10 21:33:43 +03:00
|
|
|
style: context.textTheme.bodyMedium,
|
2023-07-09 23:41:51 +03:00
|
|
|
overflow: TextOverflow.visible,
|
|
|
|
),
|
2023-07-10 21:33:43 +03:00
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Iconsax.arrow_right_3,
|
|
|
|
color: context.theme.iconTheme.color,
|
|
|
|
size: 18,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Padding(
|
|
|
|
padding: const EdgeInsets.only(right: 5),
|
|
|
|
child: Text(
|
|
|
|
textInfo!,
|
|
|
|
style: context.textTheme.titleMedium,
|
|
|
|
overflow: TextOverflow.visible,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Icon(
|
|
|
|
Iconsax.arrow_right_3,
|
|
|
|
color: context.theme.iconTheme.color,
|
|
|
|
size: 18,
|
|
|
|
),
|
2023-06-17 20:57:57 +03:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|