From 569cafa7c6231a95de4b91fafb22f2871d93ea1c Mon Sep 17 00:00:00 2001 From: tuxpizza Date: Fri, 20 Dec 2024 03:44:12 -0500 Subject: [PATCH] Make toggle rows tappable --- .../widgets/settings_switcher_cell.dart | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/src/screens/settings/widgets/settings_switcher_cell.dart b/lib/src/screens/settings/widgets/settings_switcher_cell.dart index 6a3c8b4a0..bc3421ead 100644 --- a/lib/src/screens/settings/widgets/settings_switcher_cell.dart +++ b/lib/src/screens/settings/widgets/settings_switcher_cell.dart @@ -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: [ + if (leading != null) leading, + buildCenter(context, hasLeftOffset: leading != null), + if (trailing != null) trailing, + ], + ), + ), + ); + } + + @override Widget? buildLeading(BuildContext context) => leading; }