mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
CAKE-329 | applied observable list to items in the unspent_coins_list_view_model.dart
This commit is contained in:
parent
aca8e8a292
commit
b71e85b112
2 changed files with 20 additions and 19 deletions
|
@ -4,6 +4,7 @@ import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_list_view_mod
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
||||
class UnspentCoinsListPage extends BasePage {
|
||||
UnspentCoinsListPage({this.unspentCoinsListViewModel});
|
||||
|
@ -15,7 +16,7 @@ class UnspentCoinsListPage extends BasePage {
|
|||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return SectionStandardList(
|
||||
return Observer(builder: (_) => SectionStandardList(
|
||||
sectionCount: 1,
|
||||
itemCounter: (int _) => unspentCoinsListViewModel.items.length,
|
||||
itemBuilder: (_, __, index) {
|
||||
|
@ -30,9 +31,8 @@ class UnspentCoinsListPage extends BasePage {
|
|||
note: item.note,
|
||||
isSending: item.isSending,
|
||||
onCheckBoxTap: (value) {print('CheckBox taped');},
|
||||
)
|
||||
);
|
||||
});
|
||||
));
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
|
@ -37,11 +37,12 @@ class UnspentCoinsListViewModel = UnspentCoinsListViewModelBase with _$UnspentCo
|
|||
|
||||
abstract class UnspentCoinsListViewModelBase with Store {
|
||||
@computed
|
||||
List<UnspentCoinsItem> get items => unspentCoinsMap.map((elem) =>
|
||||
ObservableList<UnspentCoinsItem> get items =>
|
||||
ObservableList.of(unspentCoinsMap.map((elem) =>
|
||||
UnspentCoinsItem(
|
||||
address: elem["address"] as String,
|
||||
amount: elem["amount"] as String,
|
||||
isFrozen: elem["isFrozen"] as bool,
|
||||
note: elem["note"] as String
|
||||
)).toList();
|
||||
)));
|
||||
}
|
Loading…
Reference in a new issue