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

isModal:true makes the tooltip persistant (on previous page) when a GestureDetector of higher level pushes the navigator to a new route... #59

Open
CodesbyRobot opened this issue Jul 18, 2022 · 0 comments

Comments

@CodesbyRobot
Copy link

CodesbyRobot commented Jul 18, 2022

...Not allowing the tooltip to show for any new item on the new route (as the previous one wasn't closed 'properly'. It also doesn't allow it to close on the new page as it technically doesn't exist on that page? Lets look at this example:

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Error App',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Error'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String title;

  const MyHomePage({
    Key? key,
    required this.title,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center: (child: GestureDetector(
        onDoubleTap: () {
          Navigator.push<void>(
            context,
            MaterialPageRoute(builder: (context) {
              FocusScope.of(context).unfocus();
              return SecondPage();
            }),
          );
        },
        child: ToolTipBug(
          description: 'Hello',
        ),
      ),
     ),
   );
  }
}

class ToolTipBug extends StatelessWidget {
  final String description;

  const ToolTipBug({
    Key? key,
    required this.description,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return JustTheTooltip(
      isModal: true,
      triggerMode: TooltipTriggerMode.tap,
      content: Text(description),
      child: SizedBox(
        height: 100,
        child: Center(child: Text('Test')),
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  const SecondPage({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {


    return  Scaffold(
      appBar: AppBar(
        title: Text('Page 2'),
      ),
      body: Center: (
        child: ToolTipBug(
          description: 'hello 2',
        ),
      ),
   );
  }
}


Lets consider this simple example. When you open the tooltip and then double click on the MyHomePage Class, and you go to the SecondPage, you expect the modal of the previous page to be closed and that you will be able to open the second ToolTipBug Widget on SecondPage by cliking on it but this doesn't happen. The previous modal in the MyHomePage Class persists (but is not there) and nothing opens in the new page. This behaviour only happens when isModal is set to true.

@CodesbyRobot CodesbyRobot changed the title isModal:true makes the tooltip persistant (on previous page) when a GestureDetector of higher level pushes the navigator to a new route isModal:true makes the tooltip persistant (on previous page) when a GestureDetector of higher level pushes the navigator to a new route... Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant