Answers for "how to remove the default back icon in appbar widget in flutter"

1

remove back button in appbar in flutter

import 'package:flutter/material.dart';

class LogoutPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("Logout Page"),
      ),
      body: new Center(
        child: new Text('You have been logged out'),
      ),
    );
  }

}
class MyHomePage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("Remove Back Button"),
      ),
      floatingActionButton: new FloatingActionButton(
        child: new Icon(Icons.fullscreen_exit),
        onPressed: () {
          Navigator.pushReplacementNamed(context, "/logout");
        },
      ),
    );
  }
}

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      home: new MyHomePage(),
      routes: {
        "/logout": (_) => new LogoutPage(),
      },
    );
  }
}
Posted by: Guest on January-30-2021
0

flutter change appbar back icon

appBar: AppBar(
        leading: IconButton(
          onPressed: () {
            Navigator.pop(context);
          },
          icon: Icon(Icons.home_outlined),
        ),
        title: Text(
          "Second Page",
          style: TextStyle(color: Colors.black),
        ),
      ),
Posted by: Guest on October-20-2021
0

flutter change appbar back icon

appBar: AppBar(
          backgroundColor: Colors.white,
          title: Text("Second Page", style: TextStyle(color: Colors.black))),
Posted by: Guest on October-20-2021

Code answers related to "how to remove the default back icon in appbar widget in flutter"

Browse Popular Code Answers by Language