Answers for "flutter android back button black screen"

1

flutter android back button

@override
Widget build(BuildContext context) {
  return WillPopScope(
    onWillPop: () {
      _moveToScreen2(context, );
    },
    child: Scaffold(
      key: _scaffoldKey,
      appBar: AppBar(
        leading: IconButton(
            icon: Icon(Icons.arrow_back),
            onPressed: () {
              _moveToScreen2(context);
            }),
        title: Text("Screen 1"),
      ),
    ),
  );
}

/**
* This is probably too thin to be in its own method - consider using
* `Navigator.pushReplacementNamed(context, "screen2")` directly
*/
void _moveToScreen2(BuildContext context) =>
    Navigator.pushReplacementNamed(context, "screen2");
Posted by: Guest on July-30-2021
0

pop and push shows black screen which needs to be pressed back flutter

Navigator.pop(context);
Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => SecondActivity()),
          );
Posted by: Guest on April-26-2020

Code answers related to "flutter android back button black screen"

Browse Popular Code Answers by Language