Giter VIP home page Giter VIP logo

Comments (2)

sur950 avatar sur950 commented on July 26, 2024

Hey @SatyamKr07

I suggest to verify your link prior to passing it to the LinkPreview.
However, Let me run this & see what is the error that we are getting.

I will be releasing a new version before this weekend & you can expect a fix in the same.

Thanks mate

from any_link_preview.

sur950 avatar sur950 commented on July 26, 2024

@SatyamKr07 Pass the Key to the LinkPreview widget & your issue will be solved.
Something like key: Key(linkUrlController.text.toString())

class VerifyLinkUI extends StatefulWidget {
  @override
  _VerifyLinkUIState createState() => _VerifyLinkUIState();
}

class _VerifyLinkUIState extends State {
  TextEditingController linkUrlController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: TextField(
            controller: linkUrlController,
            decoration: const InputDecoration(
                hintText: "Paste link of google drive,google docs,youtube etc",
                hintStyle: TextStyle(fontSize: 12)),
            onChanged: (value) {
              setState(() {
                print(
                    'linkUrlController is ============= ${linkUrlController.text}');
              });
            },
          ),
        ),
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: AnyLinkPreview(
            key: Key(linkUrlController.text.toString()),
            link: linkUrlController.text,
            displayDirection: UIDirection.UIDirectionHorizontal,
            showMultimedia: true,
            bodyMaxLines: 5,
            bodyTextOverflow: TextOverflow.ellipsis,
            titleStyle: const TextStyle(
              color: Colors.black,
              fontWeight: FontWeight.bold,
              fontSize: 15,
            ),
            bodyStyle: const TextStyle(color: Colors.grey, fontSize: 12),
            errorBody: 'Show my custom error body',
            errorTitle: 'Show my custom error title',
            errorWidget: Container(
              color: Colors.grey[300],
              child: const Text('Oops!'),
            ),
            errorImage: "https://google.com/",
            cache: const Duration(days: 7),
            backgroundColor: Colors.grey[300],
            borderRadius: 0,
            removeElevation: false,
            boxShadow: const [BoxShadow(blurRadius: 3, color: Colors.grey)],
            onTap: () {}, // This disables tap event
          ),
        ),
      ],
    );
  }
}
`

from any_link_preview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.