Skip to content

TabBarView always change to the first one after minimize the application window in flutter for windows #64718

@Zou-Jia

Description

@Zou-Jia

Steps to Reproduce

  1. Run flutter create bug.
  2. Update the lib/main.dart as follows: ...
import 'package:flutter/material.dart';

void main() {
  runApp(TabBarDemo());
}

class TabBarDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(icon: Icon(Icons.directions_car)),
                Tab(icon: Icon(Icons.directions_transit)),
                Tab(icon: Icon(Icons.directions_bike)),
              ],
            ),
            title: Text('Tabs Demo'),
          ),
          body: TabBarView(
            children: [
              Icon(Icons.directions_car),
              Icon(Icons.directions_transit),
              Icon(Icons.directions_bike),
            ],
          ),
        ),
      ),
    );
  }
}

  1. flutter run -d windows
    switch tab to second or third tab, minimize application and reopen it.

Expected results:
TabBarView should be synced with tabbar.
Actual results:
First TabBarView is shown. See the picture:
Capturer_gif_20200827_215419_317

Logs
[√] Flutter (Channel master, 1.22.0-2.0.pre.93, on Microsoft Windows [Version 10.0.18363.1016], locale zh-CN)
    • Flutter version 1.22.0-2.0.pre.93 at F:\flutter
    • Framework revision f35a8b7470 (9 hours ago), 2020-08-26 21:33:03 -0700
    • Engine revision 388193a67b
    • Dart version 2.10.0 (build 2.10.0-62.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.2)
    • Android SDK at F:\Android_SDK
    • Platform android-29, build-tools 29.0.2
    • ANDROID_SDK_ROOT = F:\Android_SDK
    X Android SDK file not found: F:\Android_SDK\platforms\android-29\android.jar.
    • Try re-installing or updating your Android SDK,
      visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.6.5)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.6.30320.27
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.0)
    • Android Studio at F:\Android Studio
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.48.2)
    • VS Code at C:\Users\zouji\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.13.2

[√] Connected device (1 available)
    • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.18363.1016]

! Doctor found issues in 1 category.
BTW, I cannot reproduce this in flutter for macos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: state restorationRestorationManager and related APIsf: material designflutter/packages/flutter/material repository.found in release: 1.22Found to occur in 1.22frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions