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

Prevent interaction when load a heavy widget #86237

Closed
mrtdeh opened this issue Jul 10, 2021 · 3 comments
Closed

Prevent interaction when load a heavy widget #86237

mrtdeh opened this issue Jul 10, 2021 · 3 comments
Labels
r: timeout Issue is closed due to author not providing the requested details in time

Comments

@mrtdeh
Copy link

mrtdeh commented Jul 10, 2021

Hi everyone, Take a look in this example created by Visibility widget :

simplescreenrecorder-2021-07-10_21.58.01.mp4

I don't think there is a way to put the loading bar or any work around , because affecting all interactions and you should wait until the HeavyPage load is over.

code :

// ignore_for_file: sized_box_for_whitespace

import 'package:arsa_shop_admin/HeavyPage.dart';

import 'package:arsa_shop_admin/TinyPage.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class MainPage extends StatefulWidget {
  const MainPage({Key? key}) : super(key: key);

  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  // final _bodyScaffold = GlobalKey();
  bool hide = false;

  @override
  Widget build(BuildContext context) {
    return SafeArea(
        child: Column(
      children: [
        ElevatedButton(
          style: ElevatedButton.styleFrom(padding: const EdgeInsets.all(20)),
          onPressed: () {
            setState(() {
              hide = !hide;
            });
          },
          child: const Text("Toggle"),
        ),
        Container(
          width: 50,
          height: 50,
          padding: const EdgeInsets.symmetric(vertical: 10),
          child: const CircularProgressIndicator(),
        ),
        Container(
          width: 500,
          height: 300,
          decoration:
              BoxDecoration(border: Border.all(color: Colors.black, width: 1)),
          child: Stack(
            children: [
              Visibility(
                child: const HeavyPage(),
                visible: hide,
              ),
              Visibility(
                child: const TinyPage(),
                visible: !hide,
              ),
            ],
          ),
        ),
      ],
    ));
  }
}

flutter doctor --verbose :

[✓] Flutter (Channel master, 2.4.0-1.0.pre.94, on Ubuntu 20.04.2 LTS
    5.8.0-59-generic, locale en_US.UTF-8)
    • Flutter version 2.4.0-1.0.pre.94 at /home/mrtdeh/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ba143ae21e (3 days ago), 2021-07-06 22:01:02 -0700
    • Engine revision 60eea42346
    • Dart version 2.14.0 (build 2.14.0-284.0.dev)
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /media/mrtdeh/softwares/android-tools
    • Platform android-30, build-tools 29.0.3
    • ANDROID_HOME = /media/mrtdeh/softwares/android-tools
    • ANDROID_SDK_ROOT = /media/mrtdeh/softwares/android-tools
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_292-8u292-b10-0ubuntu1~20.04-b10)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup
      for detailed instructions).

[✓] VS Code (version 1.57.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.24.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114

! Doctor found issues in 1 category.
pubspec.yaml :
name: arsa_shop_admin
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  get: ^4.1.4
  

dev_dependencies:
  build_runner: ^2.0.6
  build_web_compilers: ^3.2.0
  build_test: any
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^1.0.0
  

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

Test on all browsers and test build mode but the problem is still there,
this problem is even applied for other widgets, such as : offstage, opacity , pageView and when push in to new screen,
test on the 'android' and 'web'.

@mrtdeh mrtdeh added the from: performance template Issues created via a performance issue template label Jul 10, 2021
@mrtdeh mrtdeh changed the title [Web] - Prevent interaction when load a heavy widget on the web Prevent interaction when load a heavy widget Jul 10, 2021
@maheshmnj maheshmnj added in triage Presently being triaged by the triage team and removed from: performance template Issues created via a performance issue template labels Jul 12, 2021
@maheshmnj
Copy link
Member

maheshmnj commented Jul 12, 2021

Hi @mrtdeh,
Thanks for filing the issue, please provide a minimal complete reproducible code sample that does not have any third-party packages and can be directly run with minimal code changes. The code sample you have provided has Unknown Widgets HeavyPage() and TinyPage(). Having a complete sample code helps to better address the issue.

Thank you.

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 12, 2021
@TahaTesser TahaTesser removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds in triage Presently being triaged by the triage team labels Aug 6, 2021
@TahaTesser
Copy link
Member

Hi @mrtdeh
Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v.
All system setups can be slightly different, so it's always better to open new issues and reference related issues.

@TahaTesser TahaTesser added the r: timeout Issue is closed due to author not providing the requested details in time label Aug 6, 2021
@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 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: timeout Issue is closed due to author not providing the requested details in time
Projects
None yet
Development

No branches or pull requests

3 participants