We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thank you for the plugin!
Could you possibly let me know if it's possible to change the url in setstate?
When I try to do this absolutely nothing happens when url is changed and setstate launched.
What I got as an example:
String previewUrl = 'https://google.com'; Widget build(BuildContext context) { PostsViewModel viewModel = Provider.of<PostsViewModel>(context); return WillPopScope( onWillPop: () async { await viewModel.resetPost(); return true; }, child: ModalProgressHUD( progressIndicator: circularProgress(context), inAsyncCall: viewModel.loading, child: Scaffold( key: viewModel.scaffoldKey, appBar: AppBar( leading: IconButton( icon: Icon(Feather.x), onPressed: () { viewModel.resetPost(); Navigator.pop(context); }, ), title: Text('MyApp'), centerTitle: true, actions: [ InkWell( onTap: () async { print(controller.text); await postToApi(viewModel.description); controller.clear(); viewModel.resetPost(); Navigator.pushReplacement( context, MaterialPageRoute(builder: (context) => TabScreen()), ); }, child: Padding( padding: const EdgeInsets.all(20.0), child: Text( 'Post'.toUpperCase(), style: TextStyle( fontWeight: FontWeight.bold, fontSize: 15.0, color: Theme.of(context).accentColor, ), ), ), ) ], ), body: ListView( children: [ AnyLinkPreview( link: previewUrl, displayDirection: UIDirection.UIDirectionHorizontal, cache: Duration(hours: 1), backgroundColor: Colors.grey[300], errorWidget: Container( color: Colors.grey[300], child: Container(), ), ), Padding( padding: EdgeInsets.all(10), child: Column(children: [ Container( width: double.infinity, child: Text( 'Link'.toUpperCase(), style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.w600, ), ), ), TextFormField( decoration: InputDecoration( hintText: 'Source', focusedBorder: UnderlineInputBorder(), ), maxLines: null, onChanged: (value) { _url1 = value; previewUrl = value; }, ), TextButton( child: Text("Fetch"), onPressed:() { setState(() { print(previewUrl); }); }, ) ]), ), ]);
However this does not refresh the preview even though previewURL changes with setState. Any way to achieve this?
Running the latest RC as version.
The text was updated successfully, but these errors were encountered:
Hey,
It's not recommended to use setState() inside the TextField's onChange method. Instead you can use Debouncer() to achieve the refresh.
Debouncer()
However, I have verified the same locally & seems it is refreshing the link preview card. Feel free to open the new issue if the issue persists.
Thanks!
Sorry, something went wrong.
No branches or pull requests
Thank you for the plugin!
Could you possibly let me know if it's possible to change the url in setstate?
When I try to do this absolutely nothing happens when url is changed and setstate launched.
What I got as an example:
However this does not refresh the preview even though previewURL changes with setState. Any way to achieve this?
Running the latest RC as version.
The text was updated successfully, but these errors were encountered: