Flutter Modular - A smart project structure

Comments
  • Error: 'Router' is imported

    Error: 'Router' is imported

    Someone experiencing the same problem?

    lib/app/app_module.dart:3:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. import 'package:flutter_modular/flutter_modular.dart'; ^^^^^^ ../flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_modular-1.3.2/lib/src/interfaces/child_module.dart:3:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. import '../../flutter_modular.dart'; ^^^^^^ ../flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_modular-1.3.2/lib/src/modular_base.dart:4:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. import '../flutter_modular.dart'; ^^^^^^ ../flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_modular-1.3.2/lib/src/widgets/widget_module.dart:2:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. import '../../flutter_modular.dart'; ^^^^^^ lib/app/app_module.dart:22:9: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. Router(Modular.initialRoute, ^^^^^^ lib/app/app_module.dart:25:9: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. Router( ^^^^^^ lib/app/app_module.dart:30:9: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. Router( ^^^^^^ lib/app/app_module.dart:35:9: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. Router( ^^^^^^ lib/app/app_module.dart:40:9: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'. Router( ^^^^^^ ../flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_modular-1.3.2/lib/src/modular_base.dart:287:22: Error: The getter 'routerName' isn't defined for the class 'Object'.

    • 'Object' is from 'dart:core'. Try correcting the name to the name of an existing getter, or defining a getter or field named 'routerName'. return preview.routerName.contains('/:') ? 1 : 0; ^^^^^^^^^^ FAILURE: Build failed with an exception.
    • Where: Script '../flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 897

    • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

    Process 'command '../flutter/common/flutter/bin/flutter'' finished with non-zero exit value 1

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 52s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)

    $ flutter --version Flutter 1.21.0-9.0.pre • channel dev • https://github.com/flutter/flutter.git Framework • revision 7c6f9dd239 (5 days ago) • 2020-08-09 10:31:03 -0400 Engine • revision 6d86e67f04 Tools • Dart 2.10.0 (build 2.10.0-4.0.dev 0341576448)

    opened by gladson 20
  • RouteGuard is never fired

    RouteGuard is never fired

    class AppModule extends MainModule {
      @override
      List<Bind> get binds => [
            Bind((i) => AppController()),
          ];
      @override
      List<Router> get routers => [
            Router('/', module: LoginModule()),
            Router('/home', module: HomeModule(), guards: [AppGuard()]),
          ];
      @override
      Widget get bootstrap => AppWidget();
      static Inject get to => Inject<AppModule>.of();
    }
    
    class AppGuard implements RouteGuard {
      @override
      bool canActivate(String url) {
        return false;
      }
    }
    

    Fala pessoal, mesmo forçando retorno para false e debugando, o canActivate não esta sendo acionado, a implementação do RouteGuard está correta? Teria algum outro material/documentação para olhar sobre segurança de rotas?

    Abraço!

    bug 
    opened by felipewom-zz 18
  • V3 mixing pushNamed and navigate cause duplicated key issue

    V3 mixing pushNamed and navigate cause duplicated key issue

    As titled the problematic code belong to modular_route delegate.dart:

     @override
      Future<void> setNewRoutePath(ModularRoute router, [bool replaceAll = true]) async {
        _arguments = router.args;
        final page = ModularPage(
          key: ValueKey('url:${router.uri?.path ?? router.path}'),
          router: router,
        );
        if (_pages.isEmpty) {
          _pages.add(page);
        } else {
    
    ....
    

    where _pages can be in state where duplicated ValueKey exist, lead to flutter framework error

    awaiting info 
    opened by singggum3b 14
  • Using the word

    Using the word "Store" instead "Controller" in ModularState

    I understand that it is a mistake to change "Controller" to "Store". Because everything (Controllers/Stores/Anyway) that helps the page with business rules is "Controller", stores are for storage only. The word "store" is very specific.

    Please avoid this change.

    Captura de Tela 2021-03-04 às 09 39 28

    opened by michel1tonon 14
  • Tem horas que mesmo saindo de um módulo, ele não tá executando dispose.

    Tem horas que mesmo saindo de um módulo, ele não tá executando dispose.

    Boa tarde, tem horas que mesmo saindo de um módulo, ele não tá executando dispose. Veja um exemplo de uma rota:

    AppModule

    List<Router> get routers => [
            ...
            Router('/profile', module: ProfileModule()),
          ];
    

    ProfileModule

    @override
      List<Router> get routers => [
            Router('/', child: (_, args) => ProfilePage()),
            Router('/edit', child: (_, args) => ProfileEditPage()),
            Router('/about', child: (_, args) => ProfileAboutPage()),
          ];
    

    No meu app, primeiro entra no ProfilePage pra exibir os dados, e exibe uma opção para exibir detalhes (/profile/about) ou editar o perfil(/profile/edit)... E pelo botão voltar que é colocado na AppBar, vai seguindo a stack das rotas até retornar pra tela anterior à carga do /profile aqui o comportamento tá certinho... mas se tento navegar pra fora, com um pushReplacementNamed, popAndPushNamed etc, navega pro novo destino fora da rota /profile mas não dá dispose no módulo.

    Nesse caso eu devo forçar o dispose de alguma forma antes de navegar pra fora da rota ?

    opened by wemersonrv 14
  • RegEx error on routing resolving when on Firefox

    RegEx error on routing resolving when on Firefox

    Hi,

    Your regexp for routing matching with arguments seems not to be compatible with Firefox 75.0 on Ubuntu 18.04. Same OS with Chrome works fine.

    Here is a screenshot

    image

    Cheers

    wontfix 
    opened by phackwer 13
  • Dispose not being called on module after navigating to another one

    Dispose not being called on module after navigating to another one

    Like I talked to @jacobaraujo7 ,

    The scenario is like this:

    1. App starts in HomeModule ("/")
    2. Navigate to NewPage in NewModule ("/new") with Modular.to.pushNamed('/new')
    3. Navigate to Page2 in NewModule ("/new/page2") with Modular.to.pushNamed('/new/page2')
    4. Navigate back to HomeModule ("/") with Modular.to.pushReplacementNamed('/')

    When executing step 4, it should dispose NewModule, but it never happens. That can cause issues when navigating back to NewModule. It only disposes correctly if I navigate to "/" inside the "/new" route (first route inside NewModule), if I try to navigate from 2+ page in stack, it doesn't dispose. You can test this scenario uncometing the line 24 inside new_page.dart

    Minimal reproducible project: https://github.com/Gustav0ar/modular_route_bug

    opened by Gustav0ar 13
  • Error on latest version 3.1.1

    Error on latest version 3.1.1

    On latest I get this error: On 3.1.0 my app worked fine.

    ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
    The following assertion was thrown building Builder:
    'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3598 pos 18:
    '!keyReservation.contains(key)': is not true.
    
    opened by naamapps 12
  • ModuleRoutes does not accept dynamic route

    ModuleRoutes does not accept dynamic route

    Example: I have a url: /product/:id. Now I want to have one page details (/product/:id/details) and one rating page (/product/:id/ratings).

    I created this module route, but I get the error "ModuleRoute should not contain dynamic route". How can I solve this problem?

    opened by CodeDoctorDE 12
  • Arguments accessíveis em outros módulos

    Arguments accessíveis em outros módulos

    Opa, tudo bem glr?

    Usando a versão ^4.0.0+8 percebi um comportamento um tanto quanto estranho.

    Quando eu chamo o modulo e passo um argumento e saiu desse módulo o mesmo argumento será enviado quando outro módulo for chamado, msm que eu não passe nenhum.

    image

    Mesmo depois de sair do modulo card o argumento continua lá.

    image

    bug 
    opened by railsonsm 11
  • Wrong Route name in Flutter Web

    Wrong Route name in Flutter Web

    Hi there! So, me and my team have a project in Flutter Web using flutter_modular 3.4.1+1. Recently, we've discovered that, whenever you change screen (using pushNamed, navigate, pushNamedAndRemoveUntil and so on), the URL doesn't start with the ModuleRoute name, it starts with /0 or /1.

    Here's an example:

    image

    image

    image

    It was supposed to start with the Module name, i.e /register or /password-recovery, not /0 or /1. This happens with other modules too:

    image

    image

    image

    bug 
    opened by GabrielCR99 11
  • build(deps): bump json5 and babel-loader in /doc

    build(deps): bump json5 and babel-loader in /doc

    Bumps json5 and babel-loader. These dependencies needed to be updated together. Updates json5 from 2.2.0 to 2.2.3

    Release notes

    Sourced from json5's releases.

    v2.2.3

    v2.2.2

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Changelog

    Sourced from json5's changelog.

    v2.2.3 [code, diff]

    v2.2.2 [code, diff]

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1 [code, diff]

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Commits
    • c3a7524 2.2.3
    • 94fd06d docs: update CHANGELOG for v2.2.3
    • 3b8cebf docs(security): use GitHub security advisories
    • f0fd9e1 docs: publish a security policy
    • 6a91a05 docs(template): bug -> bug report
    • 14f8cb1 2.2.2
    • 10cc7ca docs: update CHANGELOG for v2.2.2
    • 7774c10 fix: add proto to objects and arrays
    • edde30a Readme: slight tweak to intro
    • 97286f8 Improve example in readme
    • Additional commits viewable in compare view

    Updates babel-loader from 8.2.2 to 8.3.0

    Release notes

    Sourced from babel-loader's releases.

    v8.3.0

    New features

    Full Changelog: https://github.com/babel/babel-loader/compare/v8.2.5...v8.3.0

    v8.2.5

    What's Changed

    New Contributors

    Full Changelog: https://github.com/babel/babel-loader/compare/v8.2.4...v8.2.5

    v8.2.4

    What's Changed

    Thanks @​loveDstyle, @​stianjensen and @​pathmapper for your first PRs!

    8.2.3

    This release fixes compatibility with Node.js 17

    Thanks @​Reptarsrage!

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies javascript 
    opened by dependabot[bot] 1
  • Chore: Change analyzer version

    Chore: Change analyzer version

    Description

    This pr change analyzer version to 3.4.0 for resolve conflicts with others packages.

    • [x ] The title of my PR starts with a [Conventional Commit] prefix (fix:, feat:, docs: etc).

    • [X ] I have read the [Contributor Guide] and followed the process outlined for submitting PRs.

    • [ X] I have updated/added tests for ALL new/updated/fixed functionality.

    • [ X] I have updated/added relevant documentation in docs and added dartdoc comments with ///.

    • [ X] I have updated/added relevant examples in examples.

    • [ X] No, this is not a breaking change.

    opened by devguusta 0
  • flutter_modular: ^5.0.3. return GuardedRouteException or RouteNotFoundException

    flutter_modular: ^5.0.3. return GuardedRouteException or RouteNotFoundException

    I try to navigate from recruiter to recruiter/task inside the Children of recruiter ModuleRoute.

    Here I want to Open TaskPage on RouterOutlet.

    Package Used

    flutter_modular: ^5.0.3
    

    Routes list ---

    @override
    List<ModularRoute> get routes => [
      ChildRoute('/', child: (context, args) => RecruiterLandingPage(),
          children: [
            ChildRoute('/tasks',
              child: (context, args) =>TasksPage(),
              transition: TransitionType.noTransition,
    
            ),
        ];
    

    RecruiterLandingPage

    I use :

    Modular.to.navigate('/tasks');
    

    It returns Exception

    Error: RouteNotFoundException: Route (/tasks) not found
               dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49                    throw_
               packages/flutter_modular/src/presenter/navigation/modular_route_information_parser.dart 111:9   <fn>
               dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54                              runBody
               dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5                              _async
               packages/flutter_modular/src/presenter/navigation/modular_route_information_parser.dart 109:56  <fn>
               packages/flutter_modular/src/shared/either.dart 46:18                                           fold
               packages/flutter_modular/src/presenter/navigation/modular_route_information_parser.dart 109:24  selectRoute
               dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50                              <fn>
               dart-sdk/lib/async/zone.dart 1653:54                                                            runUnary
               dart-sdk/lib/async/future_impl.dart 147:18                                                      handleValue
               dart-sdk/lib/async/future_impl.dart 766:44                                                      handleValueCallback
               dart-sdk/lib/async/future_impl.dart 795:13                                                      _propagateToListeners
               dart-sdk/lib/async/future_impl.dart 566:5                                                       [_completeWithValue]
               dart-sdk/lib/async/future_impl.dart 639:7                                                       callback
               dart-sdk/lib/async/schedule_microtask.dart 40:11                                                _microtaskLoop
               dart-sdk/lib/async/schedule_microtask.dart 49:5                                                 _startMicrotaskLoop
               dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15                             <fn>
    

    and When I Use :

    Modular.to.navigate('/recruiter/tasks');
    

    It returns Exception

    Error: GuardedRouteException: /recruiter/
               dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49  throw_
               packages/flutter_modular/src/presenter/guards/route_guard.dart 31:5           pos
               dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>
               dart-sdk/lib/async/zone.dart 1653:54                                          runUnary
               dart-sdk/lib/async/future_impl.dart 147:18                                    handleValue
               dart-sdk/lib/async/future_impl.dart 766:44                                    handleValueCallback
               dart-sdk/lib/async/future_impl.dart 795:13                                    _propagateToListeners
               dart-sdk/lib/async/future_impl.dart 566:5                                     [_completeWithValue]
               dart-sdk/lib/async/future_impl.dart 639:7                                     callback
               dart-sdk/lib/async/schedule_microtask.dart 40:11                              _microtaskLoop
               dart-sdk/lib/async/schedule_microtask.dart 49:5                               _startMicrotaskLoop
               dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15           <fn>
    

    recruiter Route Open by using :

    ModuleRoute("/recruiter", module: RecruiterModule(),
        guards: [AuthGuard(), Modular.get<RoleGuardVerify>().getGuard(RoleGuardVerify.RECRUITER)]
    ),
    

    Authguard

    import 'package:/authentication/ui/bloc/user_status/user_status_bloc.dart';
    import 'package:flutter_modular/flutter_modular.dart';
    
    class AuthGuard extends RouteGuard {
      AuthGuard() : super();
    
      @override
      Future<bool> canActivate(String path, ModularRoute router) async {
        var bloc = Modular.get<UserStatusBloc>();
        bloc.add(UserStatusLoadStarted());
       
        return bloc.state is UserStatusLogin;
      }
    }
    

    RoleGuardVerify

    import 'package:---/app/role_guard.dart';
    import 'package:----/authentication/ui/bloc/user_status/user_status_bloc.dart';
    import 'package:flutter_modular/flutter_modular.dart';
    
    class RoleGuardVerify {
      static final int RECRUITER = 1;
      static final int CONSULTANT = 2;
      static final int MANAGER = 3;
    
      Map<int, String> redirectByRole = {
        RECRUITER: "/recruiter",
        CONSULTANT: "/consultant",
        MANAGER: "/manager"
      };
    
      RouteGuard getGuard(int guardRoleType) {
        try {
          var bloc = Modular.get<UserStatusBloc>();
          if (!(bloc.state is UserStatusLogin)) {
            return RoleGuard(guardRoleType, "/login");
          }
          var user = (bloc.state as UserStatusLogin).user;
          var redirect = redirectByRole[user.role];
          if(redirect != null) {
         
            return RoleGuard(guardRoleType, redirect);
          }else{
            return RoleGuard(guardRoleType, '/recruiter');
          }
        } catch (e) {
       
          return RoleGuard(guardRoleType, "/login");
        }
      }
    }
    

    In my opinion, The Guards I created are not returning GuardedRouteException. I want the right way to do navigation.

    I used the link(https://modular.flutterando.com.br/docs/flutter_modular/navegation) for this navigation.

    new 
    opened by sahildev001 0
  • ReverseTransitionDuration not having any effect on a CustomTransition

    ReverseTransitionDuration not having any effect on a CustomTransition

    Describe the bug I'm having an issue where the reverseTransitionDuration variable is not having any effect on a CustomTransition. This error also occurs similarly with the default transitions provided.

    Environment Add your flutter doctor -v

    [✓] Flutter (Channel stable, 3.3.6, on macOS 13.0 22A380 darwin-arm, locale pt-BR) [!] Android toolchain - develop for Android devices (Android SDK version 33.0.0) ✗ cmdline-tools component is missing Run path/to/sdkmanager --install "cmdline-tools;latest" See https://developer.android.com/studio/command-line for more details. ✗ Android license status unknown. Run flutter doctor --android-licenses to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details. [✓] Xcode - develop for iOS and macOS (Xcode 14.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.3) [✓] VS Code (version 1.74.0) [✓] Connected device (4 available) [✓] HTTP Host Availability

    Add your pubspec.yaml

    
    name: blank
    description: A new Flutter project.
    
    # The following line prevents the package from being accidentally published to
    # pub.dev using `flutter pub publish`. This is preferred for private packages.
    publish_to: 'none' # Remove this line if you wish to publish to pub.dev
    
    # The following defines the version and build number for your application.
    # A version number is three numbers separated by dots, like 1.2.43
    # followed by an optional build number separated by a +.
    # Both the version and the builder number may be overridden in flutter
    # build by specifying --build-name and --build-number, respectively.
    # In Android, build-name is used as versionName while build-number used as versionCode.
    # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
    # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
    # Read more about iOS versioning at
    # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
    # In Windows, build-name is used as the major, minor, and patch parts
    # of the product and file versions while build-number is used as the build suffix.
    version: 1.0.0+1
    
    environment:
      sdk: '>=2.18.2 <3.0.0'
    
    # Dependencies specify other packages that your package needs in order to work.
    # To automatically upgrade your package dependencies to the latest versions
    # consider running `flutter pub upgrade --major-versions`. Alternatively,
    # dependencies can be manually updated by changing the version numbers below to
    # the latest version available on pub.dev. To see which dependencies have newer
    # versions available, run `flutter pub outdated`.
    dependencies:
      flutter:
        sdk: flutter
    
    
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^1.0.2
      flutter_modular: ^5.0.3
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
      # The "flutter_lints" package below contains a set of recommended lints to
      # encourage good coding practices. The lint set provided by the package is
      # activated in the `analysis_options.yaml` file located at the root of your
      # package. See that file for information about deactivating specific lint
      # rules and activating additional ones.
      flutter_lints: ^2.0.0
    
    # For information on the generic Dart part of this file, see the
    # following page: https://dart.dev/tools/pub/pubspec
    
    # The following section is specific to Flutter packages.
    flutter:
    
      # The following line ensures that the Material Icons font is
      # included with your application, so that you can use the icons in
      # the material Icons class.
      uses-material-design: true
    
      # To add assets to your application, add an assets section, like this:
      # assets:
      #   - images/a_dot_burr.jpeg
      #   - images/a_dot_ham.jpeg
    
      # An image asset can refer to one or more resolution-specific "variants", see
      # https://flutter.dev/assets-and-images/#resolution-aware
    
      # For details regarding adding assets from package dependencies, see
      # https://flutter.dev/assets-and-images/#from-packages
    
      # To add custom fonts to your application, add a fonts section here,
      # in this "flutter" section. Each entry in this list should have a
      # "family" key with the font family name, and a "fonts" key with a
      # list giving the asset and other descriptors for the font. For
      # example:
      # fonts:
      #   - family: Schyler
      #     fonts:
      #       - asset: fonts/Schyler-Regular.ttf
      #       - asset: fonts/Schyler-Italic.ttf
      #         style: italic
      #   - family: Trajan Pro
      #     fonts:
      #       - asset: fonts/TrajanPro.ttf
      #       - asset: fonts/TrajanPro_Bold.ttf
      #         weight: 700
      #
      # For details regarding fonts from package dependencies,
      # see https://flutter.dev/custom-fonts/#from-packages
    

    Add your AndroidManifest.xml

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.blank">
       <application
            android:label="blank"
            android:name="${applicationName}"
            android:icon="@mipmap/ic_launcher">
            <activity
                android:name=".MainActivity"
                android:exported="true"
                android:launchMode="singleTop"
                android:theme="@style/LaunchTheme"
                android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
                android:hardwareAccelerated="true"
                android:windowSoftInputMode="adjustResize">
                <!-- Specifies an Android theme to apply to this Activity as soon as
                     the Android process has started. This theme is visible to the user
                     while the Flutter UI initializes. After that, this theme continues
                     to determine the Window background behind the Flutter UI. -->
                <meta-data
                  android:name="io.flutter.embedding.android.NormalTheme"
                  android:resource="@style/NormalTheme"
                  />
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>
            <!-- Don't delete the meta-data below.
                 This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
            <meta-data
                android:name="flutterEmbedding"
                android:value="2" />
        </application>
    </manifest>
    
    

    To Reproduce To reproduce, simply run the code below and navigate between pages.

    import 'package:flutter/material.dart';
    import 'package:flutter_modular/flutter_modular.dart';
    
    void main() {
      return runApp(ModularApp(module: AppModule(), child: AppWidget()));
    }
    
    class AppWidget extends StatelessWidget {
      Widget build(BuildContext context) {
        return MaterialApp.router(
          title: 'My Smart App',
          theme: ThemeData(primarySwatch: Colors.blue),
          routeInformationParser: Modular.routeInformationParser,
          routerDelegate: Modular.routerDelegate,
        ); //added by extension
      }
    }
    
    class AppModule extends Module {
      @override
      List<Bind> get binds => [];
    
      @override
      List<ModularRoute> get routes => [
            ChildRoute(
              '/',
              child: (context, args) => const HomePage(),
              transition: TransitionType.custom,
              customTransition: getCustomTransition(),
            ),
            ChildRoute(
              '/secondPage',
              child: (context, args) => const SecondPage(),
              transition: TransitionType.custom,
              customTransition: getCustomTransition(),
            ),
          ];
    }
    
    class HomePage extends StatelessWidget {
      const HomePage({super.key});
    
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(title: const Text('Home Page')),
          body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                const Text('This is initial page'),
                TextButton(
                    onPressed: () {
                      Modular.to.pushNamed('/secondPage');
                    },
                    child: const Text('Go to secondPage'))
              ],
            ),
          ),
        );
      }
    }
    
    class SecondPage extends StatelessWidget {
      const SecondPage({super.key});
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(title: const Text('Second Page')),
          body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                const Text('Second page'),
                TextButton(
                    onPressed: () {
                      Modular.to.pop();
                    },
                    child: const Text('back to secondPage'))
              ],
            ),
          ),
        );
      }
    }
    
    CustomTransition getCustomTransition() {
      return CustomTransition(
        transitionDuration: const Duration(seconds: 2),
        reverseTransitionDuration: const Duration(seconds: 100),
        transitionBuilder: (context, anim1, anim2, child) {
          return FadeTransition(
            opacity: anim1,
            child: child,
          );
        },
      );
    }
    

    Expected behavior I hope that the time taken for the Modular.to.pop() animation is that of the reverseTransitionDuration variable.

    Screenshots

    https://user-images.githubusercontent.com/30707007/207715417-452c76dd-ab70-43a5-9f21-5f740e813f8f.mp4

    new 
    opened by GarbielBarbosa 0
  • build(deps): bump express from 4.17.1 to 4.18.2 in /doc

    build(deps): bump express from 4.17.1 to 4.18.2 in /doc

    Bumps express from 4.17.1 to 4.18.2.

    Release notes

    Sourced from express's releases.

    4.18.2

    4.18.1

    • Fix hanging on large stack of sync routes

    4.18.0

    ... (truncated)

    Changelog

    Sourced from express's changelog.

    4.18.2 / 2022-10-08

    4.18.1 / 2022-04-29

    • Fix hanging on large stack of sync routes

    4.18.0 / 2022-04-25

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies javascript 
    opened by dependabot[bot] 1
