Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to add GIF in flutter TextFormField

Tags:

flutter

I have a chat screen text box and a button. I want user to be able to select gif offered by keyboard and then insert into chat screen.

TextFormField does not allow user to select GIF. Code is as follows:

video link is https://imgur.com/MKJNH1A

Error - testapp doesn't support image insertion here.

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Container(
            child: TextFormField(),
          ),
        ),
      ),
    );
  }
}
like image 586
max Avatar asked Jan 08 '20 13:01

max


People also ask

Does flutter support GIF?

In this flutter example tutorial we are going to learn load gif images in flutter application. Gif images are used to display animated graphics with multiple objects. Normally animate images will display in web browsers. in this we will show you load gif images in flutter application.


1 Answers

Flutter's TextField, TextFormField or any text input boxes do not accept characters other than the ones specified in Unicode.

To use GIFs, images or any other widgets in a TextField, try using extended_text_field package.This is NOT an official package but it was planed to be endorsed by the flutter team according to #30688 (comment).

extended_text_field provides a widget named SpecialText. You could use the ImageSpan widget to add images in the text field (which includes GIFs).

like image 152
sidrao2006 Avatar answered Oct 21 '22 14:10

sidrao2006