Flutter : extract gif url from text

Viewed 60

I'm using a TextFormField to add text to my screen.

TextFormField(
  validator: (value) {
     if (value == null || value.isEmpty) {
       showLocalNotif(fToast,message: "message");
       return;
     }
     return null;
  },
  cursorColor: ProximAppColors.ColorAccent,
  keyboardType: TextInputType.emailAddress,
  controller: commentaireTextController,
  style: kSimpleTextStyle,
  decoration: kInputDecoration.copyWith(
       hintText: "hint",
       border: InputBorder.none,
     ),
  ),

When I go to the gif section of my keyboard, I retrieve an url from the GIF.

My question : how do I extract this url and display if directly inside an image widget, so that the user can't see the url ? Do I have to go for a fully custom widget that extends TextFormField ?

For now, I have created a controller, add a custom listener to it, but the only way I've found to extract it, it's to check each time the user typed something that looks like http%/%.gif, but we can agree that's it's not ideal.. .

  void _printCommentaireValue() {
    /// checking the new value...
    print(commentaireTextController.text);
  }

  @override
  void initState() {
    super.initState();
    commentaireTextController.addListener(_printCommentaireValue);
  }

I read old comments (2 years ago) which say that's not possible, but maybe in 2021 it is, maybe with a flutter package ? (didn't find any)

0 Answers
Related