在升级到dart 2.2.1时,在图标按钮和凸起按钮中不起作用

时间:2019-04-25 04:32:15

标签: android dart flutter

如果我按下按钮并在flutter中打开一个空白页面,该页面将位于同一页面中,但是按下时不起作用

Widget _cameraDisable(){

    return Container(
      alignment: Alignment.bottomRight,
      margin: new EdgeInsets.fromLTRB(0, 0, 0, 30),
      child: Visibility(
        visible: cameraviewVisbility,
        child: RawMaterialButton(
            onPressed: () {
              _videoOffPage();
              setState(() => pressAttention = !pressAttention);
            },
          child: new Icon(IconData(0xe800, fontFamily: '_kFontFamiiiiiii',
          ),
            color: Theme.Colors.bluecolor,


          ),
          shape: new CircleBorder(),
          elevation: 2.0,
          fillColor: pressAttention ? Colors.transparent: Colors.white54,
          padding: const EdgeInsets.all(15.0),
        ),
      ),
    );
  }

 void _videoOffPage(){

    setState(() {
      Scaffold(
        body: new Center(
          child: Column(
            children: <Widget>[
              Container(
                alignment: Alignment.center,
                color: Colors.white,
                child: Image(image: new AssetImage('assets/img/videologo.png')
                ),
              ),
            ],
          ),
        ),
      );
    });

  }

1 个答案:

答案 0 :(得分:0)

要在按钮上打开页面,请按如下所示尝试

仅在首页上

 void _videoOffPage(){
Navigator.push(context, MaterialPageRoute(builder: (context) => secondPage()));}


 class secondPage extends StatefulWidget {
  @override
  _secondPageState createState() => _secondPageState();
}

class _secondPageState extends State<secondPage> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return  Scaffold(
      body: new Center(
        child: Column(
          children: <Widget>[
            Container(
              alignment: Alignment.center,
              color: Colors.white,
              child: Image(image: new AssetImage('assets/img/videologo.png')
              ),
            ),
          ],
        ),
      ),
    );
  }
}