mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
Make toggle rows tappable
This commit is contained in:
parent
a5b0856eee
commit
569cafa7c6
1 changed files with 32 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||||
import 'package:cake_wallet/src/widgets/standard_switch.dart';
|
import 'package:cake_wallet/src/widgets/standard_switch.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class SettingsSwitcherCell extends StandardListRow {
|
class SettingsSwitcherCell extends StandardListRow {
|
||||||
SettingsSwitcherCell({
|
SettingsSwitcherCell({
|
||||||
|
@ -21,6 +22,37 @@ class SettingsSwitcherCell extends StandardListRow {
|
||||||
Widget buildTrailing(BuildContext context) =>
|
Widget buildTrailing(BuildContext context) =>
|
||||||
StandardSwitch(value: value, onTaped: () => onValueChange?.call(context, !value));
|
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
|
@override
|
||||||
Widget? buildLeading(BuildContext context) => leading;
|
Widget? buildLeading(BuildContext context) => leading;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue