mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 11:16:36 +00:00
added search bar to desktop nodes settings
This commit is contained in:
parent
0504f2336c
commit
c711bb9419
1 changed files with 130 additions and 81 deletions
|
@ -11,6 +11,9 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
import '../../../utilities/util.dart';
|
||||
import '../../../widgets/stack_text_field.dart';
|
||||
|
||||
class NodesSettings extends ConsumerStatefulWidget {
|
||||
const NodesSettings({Key? key}) : super(key: key);
|
||||
|
||||
|
@ -23,15 +26,27 @@ class NodesSettings extends ConsumerStatefulWidget {
|
|||
class _NodesSettings extends ConsumerState<NodesSettings> {
|
||||
List<Coin> _coins = [...Coin.values];
|
||||
|
||||
late final TextEditingController searchNodeController;
|
||||
late final FocusNode searchNodeFocusNode;
|
||||
|
||||
String filter = "";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_coins = _coins.toList();
|
||||
_coins.remove(Coin.firoTestNet);
|
||||
|
||||
searchNodeController = TextEditingController();
|
||||
searchNodeFocusNode = FocusNode();
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
searchNodeController.dispose();
|
||||
searchNodeFocusNode.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -85,88 +100,122 @@ class _NodesSettings extends ConsumerState<NodesSettings> {
|
|||
),
|
||||
],
|
||||
),
|
||||
//TODO: add search bar
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
...coins.map(
|
||||
(coin) {
|
||||
final count = ref
|
||||
.watch(nodeServiceChangeNotifierProvider
|
||||
.select((value) => value.getNodesFor(coin)))
|
||||
.length;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: RawMaterialButton(
|
||||
// splashColor: Theme.of(context).extension<StackColors>()!.highlight,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
// side: BorderSide(
|
||||
// color: Theme.of(context)
|
||||
// .extension<StackColors>()!
|
||||
// .shadow),
|
||||
),
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
CoinNodesView.routeName,
|
||||
arguments: coin,
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
12.0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
Assets.svg.iconFor(coin: coin),
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${coin.prettyName} nodes",
|
||||
style: STextStyles.titleBold12(
|
||||
context),
|
||||
),
|
||||
Text(
|
||||
count > 1
|
||||
? "$count nodes"
|
||||
: "Default",
|
||||
style: STextStyles.label(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.chevronRight,
|
||||
alignment: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
child: TextField(
|
||||
autocorrect: Util.isDesktop ? false : true,
|
||||
enableSuggestions: Util.isDesktop ? false : true,
|
||||
controller: searchNodeController,
|
||||
focusNode: searchNodeFocusNode,
|
||||
onChanged: (newString) {
|
||||
setState(() => filter = newString);
|
||||
},
|
||||
style: STextStyles.field(context),
|
||||
decoration: standardInputDecoration(
|
||||
"Search",
|
||||
searchNodeFocusNode,
|
||||
context,
|
||||
).copyWith(
|
||||
prefixIcon: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 16,
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.search,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
...coins.map(
|
||||
(coin) {
|
||||
final count = ref
|
||||
.watch(nodeServiceChangeNotifierProvider
|
||||
.select((value) => value.getNodesFor(coin)))
|
||||
.length;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: RawMaterialButton(
|
||||
// splashColor: Theme.of(context).extension<StackColors>()!.highlight,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
),
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
CoinNodesView.routeName,
|
||||
arguments: coin,
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
12.0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
Assets.svg.iconFor(coin: coin),
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${coin.prettyName} nodes",
|
||||
style: STextStyles.titleBold12(
|
||||
context),
|
||||
),
|
||||
Text(
|
||||
count > 1
|
||||
? "$count nodes"
|
||||
: "Default",
|
||||
style:
|
||||
STextStyles.label(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.chevronRight,
|
||||
alignment: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue