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

🐛 SignInScreen widget not calling headerBuilder method #404

Open
1 task done
weasdown opened this issue Sep 25, 2024 · 5 comments
Open
1 task done

🐛 SignInScreen widget not calling headerBuilder method #404

weasdown opened this issue Sep 25, 2024 · 5 comments
Labels
auth blocked: customer response Waiting for customer response, e.g. more information was requested. platform: all

Comments

@weasdown
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and found no duplicates.

What plugin is this bug for?

Firebase UI Auth

What platform(s) does this bug affect?

Android, Web, Windows

List of dependencies used.

flutter pub deps -s list

Dart SDK 3.5.3
Flutter SDK 3.24.3
signintest 1.0.0+1

dependencies:

  • cupertino_icons 1.0.8
  • firebase_auth 5.3.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
  • firebase_core 3.5.0 [firebase_core_platform_interface firebase_core_web flutter meta]
  • firebase_ui_auth 1.15.0 [email_validator firebase_auth firebase_core firebase_dynamic_links firebase_ui_localizations firebase_ui_oauth firebase_ui_shared flutter flutter_localizations meta]
  • flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]

dev dependencies:

  • flutter_lints 4.0.0 [lints]
  • flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]

transitive dependencies:

  • _flutterfire_internals 1.3.43 [collection firebase_core firebase_core_platform_interface flutter meta]
  • args 2.5.0
  • async 2.11.0 [collection meta]
  • boolean_selector 2.1.1 [source_span string_scanner]
  • characters 1.3.0
  • clock 1.1.1
  • collection 1.18.0
  • crypto 3.0.5 [typed_data]
  • desktop_webview_auth 0.0.15 [crypto flutter http flutter_web_plugins plugin_platform_interface]
  • email_validator 2.1.17
  • fake_async 1.3.1 [clock collection]
  • firebase_auth_platform_interface 7.4.6 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
  • firebase_auth_web 5.13.1 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web]
  • firebase_core_platform_interface 5.3.0 [collection flutter flutter_test meta plugin_platform_interface]
  • firebase_core_web 2.18.1 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
  • firebase_dynamic_links 6.0.7 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface]
  • firebase_dynamic_links_platform_interface 0.2.6+43 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
  • firebase_ui_localizations 1.12.0 [flutter flutter_localizations path]
  • firebase_ui_oauth 1.5.3 [desktop_webview_auth firebase_auth firebase_ui_auth firebase_ui_shared flutter_svg flutter]
  • firebase_ui_shared 1.4.1 [flutter]
  • flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
  • flutter_svg 2.0.10+1 [flutter http vector_graphics vector_graphics_codec vector_graphics_compiler]
  • flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
  • http 1.2.2 [async http_parser meta web]
  • http_parser 4.0.2 [collection source_span string_scanner typed_data]
  • intl 0.19.0 [clock meta path]
  • leak_tracker 10.0.5 [clock collection meta path vm_service]
  • leak_tracker_flutter_testing 3.0.5 [flutter leak_tracker leak_tracker_testing matcher meta]
  • leak_tracker_testing 3.0.1 [leak_tracker matcher meta]
  • lints 4.0.0
  • matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
  • material_color_utilities 0.11.1 [collection]
  • meta 1.15.0
  • path 1.9.0
  • path_parsing 1.0.1 [vector_math meta]
  • petitparser 6.0.2 [meta]
  • plugin_platform_interface 2.1.8 [meta]
  • sky_engine 0.0.99
  • source_span 1.10.0 [collection path term_glyph]
  • stack_trace 1.11.1 [path]
  • stream_channel 2.1.2 [async]
  • string_scanner 1.2.0 [source_span]
  • term_glyph 1.2.1
  • test_api 0.7.2 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
  • typed_data 1.3.2 [collection]
  • vector_graphics 1.1.11+1 [flutter http vector_graphics_codec]
  • vector_graphics_codec 1.1.11+1
  • vector_graphics_compiler 1.1.11+1 [args meta path_parsing xml vector_graphics_codec path]
  • vector_math 2.1.4
  • vm_service 14.2.5
  • web 1.1.0
  • xml 6.5.0 [collection meta petitparser]

