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

[Flutter Web] The widgets for which the hint is displayed are not highlighted #390

Closed
norutplz opened this issue Aug 26, 2023 · 9 comments · Fixed by #394
Closed

[Flutter Web] The widgets for which the hint is displayed are not highlighted #390

norutplz opened this issue Aug 26, 2023 · 9 comments · Fixed by #394
Labels
duplicate This issue or pull request already exists

Comments

@norutplz
Copy link

norutplz commented Aug 26, 2023

Describe the bug
In the web version, the widget for which the hint is displayed is not highlighted. The release was made through the "flutter build web" command.
Works fine in Android and iOS, version on package: 2.0.3

To Reproduce
Steps to reproduce the behavior:

  1. flutter build web
  2. Open app in browser
  3. See error

Expected behavior
The widget highlighted in red in the screenshot is highlighted

Desktop (please complete the following information):

  • Browser [chrome]
image
@norutplz
Copy link
Author

I noticed that in the "Inspect Element" mode, the widget is highlighted

image

@jaiminrana05
Copy link
Contributor

Hi @HornyPony, can you please provide more information about the issue you're facing? Additionally, kindly share the code snippets as I'm unable to reproduce the problem.

@norutplz
Copy link
Author

Hi @HornyPony, can you please provide more information about the issue you're facing? Additionally, kindly share the code snippets as I'm unable to reproduce the problem.

There is nothing special in the code - everything is according to the instructions from pub.dev. Hints are shown in the mobile version of the app, but do not work in the web version. But sometimes they are shown, but it happens that the wrong area is highlighted. Maybe I need to add something to the "flutter build web" command?

@norutplz
Copy link
Author

norutplz commented Aug 30, 2023

Hi @HornyPony, can you please provide more information about the issue you're facing? Additionally, kindly share the code snippets as I'm unable to reproduce the problem.

I found a reason but i still need ur help. It turned out that the problem is as follows: the hint is highlighted, but it is incorrectly positioned, because in the web version the application does not occupy the entire screen, but a certain part of it. However, the hint is highlighted based on the size of the user's entire screen.
The arrow highlights the shifted hint, the red rectangle - where it should be, and the green one - the area of displacement relative to the entire screen

image

The screen size is defined here:

class _ApplicationState extends State<Application> {
  final AppRouter _appRouter = AppRouter();
  bool isExpandedApp = false;


  @override
  Widget build(BuildContext context) {
    final double windowHeight = MediaQuery.of(context).size.height;
    final double windowWidth = MediaQuery.of(context).size.width;

    return Directionality(
      textDirection: TextDirection.ltr,
      child: Stack(
        children: [
          Container(
            alignment: Alignment.center,
            decoration: const BoxDecoration(
              image: DecorationImage(
                image: AssetImage(AppImages.webBackground),
                fit: BoxFit.cover,
              ),
            ),
            child: MediaQuery(
              data: MediaQueryData(
                size: Size(isExpandedApp ? windowWidth / 1.2 : windowHeight / 2,
                    windowHeight),
              ),
              child: ScreenUtilInit(
                  minTextAdapt: true,
                  useInheritedMediaQuery: true,
                  designSize: const Size(
                    360,
                    640,
                  ),
                  builder: (context, _) {
                    return Center(
                      child: MaterialApp.router(
                        localizationsDelegates: const [
                          S.delegate,
                          GlobalMaterialLocalizations.delegate,
                          GlobalWidgetsLocalizations.delegate,
                          GlobalCupertinoLocalizations.delegate,
                        ],
                        debugShowCheckedModeBanner: false,
                        supportedLocales: S.delegate.supportedLocales,
                        title: 'RANKS.app',
                        theme: AppTheme.lightTheme(),
                        routerConfig: _appRouter.config(),
                      ),
                    );
                  }),
            ),
          ),
          Align(
            alignment: Alignment.centerRight,
            child: Container(
              decoration: BoxDecoration(
                  color: Colors.white,

                  borderRadius: BorderRadius.circular(12)
              ),
              child: Container(
                margin: const EdgeInsets.all(8),
                decoration: BoxDecoration(
                    color: AppTheme.changeDisplayingScreenersBtnBackground,
                    borderRadius: BorderRadius.circular(6)
                ),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [

                    _ChangeResolutionBtn(
                      icon: AppIcons.webCollapsed,
                      onPressed: () {
                        if (isExpandedApp) {
                          setState(() {
                            isExpandedApp = false;
                          });
                        }
                      },
                      isSelected: !isExpandedApp,
                    ),
                    _ChangeResolutionBtn(
                      icon: AppIcons.webExpanded,
                      onPressed: () {
                        if (!isExpandedApp) {
                          setState(() {
                            isExpandedApp = true;
                          });
                        }
                      },
                      isSelected: isExpandedApp,
                    ),
                  ],
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

ShowcaseWidget here: Home Widget is the creen that contains all tabs

@RoutePage()
class HomeScreen extends StatelessWidget {
  const HomeScreen({Key? key}) : super(key: key);


  @override
  Widget build(BuildContext context) {
   
    return MediaQuery(
      data: MediaQuery.of(context).copyWith(
          textScaleFactor:
              MediaQuery.of(context).textScaleFactor.clamp(1.0, 1.2)),
      child ShowCaseWidget(
        enableAutoScroll: true,
        builder: Builder(
          builder: (context) {
            return AutoTabsScaffold(
              routes: [
                const ScreenerRoute(),
                const FavouriteRoute(),
                ForumRoute(),
                const ProfileRoute(),
              ],
              resizeToAvoidBottomInset: noResizeToAvoidBottomInset,
              bottomNavigationBuilder: !hideBottomNavConfigInRouter
                  ? (_, tabsRouter) {
                      return Theme(
                        data: AppTheme.lightTheme().copyWith(
                          splashColor: Colors.transparent,
                          highlightColor: Colors.transparent,
                        ),
                        child: BottomNavigationBar(
                         
                      );
                    }
                  : null,
            );
          },
        ),
      ),
    );
  }

@norutplz
Copy link
Author

The problem is most clearly seen here

image

@norutplz
Copy link
Author

@jaiminrana05 Here I manually brought the screen with the application to the left edge of the monitor. For some reason, for highlighting, the size is calculated first of the monitor, and not from the beginning of the screen with the application

telegram-cloud-photo-size-2-5442985722232557513-y

@norutplz
Copy link
Author

@jaiminrana05 The same problem is here: #383

Can I get any information please?

@jaiminrana05
Copy link
Contributor

Thank you @HornyPony, for sharing the code snippets. It's really helpful for us to have them as we work on resolving this issue.

jaiminrana05 added a commit that referenced this issue Sep 20, 2023
jaiminrana05 added a commit that referenced this issue Sep 21, 2023
@aditya-css aditya-css added the duplicate This issue or pull request already exists label Feb 7, 2024
@aditya-css
Copy link
Collaborator

Thank you @HornyPony for providing all the details and your cooperation. This issue looks like duplicate of #383 and a PR (#394 ) is currently open that would potentially fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
3 participants