CW-392 Allow Users to rename Monero and Haven accounts (#1008)
Konstantin Ullrich committed
Aug 4, 2023 at 13:18 UTC
76322a17774a0ce7dfcbfd10e1675b545ab9ccd1
1 file changed
+29
-18
lib/src/screens/monero_accounts/widgets/account_tile.dart
+29
-18
@@ -1,4 +1,6 @@
1
import 'package:flutter/material.dart';
2
+import 'package:flutter_slidable/flutter_slidable.dart';
3
+import 'package:cake_wallet/generated/i18n.dart';
4
5
class AccountTile extends StatelessWidget {
6
AccountTile(
@@ -19,16 +21,17 @@ class AccountTile extends StatelessWidget {
21
@override
22
Widget build(BuildContext context) {
23
final color = isCurrent
22
- ? Theme.of(context).textTheme!.titleSmall!.decorationColor!
23
- : Theme.of(context).textTheme!.displayLarge!.decorationColor!;
24
+ ? Theme.of(context).textTheme.titleSmall!.decorationColor!
25
+ : Theme.of(context).textTheme.displayLarge!.decorationColor!;
26
final textColor = isCurrent
25
- ? Theme.of(context).textTheme!.titleSmall!.color!
26
- : Theme.of(context).textTheme!.displayLarge!.color!;
27
+ ? Theme.of(context).textTheme.titleSmall!.color!
28
+ : Theme.of(context).textTheme.displayLarge!.color!;
29
30
final Widget cell = GestureDetector(
31
onTap: onTap,
32
child: Container(
33
height: 77,
34
+ width: double.infinity,
35
padding: EdgeInsets.only(left: 24, right: 24),
36
color: color,
37
child: Wrap(
@@ -58,7 +61,7 @@ class AccountTile extends StatelessWidget {
61
fontSize: 15,
62
fontWeight: FontWeight.w600,
63
fontFamily: 'Lato',
61
- color: Theme.of(context).textTheme!.headlineMedium!.color!,
64
+ color: Theme.of(context).textTheme.headlineMedium!.color!,
65
decoration: TextDecoration.none,
66
),
67
),
@@ -67,18 +70,26 @@ class AccountTile extends StatelessWidget {
70
),
71
),
72
);
70
- // FIX-ME: Splidable
71
- return cell;
72
- // return Slidable(
73
- // key: Key(accountName),
74
- // child: cell,
75
- // actionPane: SlidableDrawerActionPane(),
76
- // secondaryActions: <Widget>[
77
- // IconSlideAction(
78
- // caption: S.of(context).edit,
79
- // color: Colors.blue,
80
- // icon: Icons.edit,
81
- // onTap: () => onEdit?.call())
82
- // ]);
73
+
74
+ // return cell;
75
+ return Slidable(
76
+ key: Key(accountName),
77
+ child: cell,
78
+ endActionPane: _actionPane(context)
79
+ );
80
}
81
+
82
+ ActionPane _actionPane(BuildContext context) => ActionPane(
83
+ motion: const ScrollMotion(),
84
+ extentRatio: 0.3,
85
+ children: [
86
+ SlidableAction(
87
+ onPressed: (_) => onEdit.call(),
88
+ backgroundColor: Colors.blue,
89
+ foregroundColor: Colors.white,
90
+ icon: Icons.edit,
91
+ label: S.of(context).edit,
92
+ ),
93
+ ],
94
+ );
95
}