parent
5d780d5590
commit
aca8e8a292
@ -0,0 +1,38 @@
|
||||
import 'package:cake_wallet/src/screens/unspent_coins/widgets/unspent_coins_list_item.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_list_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
|
||||
class UnspentCoinsListPage extends BasePage {
|
||||
UnspentCoinsListPage({this.unspentCoinsListViewModel});
|
||||
|
||||
@override
|
||||
String get title => 'Unspent coins';
|
||||
|
||||
final UnspentCoinsListViewModel unspentCoinsListViewModel;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return SectionStandardList(
|
||||
sectionCount: 1,
|
||||
itemCounter: (int _) => unspentCoinsListViewModel.items.length,
|
||||
itemBuilder: (_, __, index) {
|
||||
final item = unspentCoinsListViewModel.items[index];
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {print('Item taped');},
|
||||
child: UnspentCoinsListItem(
|
||||
address: item.address,
|
||||
amount: item.amount,
|
||||
isFrozen: item.isFrozen,
|
||||
note: item.note,
|
||||
isSending: item.isSending,
|
||||
onCheckBoxTap: (value) {print('CheckBox taped');},
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_checkbox.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class UnspentCoinsListItem extends StatelessWidget {
|
||||
UnspentCoinsListItem({
|
||||
@required this.address,
|
||||
@required this.amount,
|
||||
@required this.isFrozen,
|
||||
@required this.note,
|
||||
@required this.isSending,
|
||||
@required this.onCheckBoxTap,
|
||||
});
|
||||
|
||||
final String address;
|
||||
final String amount;
|
||||
final bool isFrozen;
|
||||
final String note;
|
||||
final bool isSending;
|
||||
final Function(bool) onCheckBoxTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final textStyle = TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color);
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 16, 24, 16),
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
address ?? 'Address',
|
||||
style: textStyle,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: Text(
|
||||
amount ?? 'Amount',
|
||||
style: textStyle,
|
||||
)
|
||||
),
|
||||
if (isFrozen ?? false) Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: Text(
|
||||
'Freeze',
|
||||
style: textStyle,
|
||||
)
|
||||
),
|
||||
if (note?.isNotEmpty ?? false) Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: AutoSizeText(
|
||||
note,
|
||||
style: textStyle,
|
||||
maxLines: 1
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: StandardCheckbox(
|
||||
value: isSending,
|
||||
caption: 'Sending',
|
||||
onChanged: onCheckBoxTap
|
||||
)
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
class UnspentCoinsItem {
|
||||
UnspentCoinsItem({
|
||||
this.address,
|
||||
this.amount,
|
||||
this.isFrozen,
|
||||
this.note,
|
||||
this.isSending = true});
|
||||
|
||||
final String address;
|
||||
final String amount;
|
||||
final bool isFrozen;
|
||||
final String note;
|
||||
final bool isSending;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_item.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
part 'unspent_coins_list_view_model.g.dart';
|
||||
|
||||
const List<Map<String, dynamic>> unspentCoinsMap = [
|
||||
<String, dynamic>{
|
||||
"address" : "11111111111111121111132432432432432432432443124324324234324324324324332424",
|
||||
"amount" : "222",
|
||||
"isFrozen" : true,
|
||||
"note" : "333cvgf23132132132132131321321314rwrtdggfdddewq ewqasfdxgdhgfgfszczcxgbhhhbcgbc"},
|
||||
<String, dynamic>{
|
||||
"address" : "444",
|
||||
"amount" : "555",
|
||||
"note" : "sfjskf"},
|
||||
<String, dynamic>{
|
||||
"address" : "777",
|
||||
"amount" : "888",
|
||||
"isFrozen" : false},
|
||||
<String, dynamic>{
|
||||
"address" : "11111111111111121111132432432432432432432443124324324234324324324324332424",
|
||||
"amount" : "222",
|
||||
"isFrozen" : true,
|
||||
"note" : "333cvgf23132132132132131321321314rwrtdggfdddewq ewqasfdxgdhgfgfszczcxgbhhhbcgbc"},
|
||||
<String, dynamic>{
|
||||
"address" : "444",
|
||||
"amount" : "555",
|
||||
"note" : "sffsfsdsgs"},
|
||||
<String, dynamic>{
|
||||
"address" : "777",
|
||||
"amount" : "888",
|
||||
"isFrozen" : false},
|
||||
<String, dynamic>{},
|
||||
];
|
||||
|
||||
class UnspentCoinsListViewModel = UnspentCoinsListViewModelBase with _$UnspentCoinsListViewModel;
|
||||
|
||||
abstract class UnspentCoinsListViewModelBase with Store {
|
||||
@computed
|
||||
List<UnspentCoinsItem> get items => 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 new issue