mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-21 22:58:45 +00:00
CAKE-329 | show unspent coins alert when unspent coins list page is started
This commit is contained in:
parent
b1add664ad
commit
61375468a5
1 changed files with 63 additions and 29 deletions
|
@ -28,15 +28,7 @@ class UnspentCoinsListPage extends BasePage {
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
onPressed: () => showPopUp<void>(
|
onPressed: () => showUnspentCoinsAlert(context),
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertWithOneAction(
|
|
||||||
alertTitle: '',
|
|
||||||
alertContent: 'Information about unspent coins',
|
|
||||||
buttonText: S.of(context).ok,
|
|
||||||
buttonAction: () => Navigator.of(context).pop());
|
|
||||||
}),
|
|
||||||
child: questionImage),
|
child: questionImage),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -45,28 +37,70 @@ class UnspentCoinsListPage extends BasePage {
|
||||||
final UnspentCoinsListViewModel unspentCoinsListViewModel;
|
final UnspentCoinsListViewModel unspentCoinsListViewModel;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) =>
|
||||||
return Container(
|
UnspentCoinsListForm(unspentCoinsListViewModel);
|
||||||
padding: EdgeInsets.fromLTRB(24, 12, 24, 24),
|
}
|
||||||
child: Observer(
|
|
||||||
builder: (_) => ListView.separated(
|
|
||||||
itemCount: unspentCoinsListViewModel.items.length,
|
|
||||||
separatorBuilder: (_, __) =>
|
|
||||||
SizedBox(height: 15),
|
|
||||||
itemBuilder: (_, int index) {
|
|
||||||
final item = unspentCoinsListViewModel.items[index];
|
|
||||||
|
|
||||||
return GestureDetector(
|
class UnspentCoinsListForm extends StatefulWidget {
|
||||||
onTap: () {print('Item taped');},
|
UnspentCoinsListForm(this.unspentCoinsListViewModel);
|
||||||
child: UnspentCoinsListItem(
|
|
||||||
address: item.address,
|
final UnspentCoinsListViewModel unspentCoinsListViewModel;
|
||||||
amount: item.amount,
|
|
||||||
isSending: item.isSending,
|
@override
|
||||||
onCheckBoxTap: (value) {},
|
UnspentCoinsListFormState createState() =>
|
||||||
));
|
UnspentCoinsListFormState(unspentCoinsListViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class UnspentCoinsListFormState extends State<UnspentCoinsListForm> {
|
||||||
|
UnspentCoinsListFormState(this.unspentCoinsListViewModel);
|
||||||
|
|
||||||
|
final UnspentCoinsListViewModel unspentCoinsListViewModel;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback(afterLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void afterLayout(dynamic _) {
|
||||||
|
showUnspentCoinsAlert(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.fromLTRB(24, 12, 24, 24),
|
||||||
|
child: Observer(
|
||||||
|
builder: (_) => ListView.separated(
|
||||||
|
itemCount: unspentCoinsListViewModel.items.length,
|
||||||
|
separatorBuilder: (_, __) =>
|
||||||
|
SizedBox(height: 15),
|
||||||
|
itemBuilder: (_, int index) {
|
||||||
|
final item = unspentCoinsListViewModel.items[index];
|
||||||
|
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {print('Item taped');},
|
||||||
|
child: UnspentCoinsListItem(
|
||||||
|
address: item.address,
|
||||||
|
amount: item.amount,
|
||||||
|
isSending: item.isSending,
|
||||||
|
onCheckBoxTap: (value) {},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showUnspentCoinsAlert(BuildContext context) {
|
||||||
|
showPopUp<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertWithOneAction(
|
||||||
|
alertTitle: '',
|
||||||
|
alertContent: 'Information about unspent coins',
|
||||||
|
buttonText: S.of(context).ok,
|
||||||
|
buttonAction: () => Navigator.of(context).pop());
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue