how textfield move up when keyboard appears flutter

import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Animation Demo',
      theme: new ThemeData(
        primaryColor: new Color(0xFFFF0000),
      ),
      home: new FormDemo(),
    );
  }
}

class FormDemo extends StatefulWidget {
  @override
  _FormDemoState createState() => _FormDemoState();
}

class _FormDemoState extends State<FormDemo> with SingleTickerProviderStateMixin {
  AnimationController _controller;
  Animation _animation;

  FocusNode _focusNode = FocusNode();

  @override
  void initState() {
    super.initState();

    _controller = AnimationController(vsync: this, duration: Duration(milliseconds: 300));
    _animation = Tween(begin: 300.0, end: 50.0).animate(_controller)
    ..addListener(() {
      setState(() {});
    });

    _focusNode.addListener(() {
      if (_focusNode.hasFocus) {
        _controller.forward();
      } else {
        _controller.reverse();
      }
    });
  }

  @override
  void dispose() {
    _controller.dispose();
    _focusNode.dispose();

    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomPadding: false, // this avoids the overflow error
      appBar: AppBar(
        title: Text('TextField Animation Demo'),
      ),
      body: new InkWell( // to dismiss the keyboard when the user tabs out of the TextField
        splashColor: Colors.transparent,
        onTap: () {
          FocusScope.of(context).requestFocus(FocusNode());
        },
        child: Container(
          padding: const EdgeInsets.all(20.0),
          child: Column(
            children: <Widget>[
              SizedBox(height: _animation.value),
              TextFormField(
                decoration: InputDecoration(
                  labelText: 'I move!',
                ),
                focusNode: _focusNode,
              )
            ],
          ),
        ),
      ),
    );
  }
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
flutter typing makes shift flutter sliver widget when keyboard is selected flutter shift textfield when keyboard displayed shift container up when keyboard is open how to fix the position of the elements when is appeared keyboard in flutter how to fix the position of the element when is appeared keyboard in flutter adjust keybaord behaviour in textform field flutter move form up when show keyboard flutter flutter move out of textfield how to push up a field when keyboard appears in flutter if textfield is visible dont move it flutter column in moing out when keyboard opens flutter how to make textformfield go above keyboard flutter make textfield go above keyboard flutter move textfiled up keyboard with flutter how to make ui appear above keyboard flutter move textfield up when keyboard appears flutter make textfield not move up flutter move textfield when keyboard appears flutter text field in which the title moves up flutter when keyborad slide up flutter animate move textfield when keyboard opens flutter move screen up when keyboard appears with animation flutter move page if keyboard showsup flutter move content all the way up when keyboard is opened flutter move textfield top flutter when tap on text it goes up in flutter flutter move everything up on textview when typing bottom bar comming up on textfield flutter flutter + how do widgets moves top when we use keypad for typing move text form field away from sides in sizedbox flutter move text fields up or down in flutter make page move when keyboard is active flutter flutter push widget up when keyboard is active or up flutter position with keyboard shift textfield when keyboard is used flutter set textfield on top off keyoard in flutter textfield move up keyboard flutter list vie textfield move up keyboard flutter how textfield move up when keyboard appears flutter
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source