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

Background dim does not work in some screens. #84

Closed
abhimanyu95 opened this issue Nov 26, 2020 · 3 comments
Closed

Background dim does not work in some screens. #84

abhimanyu95 opened this issue Nov 26, 2020 · 3 comments

Comments

@abhimanyu95
Copy link

Describe the bug
The background dimming does not work on some screens .When i hot reload the current screen then dimming is shown or if we have multiple showcase then on the first showcase it does not show but on next showcase the dimming works.

Here is my code

class Task extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _Task();
}

class _Task extends State<Task> {
  DateTime now = DateTime.now();

  GlobalKey _calendarKey = GlobalKey();

  
  BuildContext myContext;

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      if (AppConfig.prefs.getBool('taskFinished') == null ||
          !AppConfig.prefs.getBool('taskFinished')) {
        ShowCaseWidget.of(myContext).startShowCase([
          _calendarKey,
        ]);
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return ShowCaseWidget(
      builder: Builder(builder: (context) {
        myContext =context;
        return Scaffold(
          backgroundColor: AppColor.appBg,
          appBar: MyAppBar(
            pageTitle: Strings.task,
            showBack: true,
          ),
          body: Stack(
            children: [
              /// Main Column
              Column(
                mainAxisSize: MainAxisSize.max,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  /// Top Menu
                  CommonWidgets.getTopControlsWidget(context),

                  /// User Info
                  CommonWidgets.getUserWidget(),


                  /// Calendar
                  Showcase(
                    key: _calendarKey,
                    description: 'This is a calendar',
                    child: CalendarDatePicker(
                      lastDate: now,
                      firstDate: DateTime(2001, 01, 01),
                      initialDate: now,
                      onDateChanged: (date) {
                        Navigator.pushNamed(context, "/taskManger");
                      },
                    ),
                  )

                ],
              ),

              //Bottom Controls
              Align(
                alignment: Alignment.bottomCenter,
                child: CommonWidgets.getBottomControls(false),
              )
            ],
          ),
        );
      }),
    );
  }
}

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
https://drive.google.com/file/d/1IEwLA3qVGKXMHz1NMiPmLWT5aTRLzFsV/view?usp=sharing

Desktop (please complete the following information):
[✓] Flutter (Channel stable, 1.22.3, on Linux, locale en_IN)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio (not installed)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

@dwilimsius
Copy link

dwilimsius commented Jan 8, 2021

Hi Abhi, i solved this problem .. here what you can do, i modified a little bit of your code like mine

WidgetsBinding.instance.addPostFrameCallback((timeStamp) { // add future delay function below here Future.delayed(const Duration(seconds: 1), () { // actually this code made my code working ShowCaseWidget.of(myContext).startShowCase([ _calendarKey, ]); }); });

maybe you can try this way

@dwilimsius
Copy link

hmm sorry, i dunno how to paste the code, i looks like little bit messy .. but i think you can see at this picture i attached
image

@mobile-simformsolutions

Closing this issue as it seems to be of implementation.

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

3 participants