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

59 lines
2.1 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';
2020-09-21 11:50:26 +00:00
import 'package:cake_wallet/view_model/rescan_view_model.dart';
2020-01-04 19:31:52 +00:00
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/generated/i18n.dart';
class RescanPage extends BasePage {
2020-09-21 11:50:26 +00:00
RescanPage(this._rescanViewModel)
: _blockchainHeightWidgetKey = GlobalKey<BlockchainHeightState>();
2020-01-04 19:31:52 +00:00
@override
String get title => S.current.rescan;
2020-09-21 11:50:26 +00:00
final GlobalKey<BlockchainHeightState> _blockchainHeightWidgetKey;
final RescanViewModel _rescanViewModel;
2020-01-04 19:31:52 +00:00
@override
Widget body(BuildContext context) {
return Padding(
padding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
2020-01-04 19:31:52 +00:00
child:
Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Column(
children: <Widget>[
BlockchainHeightWidget(key: _blockchainHeightWidgetKey),
Padding(
padding: EdgeInsets.only(left: 40, right: 40, top: 24),
child: Text(
S.of(context).restore_from_date_or_blockheight,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
color: Theme.of(context).hintColor
),
),
)
],
),
2020-01-04 19:31:52 +00:00
Observer(
builder: (_) => LoadingPrimaryButton(
2020-09-21 11:50:26 +00:00
isLoading:
_rescanViewModel.state == RescanWalletState.rescaning,
text: S.of(context).rescan,
onPressed: () async {
await _rescanViewModel.rescanCurrentWallet(
restoreHeight:
_blockchainHeightWidgetKey.currentState.height);
Navigator.of(context).pop();
},
color: Theme.of(context).accentTextTheme.body2.color,
2020-09-21 11:50:26 +00:00
textColor: Colors.white,
))
2020-01-04 19:31:52 +00:00
]),
);
}
}