Skip to content

TextButton not working inside AppBar actions[ ] #84642

@ayaankhan98

Description

@ayaankhan98

Steps to Reproduce

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

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Test App"),
        actions: [
          TextButton(
            onPressed: () {},
            child: const Text(
              "Button 1",
            ),
          ),
          TextButton(
            onPressed: () {},
            child: const Text(
              "Button 2",
            ),
          )
        ],
      ),
    );
  }
}

Expected results:
TextButton should be visible in AppBar

Actual results:
TextButton is not visible. But if we replace TextButton with ElevatedButton then it will work fine. I think TextButton should also give the same behaviour as ElevatedButton meaning TextButton should also be visible.

Logs
 flutter run --verbose -d chrome
[  +96 ms] executing: uname -m
[  +43 ms] Exit code 0 from: uname -m
[        ] x86_64
[   +8 ms] executing: [/home/ayaan/workspace/repos/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +5 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 0d1358d7ee4c08d8e99a9f1b0cf6d2031a2e1fcb
[        ] executing: [/home/ayaan/workspace/repos/flutter/] git tag --points-at 0d1358d7ee4c08d8e99a9f1b0cf6d2031a2e1fcb
[  +15 ms] Exit code 0 from: git tag --points-at 0d1358d7ee4c08d8e99a9f1b0cf6d2031a2e1fcb
[   +1 ms] executing: [/home/ayaan/workspace/repos/flutter/] git describe --match *.*.* --long --tags 0d1358d7ee4c08d8e99a9f1b0cf6d2031a2e1fcb
[  +43 ms] Exit code 0 from: git describe --match *.*.* --long --tags 0d1358d7ee4c08d8e99a9f1b0cf6d2031a2e1fcb
[        ] 2.3.0-16.0.pre-278-g0d1358d7ee
[   +7 ms] executing: [/home/ayaan/workspace/repos/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +5 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/master
[        ] executing: [/home/ayaan/workspace/repos/flutter/] git ls-remote --get-url origin
[   +4 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/ayaankhan98/flutter
[  +99 ms] Unable to locate an Android SDK.
[   +4 ms] executing: [/home/ayaan/workspace/repos/flutter/] git rev-parse --abbrev-ref HEAD
[   +5 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] master
[  +75 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +92 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +92 ms] Skipping pub get: version match.
[ +151 ms] Generating /home/ayaan/workspace/testapp/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +524 ms] Launching lib/main.dart on Chrome in debug mode...
[ +140 ms] Updating assets
[ +102 ms] Waiting for connection from debug service on Chrome...
[  +82 ms] <- reset
[  +10 ms] /home/ayaan/workspace/repos/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/ayaan/workspace/repos/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
/home/ayaan/workspace/repos/flutter/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names --experimental-emit-debug-metadata
-DFLUTTER_WEB_AUTO_DETECT=true --output-dill /tmp/flutter_tools.AWAJDR/flutter_tool.WLMDTU/app.dill --libraries-spec
file:///home/ayaan/workspace/repos/flutter/bin/cache/flutter_web_sdk/libraries.json --packages /home/ayaan/workspace/testapp/.dart_tool/package_config.json
-Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-root /tmp/flutter_tools.AWAJDR/flutter_tools.DLXQDR
--filesystem-scheme org-dartlang-app --initialize-from-dill build/b1b715402d823b7fd5c2b68d2edcb2ce.cache.dill.track.dill --platform
file:///home/ayaan/workspace/repos/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk_sound.dill --sound-null-safety
[  +16 ms] <- compile org-dartlang-app:/web_entrypoint.dart
[+23608 ms] Waiting for connection from debug service on Chrome... (completed in 23.7s)
[        ] Synced 28.6MB.
[        ] <- accept
[        ] Caching compiled dill
[ +391 ms] Using Google Chrome 91.0.4472.77 unknown

[ +100 ms] executing: uname -m
[  +14 ms] Exit code 0 from: uname -m
[        ] x86_64
[ +431 ms] [CHROME]:Gtk-Message: 22:39:08.532: Failed to load module "appmenu-gtk-module"
[ +145 ms] [CHROME]:
[        ] [CHROME]:DevTools listening on ws://127.0.0.1:33447/devtools/browser/3ca3f787-eda3-4e88-a5ca-1b84d36aeb55
[ +572 ms] DwdsInjector: Received request for entrypoint at http://localhost:42399/main_module.bootstrap.js
[   +9 ms] MetadataProvider: Loading debug metadata...
[  +27 ms] MetadataProvider: Loaded debug metadata (sound null safety)
[  +14 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:42399/main_module.bootstrap.js
[+2287 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: true
[  +99 ms] DevHandler: Debug service listening on ws://127.0.0.1:41415/By2zPxj_N-c=/ws

[  +33 ms] This app is linked to the debug service: ws://127.0.0.1:41415/By2zPxj_N-c=/ws
[  +11 ms] Debug service listening on ws://127.0.0.1:41415/By2zPxj_N-c=/ws
[        ] 💪 Running with sound null safety 💪
[   +5 ms] 🔥  To hot restart changes while running, press "r" or "R".
[        ] For a more detailed help message, press "h". To quit, press "q".
[   +1 ms] An Observatory debugger and profiler on Chrome is available at: http://127.0.0.1:41415/By2zPxj_N-c=
[+2891 ms] DevTools activation throttled until 2021-06-16 04:08:36.603489.
[+101179 ms] The Flutter DevTools debugger and profiler on Chrome is available at: http://127.0.0.1:9102?uri=http%3A%2F%2F127.0.0.1%3A41415%2FBy2zPxj_N-c%3D
[+52979 ms] DevHandler: Stopped debug service on ws://127.0.0.1:37035

[ +179 ms] Application finished.
[  +11 ms] "flutter run" took 1,86,251ms.
[ +264 ms] ensureAnalyticsSent: 252ms
[   +1 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 0
flutter analyze
Analyzing testapp...                                                    
No issues found! (ran in 3.2s)
 flutter doctor -v
[✓] Flutter (Channel master, 2.3.0-17.0.pre.278, on Manjaro Linux 5.4.123-1-MANJARO, locale en_IN)
    • Flutter version 2.3.0-17.0.pre.278 at /home/ayaan/workspace/repos/flutter
    • Upstream repository https://github.com/ayaankhan98/flutter
    • Framework revision 0d1358d7ee (6 days ago), 2021-06-09 01:59:04 -0700
    • Engine revision 299c801978
    • Dart version 2.14.0 (build 2.14.0-190.0.dev)

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /opt/google/chrome/chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 11.1.0
    • cmake version 3.20.3
    • ninja version 1.10.2
    • pkg-config version 1.7.3

[!] 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
    • VS Code at /snap/code/current
    • Flutter extension version 3.23.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Manjaro Linux 5.4.123-1-MANJARO
    • Chrome (web)    • chrome • web-javascript • Google Chrome 91.0.4472.77 unknown

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

Labels

a: qualityA truly polished experiencef: material designflutter/packages/flutter/material repository.found in release: 2.2Found to occur in 2.2frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions