2020-09-04 10:40:28 +00:00
|
|
|
import 'package:cake_wallet/di.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/src/widgets/seed_language_selector.dart';
|
2020-09-04 10:40:28 +00:00
|
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
2020-05-01 18:36:48 +00:00
|
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
2020-02-28 20:16:39 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
2020-05-01 18:36:48 +00:00
|
|
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
|
|
|
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart';
|
2020-02-28 20:16:39 +00:00
|
|
|
|
|
|
|
class SeedLanguage extends BasePage {
|
2020-06-20 07:10:00 +00:00
|
|
|
SeedLanguage({this.onConfirm});
|
|
|
|
|
|
|
|
final Function(BuildContext, String) onConfirm;
|
|
|
|
|
2020-09-04 10:40:28 +00:00
|
|
|
@override
|
|
|
|
String get title => S.current.wallet_list_restore_wallet;
|
|
|
|
|
2020-02-28 20:16:39 +00:00
|
|
|
@override
|
2020-06-20 07:10:00 +00:00
|
|
|
Widget body(BuildContext context) => SeedLanguageForm(onConfirm: onConfirm);
|
2020-05-01 18:36:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class SeedLanguageForm extends StatefulWidget {
|
2020-06-20 07:10:00 +00:00
|
|
|
SeedLanguageForm({this.onConfirm});
|
|
|
|
|
|
|
|
final Function(BuildContext, String) onConfirm;
|
|
|
|
|
2020-05-01 18:36:48 +00:00
|
|
|
@override
|
|
|
|
SeedLanguageFormState createState() => SeedLanguageFormState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class SeedLanguageFormState extends State<SeedLanguageForm> {
|
|
|
|
static const aspectRatioImage = 1.22;
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-05-01 18:36:48 +00:00
|
|
|
final walletNameImage = Image.asset('assets/images/wallet_name.png');
|
2020-10-09 18:34:21 +00:00
|
|
|
final walletNameLightImage =
|
|
|
|
Image.asset('assets/images/wallet_name_light.png');
|
2020-06-20 07:10:00 +00:00
|
|
|
final _languageSelectorKey = GlobalKey<SeedLanguageSelectorState>();
|
2020-05-01 18:36:48 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-09-04 10:40:28 +00:00
|
|
|
final walletImage = getIt.get<SettingsStore>().isDarkTheme
|
2020-10-09 18:34:21 +00:00
|
|
|
? walletNameImage
|
|
|
|
: walletNameLightImage;
|
2020-09-04 10:40:28 +00:00
|
|
|
|
2020-02-28 20:16:39 +00:00
|
|
|
return Container(
|
2020-05-01 18:36:48 +00:00
|
|
|
padding: EdgeInsets.only(top: 24),
|
|
|
|
child: ScrollableWithBottomSection(
|
|
|
|
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
2020-06-20 07:10:00 +00:00
|
|
|
content:
|
|
|
|
Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 12, right: 12),
|
|
|
|
child: AspectRatio(
|
|
|
|
aspectRatio: aspectRatioImage,
|
2020-09-04 10:40:28 +00:00
|
|
|
child: FittedBox(child: walletImage, fit: BoxFit.fill)),
|
2020-06-20 07:10:00 +00:00
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 40),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).seed_language_choose,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.0,
|
2020-09-04 10:40:28 +00:00
|
|
|
fontWeight: FontWeight.w500,
|
2020-06-20 07:10:00 +00:00
|
|
|
color: Theme.of(context).primaryTextTheme.title.color),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 24),
|
|
|
|
child: SeedLanguageSelector(
|
|
|
|
key: _languageSelectorKey,
|
|
|
|
initialSelected: defaultSeedLanguage),
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
bottomSectionPadding:
|
|
|
|
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
2020-05-01 18:36:48 +00:00
|
|
|
bottomSection: Observer(
|
|
|
|
builder: (context) {
|
|
|
|
return PrimaryButton(
|
2020-10-09 18:34:21 +00:00
|
|
|
onPressed: () => widget.onConfirm(
|
|
|
|
context, _languageSelectorKey.currentState.selected),
|
2020-05-01 18:36:48 +00:00
|
|
|
text: S.of(context).seed_language_next,
|
|
|
|
color: Colors.green,
|
|
|
|
textColor: Colors.white);
|
|
|
|
},
|
|
|
|
)),
|
2020-02-28 20:16:39 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|