Skip to content

Commit

Permalink
address selector: allow back button (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
willyfromtheblock authored Jun 20, 2022
1 parent 0196e72 commit 27b2c2c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 55 deletions.
117 changes: 63 additions & 54 deletions lib/screens/wallet/address_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,68 +105,77 @@ class _AddressSelectorScreenState extends State<AddressSelectorScreen> {
];
}

Future<bool> _onWillPop() async {
Navigator.pop(context, _selectedAddress);
return true;
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_rounded),
tooltip: 'Back',
onPressed: () {
Navigator.pop(context, _selectedAddress);
},
),
title: _searchActive == false
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
AppLocalizations.instance
.translate('address_selector_title'),
),
IconButton(
onPressed: () => setState(() {
_searchActive = true;
}),
icon: Icon(Icons.search),
)
],
)
: Form(
key: Key('selectorSearchBar'),
child: Container(
child: TextFormField(
autofocus: true,
style: TextStyle(color: Theme.of(context).backgroundColor),
key: Key('selectorSearchKey'),
textInputAction: TextInputAction.done,
autocorrect: false,
decoration: InputDecoration(
hintText: AppLocalizations.instance
.translate('addressbook_search'),
hintStyle: TextStyle(
color: Theme.of(context).backgroundColor,
),
suffixIcon: IconButton(
onPressed: () => setState(() {
_searchActive = false;
}),
icon: Icon(
Icons.close,
return WillPopScope(
onWillPop: _onWillPop,
child: Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_rounded),
tooltip: 'Back',
onPressed: () {
Navigator.pop(context, _selectedAddress);
},
),
title: _searchActive == false
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
AppLocalizations.instance
.translate('address_selector_title'),
),
IconButton(
onPressed: () => setState(() {
_searchActive = true;
}),
icon: Icon(Icons.search),
)
],
)
: Form(
key: Key('selectorSearchBar'),
child: Container(
child: TextFormField(
autofocus: true,
style:
TextStyle(color: Theme.of(context).backgroundColor),
key: Key('selectorSearchKey'),
textInputAction: TextInputAction.done,
autocorrect: false,
decoration: InputDecoration(
hintText: AppLocalizations.instance
.translate('addressbook_search'),
hintStyle: TextStyle(
color: Theme.of(context).backgroundColor,
),
suffixIcon: IconButton(
onPressed: () => setState(() {
_searchActive = false;
}),
icon: Icon(
Icons.close,
color: Theme.of(context).backgroundColor,
),
),
),
onChanged: (searchKey) => applyFilter(searchKey),
),
onChanged: (searchKey) => applyFilter(searchKey),
),
),
),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
child: Column(
children: generateAddressInkwells(),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
child: Column(
children: generateAddressInkwells(),
),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: peercoin
description: A new Peercoin wallet.

version: 0.9.4+92
version: 0.9.4+93

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit 27b2c2c

Please sign in to comment.