Make toggle rows tappable

This commit is contained in:
tuxpizza 2024-12-20 03:44:12 -05:00
parent a5b0856eee
commit 569cafa7c6

View file

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/src/widgets/standard_switch.dart';
import 'package:flutter/material.dart';
class SettingsSwitcherCell extends StandardListRow {
SettingsSwitcherCell({
@ -21,6 +22,37 @@ class SettingsSwitcherCell extends StandardListRow {
Widget buildTrailing(BuildContext context) =>
StandardSwitch(value: value, onTaped: () => onValueChange?.call(context, !value));
@override
Widget build(BuildContext context) {
final leading = buildLeading(context);
final trailing = buildTrailing(context);
return Container(
height: 56,
padding: EdgeInsets.only(left: 12, right: 12),
child: TextButton(
onPressed: () => onValueChange?.call(context, !value),
style: ButtonStyle(
//backgroundColor: MaterialStateProperty.all(Theme.of(context).cardColor),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)
),
),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if (leading != null) leading,
buildCenter(context, hasLeftOffset: leading != null),
if (trailing != null) trailing,
],
),
),
);
}
@override
Widget? buildLeading(BuildContext context) => leading;
}