Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using modular.to.pop() and causing a blank page to appear. #907

Open
chadathanainta opened this issue Oct 13, 2023 · 1 comment
Open

Using modular.to.pop() and causing a blank page to appear. #907

chadathanainta opened this issue Oct 13, 2023 · 1 comment
Labels
new New issue request attention

Comments

@chadathanainta
Copy link

In flutter_modular version 6.3.2, using modular.to.pop() causes a blank page to appear. However, using Navigator.of(context).pop(); allows navigation to work as expected.

@chadathanainta chadathanainta added the new New issue request attention label Oct 13, 2023
@eduardoflorence
Copy link

I can confirm that Modular.to.pop() in this version is working correctly. Please provide code so we can reproduce the issue. Here is my tested code:

import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';

void main() {
  runApp(ModularApp(module: AppModule(), child: const AppWidget()));
}

class AppWidget extends StatelessWidget {
  const AppWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      routerConfig: Modular.routerConfig,
    );
  }
}

class AppModule extends Module {
  @override
  void binds(i) {}

  @override
  void routes(r) {
    r.child('/', child: (context) => const HomePage());
    r.child('/second', child: (context) => const SecondPage());
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          onPressed: () => Modular.to.pushNamed('/second'),
          child: const Text('Go to Second Page'),
        ),
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  const SecondPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          onPressed: () => Modular.to.pop(),
          child: const Text('Return'),
        ),
      ),
    );
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new New issue request attention
Projects
None yet
Development

No branches or pull requests

2 participants