在按下时升级到飞镖2.2.1不能在图标按钮和凸起按钮中工作

问题描述 投票:0回答:1

如果我按下一个按钮并打开一个空页面,它将位于同一页面但是按下的按钮不起作用

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')
                ),
              ),
            ],
          ),
        ),
      );
    });

  }
android dart flutter
1个回答
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')
              ),
            ),
          ],
        ),
      ),
    );
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.