CW-379-Investigate-trade-ID-status-updates (#930)

* cancel Anonpay updateInvoice timer

* Remove un-needed dependency injection of anonpayDetailsViewModel since it can be accessed via the parent class [skip ci]

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Serhii 2023-05-24 19:12:42 +03:00 committed by GitHub
parent 53c55523c2
commit 18ba724009
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,13 +20,33 @@ class AnonpayDetailsPage extends BasePage {
final AnonpayDetailsViewModel anonpayDetailsViewModel;
@override
Widget body(BuildContext context) {
Widget body(BuildContext context) => AnonpayDetailsPageBody(anonpayDetailsViewModel);
}
class AnonpayDetailsPageBody extends StatefulWidget {
AnonpayDetailsPageBody(this.anonpayDetailsViewModel);
final AnonpayDetailsViewModel anonpayDetailsViewModel;
@override
State<AnonpayDetailsPageBody> createState() => _AnonpayDetailsPageBodyState();
}
class _AnonpayDetailsPageBodyState extends State<AnonpayDetailsPageBody> {
@override
void dispose() {
super.dispose();
widget.anonpayDetailsViewModel.timer?.cancel();
}
@override
Widget build(BuildContext context) {
return SectionStandardList(
context: context,
sectionCount: 1,
itemCounter: (int _) => anonpayDetailsViewModel.items.length,
itemCounter: (int _) => widget.anonpayDetailsViewModel.items.length,
itemBuilder: (_, __, index) {
final item = anonpayDetailsViewModel.items[index];
final item = widget.anonpayDetailsViewModel.items[index];
if (item is DetailsListStatusItem) {
return StandardListStatusRow(title: item.title, value: item.value);
@ -37,20 +57,18 @@ class AnonpayDetailsPage extends BasePage {
id: item.id,
create: item.createdAt,
pair: item.pair,
currentTheme: anonpayDetailsViewModel.settingsStore.currentTheme.type,
currentTheme: widget.anonpayDetailsViewModel.settingsStore.currentTheme.type,
onTap: item.onTap,
);
}
return GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: item.value));
showBar<void>(context, S.of(context).transaction_details_copied(item.title));
},
child: ListRow(title: '${item.title}:', value: item.value),
);
return GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: item.value));
showBar<void>(context, S.of(context).transaction_details_copied(item.title));
},
child: ListRow(title: '${item.title}:', value: item.value),
);
});
}
}