2020-05-01 18:36:48 +00:00
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
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/palette.dart';
|
2020-02-28 20:16:39 +00:00
|
|
|
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
|
2020-05-01 18:36:48 +00:00
|
|
|
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.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-05-01 18:36:48 +00:00
|
|
|
@override
|
|
|
|
Color get backgroundColor => PaletteDark.historyPanel;
|
2020-02-28 20:16:39 +00:00
|
|
|
|
|
|
|
@override
|
2020-05-01 18:36:48 +00:00
|
|
|
Widget body(BuildContext context) => SeedLanguageForm();
|
|
|
|
}
|
|
|
|
|
|
|
|
class SeedLanguageForm extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
SeedLanguageFormState createState() => SeedLanguageFormState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class SeedLanguageFormState extends State<SeedLanguageForm> {
|
|
|
|
static const aspectRatioImage = 1.22;
|
|
|
|
final walletNameImage = Image.asset('assets/images/wallet_name.png');
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-02-28 20:16:39 +00:00
|
|
|
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
|
|
|
|
|
2020-05-01 18:36:48 +00:00
|
|
|
final List<String> seedLocales = [
|
|
|
|
S.current.seed_language_english,
|
|
|
|
S.current.seed_language_chinese,
|
|
|
|
S.current.seed_language_dutch,
|
|
|
|
S.current.seed_language_german,
|
|
|
|
S.current.seed_language_japanese,
|
|
|
|
S.current.seed_language_portuguese,
|
|
|
|
S.current.seed_language_russian,
|
|
|
|
S.current.seed_language_spanish
|
|
|
|
];
|
|
|
|
|
2020-02-28 20:16:39 +00:00
|
|
|
return Container(
|
2020-05-01 18:36:48 +00:00
|
|
|
color: PaletteDark.historyPanel,
|
|
|
|
padding: EdgeInsets.only(top: 24),
|
|
|
|
child: ScrollableWithBottomSection(
|
|
|
|
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
|
|
|
content: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 12, right: 12),
|
|
|
|
child: AspectRatio(
|
|
|
|
aspectRatio: aspectRatioImage,
|
|
|
|
child: FittedBox(child: walletNameImage, fit: BoxFit.fill)),
|
|
|
|
),
|
|
|
|
Padding(padding: EdgeInsets.only(top: 40),
|
|
|
|
child: Text(
|
2020-02-28 20:16:39 +00:00
|
|
|
S.of(context).seed_language_choose,
|
|
|
|
textAlign: TextAlign.center,
|
2020-05-01 18:36:48 +00:00
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.0,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
color: Colors.white
|
|
|
|
),
|
2020-02-28 20:16:39 +00:00
|
|
|
),
|
2020-05-01 18:36:48 +00:00
|
|
|
),
|
|
|
|
Padding(padding: EdgeInsets.only(top: 24),
|
|
|
|
child: Observer(
|
|
|
|
builder: (_) => SelectButton(
|
|
|
|
image: null,
|
|
|
|
text: seedLocales[seedLanguages.indexOf(seedLanguageStore.selectedSeedLanguage)],
|
|
|
|
color: PaletteDark.menuList,
|
|
|
|
textColor: Colors.white,
|
|
|
|
onTap: () async => await showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) => SeedLanguagePicker()
|
|
|
|
)
|
|
|
|
)
|
2020-02-28 20:16:39 +00:00
|
|
|
),
|
2020-05-01 18:36:48 +00:00
|
|
|
)
|
|
|
|
]),
|
|
|
|
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
|
|
|
bottomSection: Observer(
|
|
|
|
builder: (context) {
|
|
|
|
return PrimaryButton(
|
|
|
|
onPressed: () =>
|
|
|
|
Navigator.of(context).popAndPushNamed(seedLanguageStore.currentRoute),
|
|
|
|
text: S.of(context).seed_language_next,
|
|
|
|
color: Colors.green,
|
|
|
|
textColor: Colors.white);
|
|
|
|
},
|
|
|
|
)),
|
2020-02-28 20:16:39 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|