> ## Documentation Index
> Fetch the complete documentation index at: https://starrycodes.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# BuildContext - Focus & Keyboard Control

> Tame the keyboard and control widget focus order directly from BuildContext, simplifying form navigation and dismissal.

{/*     title="⚡ Quick Usage" */}

{/* > */}

{/*     filename="context" */}

{/*     icon="water" */}

{/*     lines="true" */}

{/* > */}

{/*     context.nextFocus(); */}

{/*     context.unFocus(); */}

{/*     context.requestFocus(myFocusNode); */}

{/* </Card> */}

<Steps titleSize="h3">
  <Step title="🔍 Focus Scope Access">
    <ResponseField name="focusScope" type="FocusScopeNode">
      The underlying node that manages the focus for the current widget tree. Use it for advanced focus inspection.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final scope = context.focusScope;
      ```
    </ResponseField>
  </Step>

  <Step title="🚀 Navigation & Control">
    <ResponseField name="nextFocus()" type="void">
      Moves the focus to the next focusable widget in the traversal order. Essential for smooth form submission flow.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      TextField(onSubmitted: (_) => context.nextFocus());
      ```
    </ResponseField>

    <ResponseField name="prevFocus()" type="void">
      Moves the focus to the *previous* focusable widget in the traversal order. Useful for implementing "back" logic in forms.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      ElevatedButton(
          onPressed: () => context.prevFocus(),
          child: Text('Previous')
      );
      ```
    </ResponseField>

    <ResponseField name="requestFocus(FocusNode focusNode)" type="void">
      Instantly transfers focus to a specific, non-sequential `FocusNode`.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final specificNode = FocusNode();
      `{...}`
      context.requestFocus(specificNode);
      ```
    </ResponseField>

    <ResponseField name="unFocus()" type="void">
      The Keyboard Slayer. Dismisses the software keyboard and removes focus from any active field.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      ElevatedButton(
          onPressed: () => context.unFocus(),
          child: Text('Done'),
      );
      ```
    </ResponseField>
  </Step>
</Steps>
