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

Switch inside CupertinoActionSheet no updates state #62264

Closed
edwin-alvarez opened this issue Jul 25, 2020 · 2 comments
Closed

Switch inside CupertinoActionSheet no updates state #62264

edwin-alvarez opened this issue Jul 25, 2020 · 2 comments

Comments

@edwin-alvarez
Copy link

Why does the Switch not keeps the new state after updated on a CupertinoActionSheet?

Jul-25-2020 08-15-18

Future<int> countAsReturnVisit(CalendarEvent event) async {
    bool remember = false;

    var res = await showCupertinoModalPopup(
      context: context,
      builder: (BuildContext cnt) {
        return Material(
          color: Colors.transparent,
          child: CupertinoActionSheet(
            message: Wrap(
              children: <Widget>[
                Text(
                    'Do you want to count \'Completed\' events as part of Return Visits?'
                        .i18n),
                Container(
                  height: 50,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Text('Remember this selection'.i18n),
                      Switch(
                        value: remember,
                        onChanged: (value) {
                          setState(() {
                            remember = value;
                          });
                        },
                        activeTrackColor: Colors.lightBlue[200],
                        activeColor: Colors.blue,
                      ),
                    ],
                  ),
                ),
              ],
            ),
            actions: <Widget>[
              CupertinoActionSheetAction(
                child: Text('No'.i18n),
                onPressed: () {
                  Navigator.pop(context, 0);
                },
              ),
            ],
            cancelButton: CupertinoActionSheetAction(
              isDefaultAction: true,
              child: Text('Yes'.i18n),
              onPressed: () {
                Navigator.pop(context, 1);
              },
            ),
          ),
        );
      },
    ) as int;

    if (res != null && res == 1) {
      setCalendarAlwaysCountAsRrtuVist();
    }

    return res;
  }
Show flutter doctor -v EMacPro:pioneerhelper emalware$ flutter doctor -v [✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.6 19G73, locale en-US) • Flutter version 1.17.5 at /Users/emalware/Documents/flutter • Framework revision 8af6b2f (4 weeks ago), 2020-06-30 12:53:55 -0700 • Engine revision ee76268252 • Dart version 2.8.4

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/emalware/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.3

[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.47.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.12.2

[✓] Connected device (1 available)
• iPhone Xʀ • 49212422-2B11-4504-9F14-6DDB891940BE • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)

• No issues found!
EMacPro:pioneerhelper emalware$

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant