GithubHelp home page GithubHelp logo

Comments (3)

rekire avatar rekire commented on June 11, 2024

FYI: My current workaround is that I put the AppBar in a ExcludeFocus widget, since there is that (IMHO annoying) PreferredSizeWidget you need to write a lot of boilerplate of it:

UnfocusableAppBar
class UnfocusableAppBar extends StatelessWidget implements PreferredSizeWidget {
  final AppBar _appBar;
  UnfocusableAppBar({
    super.key,
    Widget? leading,
    bool automaticallyImplyLeading = true,
    Widget? title,
    List<Widget>? actions,
    Widget? flexibleSpace,
    PreferredSizeWidget? bottom,
    double? elevation,
    double? scrolledUnderElevation,
    ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate,
    Color? shadowColor,
    Color? surfaceTintColor,
    ShapeBorder? shape,
    Color? backgroundColor,
    Color? foregroundColor,
    IconThemeData? iconTheme,
    IconThemeData? actionsIconTheme,
    bool primary = true,
    bool? centerTitle,
    bool excludeHeaderSemantics = false,
    double? titleSpacing,
    double toolbarOpacity = 1.0,
    double bottomOpacity = 1.0,
    double? toolbarHeight,
    double? leadingWidth,
    TextStyle? toolbarTextStyle,
    TextStyle? titleTextStyle,
  }): _appBar = AppBar(
    leading: leading,
    automaticallyImplyLeading: automaticallyImplyLeading,
    title: title,
    actions: actions,
    flexibleSpace: flexibleSpace,
    bottom: bottom,
    elevation: elevation,
    scrolledUnderElevation: scrolledUnderElevation,
    notificationPredicate: notificationPredicate,
    shadowColor: shadowColor,
    surfaceTintColor: surfaceTintColor,
    shape: shape,
    backgroundColor: backgroundColor,
    foregroundColor: foregroundColor,
    iconTheme: iconTheme,
    actionsIconTheme: actionsIconTheme,
    primary: primary,
    centerTitle: centerTitle,
    excludeHeaderSemantics: excludeHeaderSemantics,
    titleSpacing: titleSpacing,
    toolbarOpacity: toolbarOpacity,
    bottomOpacity: bottomOpacity,
    toolbarHeight: toolbarHeight,
    leadingWidth: leadingWidth,
    toolbarTextStyle: toolbarTextStyle,
    titleTextStyle: titleTextStyle,
  );

  @override
  Widget build(BuildContext context) => ExcludeFocus(child: _appBar);

  @override
  Size get preferredSize => _appBar.preferredSize;
}

Please be aware that this breaks the usage of the app bar with the keyboard and accessibility. For my use case this seems to be acceptable.

from flutter.

huycozy avatar huycozy commented on June 11, 2024

Hi @rekire
I'm unsure what the actual result is. Do you mean the drawer is auto-open while entering text on the field? If so, I couldn't reproduce it.

Open the drawer with a bluetooth keyboard and close it

For this step, do you use keyboard or tap on drawer button?

from flutter.

rekire avatar rekire commented on June 11, 2024

I want to type text into the WebView without accidentally executing any other actions. When you used the native UI and use then the WebView the AppBar has the keyboard focus, but you can type text into the input fields. Since the letters "h", "e", "l" and "o" are not handled the AppBar the WebView can consume it, but enter and space is consumed by the other widgets. If the key pressed would not be handled by the WebView it would be less confusing for the customer

It does not really matter how you opened it first tap or enter/space works both

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.