cake_wallet/lib/src/screens/rescan/rescan_page.dart

42 lines
1.6 KiB
Dart
Raw Normal View History

2020-01-04 19:31:52 +00:00
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/stores/rescan/rescan_wallet_store.dart';
import 'package:cake_wallet/generated/i18n.dart';
class RescanPage extends BasePage {
final blockchainKey = GlobalKey<BlockchainHeightState>();
@override
String get title => S.current.rescan;
@override
Widget body(BuildContext context) {
final rescanWalletStore = Provider.of<RescanWalletStore>(context);
return Padding(
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
child:
Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
BlockchainHeightWidget(key: blockchainKey),
Observer(
builder: (_) => LoadingPrimaryButton(
isLoading:
rescanWalletStore.state == RescanWalletState.rescaning,
text: S.of(context).rescan,
onPressed: () async {
await rescanWalletStore.rescanCurrentWallet(
restoreHeight: blockchainKey.currentState.height);
Navigator.of(context).pop();
},
color:
Theme.of(context).primaryTextTheme.button.backgroundColor,
borderColor:
Theme.of(context).primaryTextTheme.button.decorationColor))
]),
);
}
}