Skip to content

Commit

Permalink
IMPORT - screen freezing after recovering words
Browse files Browse the repository at this point in the history
  • Loading branch information
mocodesmo committed Dec 26, 2024
1 parent 69ba5a4 commit 4383ab7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
39 changes: 16 additions & 23 deletions lib/import/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,31 +148,24 @@ class _Screen extends StatelessWidget {
Widget build(BuildContext context) {
final step =
context.select((ImportWalletCubit cubit) => cubit.state.importStep);

final page = switch (step) {
ImportSteps.selectCreateType ||
ImportSteps.selectImportType ||
ImportSteps.scanningNFC ||
ImportSteps.importXpub ||
ImportSteps.import12Words ||
ImportSteps.import24Words =>
const ImportEnterWordsScreen(),
ImportSteps.selectWalletFormat ||
ImportSteps.scanningWallets =>
const ImportSelectWalletTypeScreen(),
ImportSteps.advancedOptions => const AdvancedOptions(),
};

return PopScope(
// canPop: step == ImportSteps.selectCreateType,
child: () {
switch (step) {
// return const ImportScanning(isColdCard: true);

case ImportSteps.selectCreateType:
// return const _CreateSelectionScreen();

case ImportSteps.selectImportType:
case ImportSteps.importXpub:
// return const ImportXpubScreen();
case ImportSteps.scanningNFC:
case ImportSteps.import12Words:
case ImportSteps.import24Words:
return const ImportEnterWordsScreen();

case ImportSteps.scanningWallets:
case ImportSteps.selectWalletFormat:
return const ImportSelectWalletTypeScreen();

case ImportSteps.advancedOptions:
return const AdvancedOptions();
}
}(),
child: page,
);
}
}
Expand Down
11 changes: 11 additions & 0 deletions lib/import/recover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,19 @@ class _ImportWordTextFieldState extends State<ImportWordTextField> {

@override
void dispose() {
entry?.remove();
entry = null;
controller.dispose();
widget.focusNode.dispose();

super.dispose();
}

void showOverLay() {
if (!context.mounted) {
hideOverlay();
return;
}
final overlay = Overlay.of(context);
final renderBox = context.findRenderObject()! as RenderBox;
final size = renderBox.size;
Expand Down Expand Up @@ -302,6 +308,7 @@ class _ImportWordTextFieldState extends State<ImportWordTextField> {
}

Widget buildOverlay() {
if (!context.mounted) return const SizedBox.shrink();
if (suggestions.isEmpty) {
hideOverlay();
return Container();
Expand Down Expand Up @@ -337,6 +344,10 @@ class _ImportWordTextFieldState extends State<ImportWordTextField> {

@override
Widget build(BuildContext context) {
if (!context.mounted) {
hideOverlay();
return const SizedBox.shrink();
}
final is12 =
context.select((ImportWalletCubit cubit) => cubit.state.is12());

Expand Down

0 comments on commit 4383ab7

Please sign in to comment.