0

当我点击FloatingActionButton. 你能帮我吗?当我按下物理设备上的按钮时,我的程序停止,我必须从调试工具中恢复它。这是我的代码:

class _MyHomePageState extends State<MyHomePage> {
  
  @override
  Widget build(BuildContext context) {
    final mediaQuery = MediaQuery.of(context);
    final appbar = appbarBuilder();

    return Scaffold(
      appBar: appbar,
      body: body,
      floatingActionButton: FloatingActionButton(
        backgroundColor: Colors.blue,
        onPressed: () async {
          const url = 'https://www.google.gr/?hl=el';
          if (await canLaunch(url)) {
            await launch(url);
          } else {
            throw 'Could not launch $url';
          }
        },
        child: Image.asset(
          'assets/instagram.png',
          color: Colors.black,
        ),
      ),
    );
  }
}

4

1 回答 1

0

You should restore your emulator..I have face this problem ,i just restore this emeulator

于 2021-07-10T12:10:55.847 回答