visible_on_focus 0.0.1 copy "visible_on_focus: ^0.0.1" to clipboard
visible_on_focus: ^0.0.1 copied to clipboard

a Flutter widget that automatically scrolls a focused text field (or any other focusable widget) into view when the keyboard appears

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:visible_on_focus/visible_on_focus.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Visible On Focus Example',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Visible On Focus Example'),
        ),
        body: const Padding(
          padding: EdgeInsets.all(16.0),
          child: MyForm(),
        ),
      ),
    );
  }
}

class MyForm extends StatelessWidget {
  const MyForm({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: const [
        SizedBox(height: 700), // Spacer to demonstrate scrolling
        VisibleOnFocus(
          child: TextField(
            decoration: InputDecoration(
              labelText: 'Enter Text',
              hintText: 'Focus here to scroll',
            ),
          ),
        ),
        SizedBox(height: 300), // More content to demonstrate scrolling
      ],
    );
  }
}
1
likes
140
pub points
22%
popularity

Publisher

unverified uploader

a Flutter widget that automatically scrolls a focused text field (or any other focusable widget) into view when the keyboard appears

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on visible_on_focus