From 76322a17774a0ce7dfcbfd10e1675b545ab9ccd1 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Fri, 4 Aug 2023 13:18:27 +0200 Subject: [PATCH] CW-392 Allow Users to rename Monero and Haven accounts (#1008) --- .../monero_accounts/widgets/account_tile.dart | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/lib/src/screens/monero_accounts/widgets/account_tile.dart b/lib/src/screens/monero_accounts/widgets/account_tile.dart index b0769e9c2..d034ca11a 100644 --- a/lib/src/screens/monero_accounts/widgets/account_tile.dart +++ b/lib/src/screens/monero_accounts/widgets/account_tile.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:flutter_slidable/flutter_slidable.dart'; +import 'package:cake_wallet/generated/i18n.dart'; class AccountTile extends StatelessWidget { AccountTile( @@ -19,16 +21,17 @@ class AccountTile extends StatelessWidget { @override Widget build(BuildContext context) { final color = isCurrent - ? Theme.of(context).textTheme!.titleSmall!.decorationColor! - : Theme.of(context).textTheme!.displayLarge!.decorationColor!; + ? Theme.of(context).textTheme.titleSmall!.decorationColor! + : Theme.of(context).textTheme.displayLarge!.decorationColor!; final textColor = isCurrent - ? Theme.of(context).textTheme!.titleSmall!.color! - : Theme.of(context).textTheme!.displayLarge!.color!; + ? Theme.of(context).textTheme.titleSmall!.color! + : Theme.of(context).textTheme.displayLarge!.color!; final Widget cell = GestureDetector( onTap: onTap, child: Container( height: 77, + width: double.infinity, padding: EdgeInsets.only(left: 24, right: 24), color: color, child: Wrap( @@ -58,7 +61,7 @@ class AccountTile extends StatelessWidget { fontSize: 15, fontWeight: FontWeight.w600, fontFamily: 'Lato', - color: Theme.of(context).textTheme!.headlineMedium!.color!, + color: Theme.of(context).textTheme.headlineMedium!.color!, decoration: TextDecoration.none, ), ), @@ -67,18 +70,26 @@ class AccountTile extends StatelessWidget { ), ), ); - // FIX-ME: Splidable - return cell; - // return Slidable( - // key: Key(accountName), - // child: cell, - // actionPane: SlidableDrawerActionPane(), - // secondaryActions: [ - // IconSlideAction( - // caption: S.of(context).edit, - // color: Colors.blue, - // icon: Icons.edit, - // onTap: () => onEdit?.call()) - // ]); + + // return cell; + return Slidable( + key: Key(accountName), + child: cell, + endActionPane: _actionPane(context) + ); } + + ActionPane _actionPane(BuildContext context) => ActionPane( + motion: const ScrollMotion(), + extentRatio: 0.3, + children: [ + SlidableAction( + onPressed: (_) => onEdit.call(), + backgroundColor: Colors.blue, + foregroundColor: Colors.white, + icon: Icons.edit, + label: S.of(context).edit, + ), + ], + ); }