Steps to reproduce

import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_auth/firebase_auth.dart' hide EmailAuthProvider;
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
import 'firebase_options.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );

  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Sign In Test',
      home: SignInTest(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return StreamBuilder<User?>(
      stream: FirebaseAuth.instance.authStateChanges(),
      builder: (context, snapshot) {
        int testValue = 0;
        if (!snapshot.hasData) {
          return SignInScreen(
            providers: [
              EmailAuthProvider(),
            ],
            headerBuilder: (context, constraints, shrinkOffset) {
              testValue = 1;
              return const Padding(
                padding: EdgeInsets.all(20),
                child: Center(
                  child: Text('Header text'),
                ),
              );
            },
          );
        }

        return Scaffold(
          body: Center(
            // Text will be 1 if headerBuilder called, 0 if not.
            child: Text('Value: $testValue'),
          ),
        );
      },
    );
  }
}

Expected Behavior

Expect headerBuilder to be triggered and the resulting widget to be displayed.

Actual Behavior

SignInScreen.headerBuilder is not called, so the header widget specified by the user is not displayed.

Additional Information

No response

@atreeon
Copy link

atreeon commented Oct 22, 2024

Any update on this @russellwheatley, thanks!

Edit:
Ah, it hides itself automatically when the width of the screen is larger than 800px

@github-actions github-actions bot added the Needs Attention OP created or responded to issue and it needs attention. label Oct 22, 2024
@russellwheatley
Copy link
Member

@weasdown - I think if you update this breakpoint: https://github.com/firebase/FirebaseUI-Flutter/blob/main/packages/firebase_ui_auth/lib/src/screens/sign_in_screen.dart#L121

You should be able to see the content of headerBuilder. It appears the breakpoint stops it from being rendered: https://github.com/firebase/FirebaseUI-Flutter/blob/main/packages/firebase_ui_auth/lib/src/screens/internal/responsive_page.dart#L153

Let me know if this solves your issue

@russellwheatley russellwheatley removed the Needs Attention OP created or responded to issue and it needs attention. label Oct 25, 2024
@github-actions github-actions bot added the Needs Attention OP created or responded to issue and it needs attention. label Oct 25, 2024
@russellwheatley russellwheatley added auth blocked: customer response Waiting for customer response, e.g. more information was requested. platform: all and removed Needs Attention OP created or responded to issue and it needs attention. labels Oct 25, 2024
Copy link

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot added the Stale Issue with no recent activity label Nov 22, 2024
@weasdown
Copy link
Author

Thanks @russellwheatley, adjusting the breakpoint fixed the issue. It strikes me as a bit counterintuitive though that the headerBuilder option just isn't used on screens wider than the breakpoint. I think it'd be quite reasonable for a developer to want a desktop app to use both headerBuilder and sideBuilder, to make use of the large width. I suggest the breakpoint behaviour could at least do with be clarified in the documentation, so that others building for larger screens don't hit the same issue, or if they do can work it out without getting into the package code.

@github-actions github-actions bot added Needs Attention OP created or responded to issue and it needs attention. and removed blocked: customer response Waiting for customer response, e.g. more information was requested. Stale Issue with no recent activity labels Nov 23, 2024
@russellwheatley
Copy link
Member

russellwheatley commented Nov 26, 2024

Hey @weasdown - you're more than welcome to open a PR to update the documentation if you feel it should reference this: https://github.com/firebase/FirebaseUI-Flutter/blob/main/packages/firebase_ui_auth/README.md

@russellwheatley russellwheatley added blocked: customer response Waiting for customer response, e.g. more information was requested. and removed Needs Attention OP created or responded to issue and it needs attention. labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth blocked: customer response Waiting for customer response, e.g. more information was requested. platform: all
Projects
None yet
Development

No branches or pull requests

3 participants