CAKE-329 | show unspent coins alert when unspent coins list page is started

This commit is contained in:
OleksandrSobol 2021-06-02 17:36:12 +03:00
parent b1add664ad
commit 61375468a5

View file

@ -28,15 +28,7 @@ class UnspentCoinsListPage extends BasePage {
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
padding: EdgeInsets.all(0),
onPressed: () => 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());
}),
onPressed: () => showUnspentCoinsAlert(context),
child: questionImage),
),
);
@ -45,7 +37,37 @@ class UnspentCoinsListPage extends BasePage {
final UnspentCoinsListViewModel unspentCoinsListViewModel;
@override
Widget body(BuildContext context) {
Widget body(BuildContext context) =>
UnspentCoinsListForm(unspentCoinsListViewModel);
}
class UnspentCoinsListForm extends StatefulWidget {
UnspentCoinsListForm(this.unspentCoinsListViewModel);
final UnspentCoinsListViewModel unspentCoinsListViewModel;
@override
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(
@ -70,3 +92,15 @@ class UnspentCoinsListPage extends BasePage {
);
}
}
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());
});
}