“Flutter Appbar Backbutton удалить” Ответ

Flutter Appbar Backbutton удалить

appBar: AppBar(
	title: Text('AppBar'),
    automaticallyImplyLeading: false, // remove back button in appbar.
   )
Sore Serval

Flutter Удалить кнопку назад на Appbar

//add to the appBAr:
automaticallyImplyLeading: false,
Gorgeous Gerbil

Удалить кнопку назад в Appbar в 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(),
      },
    );
  }
}
Eager Emu

Flutter Appbar Backbutton удалить

// with WillPopScope you can make that the phone back-button do not work
return: WillPopScope(
  onWillPop: () async {
      // here we say the user can't go back
      return false;
  },
  child:  Scaffold(
    appBar: AppBar(
      ...
      // here we remove the back button from the appbar 
      automaticallyImplyLeading: false,
    ),
  ),
);
Pipa Fria

Ответы похожие на “Flutter Appbar Backbutton удалить”

Вопросы похожие на “Flutter Appbar Backbutton удалить”

Больше похожих ответов на “Flutter Appbar Backbutton удалить” по Dart

Смотреть популярные ответы по языку

Смотреть другие языки программирования