37 lines
904 B
Dart
37 lines
904 B
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:please_pay_me/theme/tokens.dart';
|
|
import 'package:please_pay_me/ui/molecules/app_list_tile.dart';
|
|
|
|
/// Settings row with a native iOS switch on the trailing edge.
|
|
class AppSwitchRow extends StatelessWidget {
|
|
const AppSwitchRow({
|
|
super.key,
|
|
required this.title,
|
|
required this.value,
|
|
required this.onChanged,
|
|
this.subtitle,
|
|
this.leading,
|
|
});
|
|
|
|
final String title;
|
|
final String? subtitle;
|
|
final Widget? leading;
|
|
final bool value;
|
|
final ValueChanged<bool>? onChanged;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppListTile(
|
|
title: title,
|
|
subtitle: subtitle,
|
|
leading: leading,
|
|
showChevron: false,
|
|
trailing: CupertinoSwitch(
|
|
value: value,
|
|
onChanged: onChanged,
|
|
activeTrackColor: AppColors.of(context, AppColors.accent),
|
|
),
|
|
);
|
|
}
|
|
}
|