Redirect via button to website - Flutter

Asked

Viewed 463 times

0

You can redirect the user after clicking a button to a website, directly opening the browser or even a webview. From onPressed.

            Container(
             alignment: Alignment.center,
             child: FlatButton(
              onPressed: () => print('Forgot Password Button Pressed'),
              padding: EdgeInsets.only(right: 0.0),
                child: Text(
                  'Precisa de ajuda?',
                  style:TextStyle(
                  color: Colors.white.withOpacity(0.6),
                  fontSize: 15,
                  ),
                ),
              ),
            ), 

1 answer

0


You can use the URL Launcher to open the URL’s and other applications:

FlatButton(
   onPressed: openURL
)

void openURL(){
  const url = 'https://answall.com';
  if (await canLaunch(url)) {
    await launch(url);
  } else {
    /// Não è possível abrir a URL
  }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.