Releases(v5.0.3)
  • v5.0.3(Jun 3, 2022)

  • v5.0.2(May 13, 2022)

  • v5.0.1(May 12, 2022)

  • v5.0.0(May 12, 2022)

    • Support Flutter 3.0.0
    • [BREAK CHANGE]: Removed MaterialApp.modular() and Cupertino().modular(). Use instead:
        return MaterialApp.router(
          routeInformationParser: Modular.routeInformationParser,
          routerDelegate: Modular.routerDelegate,
        );
      
      

    This modification aims to keep Modular support independent of WidgetApp updates, and can be used in other bootstraps such as FluentApp [fluent_ui].

    • [BREAK CHANGE]: New auto-dispose configuration. Previously Modular had automatic closing or destruction calls for objects of type ChangeNotifier/ValueNotifier, Stream and Triple`s Stores. Starting with version 5.0, Modular will provide the Bind.onDispose property for calls to destroy, close or dispose methods FOR EACH BIND. This will make the dispose settings more straightforward and less universal. Therefore, Modular will manage the destruction of Binds that implement Disposable only. This is the new configuration:
    @override
    final List<Bind> binds = [
      Bind.singleton((i) => MyBloc(), onDispose: (bloc) => bloc.close()),
    ];
    

    The Bind.onDispose CANNOT be used in Bind type factory. You can choose to use Bind.onDispose or implement the Disposable class.

    • Added Bind.selector. Generates a reactivity (Listenable/Stream) to be listened to when context.watch() is called.
    @override
    final List<Bind> binds = [
      //notifier return stream or listenable to use context.watch()
      Bind.singleton((i) => MyBloc(), onDispose: (bloc) => bloc.close(), selector: (bloc) => bloc.stream),
    ];
    
    • [BREAK CHANGE]: As already described above, the reactivities worked externally to Modular, providing a longer life to the project. For this reason, BLoC or Triple users should use special Bind's in order to use the context.watch() and auto dispose functionality. They are: BlocBind() and TripleBind(), which are available through external packages. modular_bloc_bind -> BlocBind
      modular_triple_bind -> TripleBind

    Example:

    
    @override
    final List<Bind> binds = [
      BlocBind.singleton((i) => MyBloc()),
    ];
    
    • [BREAK CHANGE] Bind.export works only after imported.

    • @deprecated ModularState. A few months of research showed us that ModularState caused unnecessary coupling with the view and made it difficult for those who used it to understand. For this reason, we decided to deprecate it to ensure code congruence for all professionals who use Modular.

    • Removed triple dependency.

    • Simplify docs.

    • Added Modular.setArguments.

    Modular.setArguments('cody1024d');
    
    // get
    Modular.args.data; // -> cody1024d
    //or
    Bind((i) => MyClass(i.args.data));
    
    

    Issues

    Source code(tar.gz)
    Source code(zip)
  • v4.5.0(Feb 22, 2022)

    • @Deprecated: .modular() extension. Use instead:
        return MaterialApp.router(
          routeInformationParser: Modular.routeInformationParser,
          routerDelegate: Modular.routerDelegate,
        );
      
      
    • Added Modular.setInitialRoute.
    • Added Modular.setObservers.
    • Added Modular.setNavigatorKey.
    Source code(tar.gz)
    Source code(zip)
  • v4.3.0(Dec 11, 2021)

    • Added BuildContext extension [context.read()] and [context.watch()];
    • The [context.watch()] listen changes of [Listanable], [Stream] and [Store] by Triple;
    class Body extends StatelessWidget {
      Widget build(BuildContext context){
        final notifier = context.watch<ValueNotifier>();
        return Text('${notifier.value}')
      }
    }
    
    • Use select in .watch() to select the reactive property:
    class Body extends StatelessWidget {
      Widget build(BuildContext context){
        final bloc = context.watch<CounterBloc>((bloc) => bloc.stream);
        return Text('${bloc.state}')
      }
    }
    

    Also, use Store Selectors in conjunction with .watch:

    class OnlyErrorWidget extends StatelessWidget {
      Widget build(BuildContext context){
        // changes with store.setError();
        final store = context.watch<MyTripleStore>((store) => store.selectError);
        return Text('${store.error}')
      }
    }
    

    See more details here

    Source code(tar.gz)
    Source code(zip)
  • v4.1.2(Oct 4, 2021)

  • v4.0.1(Sep 22, 2021)

  • 4.0.0+7(Sep 19, 2021)

    New documentation is here! https://modular.flutterando.com.br. Modular design now uses Layered Architecture (Clean Architecture) with 100% code coverage. Up to 30% improvement in obtaining routes. BREAK CHANGE: RouteGuard([redirectTo]) -> RouteGuard({String? redirectTo}). BREAK CHANGE: flutter_modular_test will be discontinued. Use modular_test instead. FIX #516

    Source code(tar.gz)
    Source code(zip)
  • V3.3.0-beta.7(Jun 23, 2021)

  • 3.2.0-beta.1(Apr 30, 2021)

  • 3.2.0-beta(Apr 30, 2021)

  • 2.0.0+1(Aug 22, 2020)

    Welcome to Flutter Modular 2.0!!!

    Break Changes Router object Renamed to ModularRouter.

    //before
      @override
      List<Router> get routers => [
            Router('/', (i, args) => LoginPage()),
            Router('/home', (i, args) => HomePage()),
          ];
    //now 2.0
      @override
      List<ModularRouter> get routers => [
            ModularRouter('/', (i, args) => LoginPage()),
            ModularRouter('/home', (i, args) => HomePage()),
          ];
    
    New Widget RouterOutletList (Check doc);
    
    

    ***Inject.params is deprecated

    Source code(tar.gz)
    Source code(zip)
Modular server framework with ConnectMe (WebSockets + PackMe) and MongoDb support.

What is ServeMe ServeMe is a simple and powerful modular server framework. It allows to easily create backend services for both mobile and web applica

Source Caster 20 Dec 3, 2022
A MVVM architecture and project structure approaches to developing Flutter apps

Flutter Architecture Blueprints Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to dev

zulfi007 4 Mar 18, 2022
Flutter Fashion Week App UI and Project Structure

flutter_fashion_week Flutter Fashion Week App UI and Project Structure.

Ufuk 33 Jun 21, 2022
Flutter example project to run Solidity smart contracts using web3Dart library

Fluthereum Description Flutter example project to run Solidity smart contracts using web3Dart library Dependencies web3dart: A dart library that conne

Marcos Carlomagno 72 Dec 27, 2022
Flutter Smart Admin Panel & Dashboard

?? ?? Smart Admin Panel & Dashboard Flutter Web Smart Admin & Panel Dashboard with flutter UI kit. Support ⭐️ If you want to access the backend(Fireba

Deniz Çolak 333 Dec 25, 2022
Flutter UI challenge (with Box2D physic)- Smart washing machine app

Flutter UI Challenge- SMART Washing Machine About project The application was written based on this great UI concept: https://dribbble.com/shots/11018

Tomasz Pawlikowski 754 Dec 27, 2022
Smart course app built in flutter.

flutter_smart_course Smart course app is built in flutter. App design is based on Smart Course designed by Nugraha Jati Utama Screenshots Android Home

Sonu Sharma 627 Jan 3, 2023
Concepts used Flutter layout,State management, Blockchain integration, Http api integration, Smart contracts

HS_CryptoCoin_Wallet First project using Flutter with Blockchain Getting Started This project is a starting point for a Flutter application. A few res

Harsh Saxena 1 Dec 23, 2021
Easy to use open source Hub 🕸️ to control your smart devices from one app.

CyBear Jinni Hub Welcome! This repository is in charge of controlling smart devices and is part of the CyBear Jinni Smart Home system. The software is

CyBear Jinni 26 Nov 23, 2022
Easy to use open source Hub 🕸️ to control your smart devices from one app.

CyBear Jinni Hub Welcome! This repository is in charge of controlling smart devices and is part of the CyBear Jinni Smart Home system. The software is

CyBear Jinni 13 Jul 22, 2021
Transform your smart devices to intelligent communicators.

Donna According to a survey of 601 people, 57.9 % of participants experienced communication difficulties, with 23.5 % reporting severe difficulties. O

Betaoverflow 9 Dec 19, 2022
This is a smart farming app which helps farmers to remotely monitor their crop and take necessary actions. It also has a feature called disease detection.

Smart-Farming-App This is a smart farming app which helps farmers to remotely monitor their crop and take necessary actions. It has features called di

Nihar Shah 2 Jul 9, 2022
A smart Diet and Fitness App

studio_projects A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

null 1 Oct 25, 2021
Smart Home Controlling App

wifi_smart_home_five Hinox Wifi Smart Home App Getting Started This project is a starting point for a Flutter application. A few resources to get you

Hiloliddin 1 Nov 10, 2021
A Dart library with a solution to use smart enums

Smart Enums Author: Jop Middelkamp A package that can help you create 'smarter' enums that could be extended with some domain logic. Usage final bestF

Jop Middelkamp 2 Oct 1, 2022
A bot to swap instantly tokens using PancakeSwap smart contracts

Swap Pancake Bot Swap Pancake Bot foi feito para fazer swaps instantâneos sem ne

Lucas Almeida 5 Jan 6, 2022
A Simple Todo app design in Flutter to keep track of your task on daily basis. Its build on BLoC Pattern. You can add a project, labels, and due-date to your task also you can sort your task on the basis of project, label, and dates

WhatTodo Life can feel overwhelming. But it doesn’t have to. A Simple To-do app design in flutter to keep track of your task on daily basis. You can a

Burhanuddin Rashid 1k Jan 6, 2023
Rename Flutter Project Bundle ID Plugin with Firebase Project Support

About (Null-Safety) It helps you to change your flutter project's AppName and BundleId for different platforms, currently only available for IOS, Andr

Inter-Con Security 1 Nov 12, 2021