我正在尝试对抽屉按钮进行操作,但它不起作用。
我做了所有的抽屉,当要在按钮上进行操作时,它根本不起作用。 此操作的一个示例是,当我单击时需要打开密码更改页面。
我看到了一些例子,但我做对了!
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AlterarSenhaScreen(),
),
);
}),
class ComandaClienteScreen extends StatefulWidget {
@override
_ComandaClienteScreenState createState() => _ComandaClienteScreenState();
}
class _ComandaClienteScreenState extends State<ComandaClienteScreen> {
Empresa empresa;
@override
void initState() {
super.initState();
}
Future<List<ComandaAbertaCliente>> _getListaComandaAbertaCliente() async {
String cid_filial = await Util().getPrefString(Util.CID_FILIAL_KEY);
return await UsuarioService()
.getComandasAbertaCliente(empresa.nid_empresa, cid_filial);
}
Future<Empresa> _getEmpresa() async {
String empresaPref = await Util().getPrefString(Util.EMPRESA_KEY);
empresa = Empresa.fromJson(json.decode(empresaPref));
return empresa;
}
Future<String> _getNomeEmpresa() async {
String empresaNomePref = await Util().getPrefString(Util.EMPRESA_NOME_KEY);
return empresaNomePref;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Comanda Clientes")
),
// menuno
drawer: new Drawer(
child: new ListView(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: new Text("Sicap mobile"),
accountEmail: new Text(""),
decoration: new BoxDecoration(
image: new DecorationImage(
image: new ExactAssetImage('assets/images/fundoazul.png'),
fit: BoxFit.cover,
),
),
currentAccountPicture: CircleAvatar(
backgroundImage: NetworkImage(
'https://img.icons8.com/office/420/circled-user-male-skin-type-6.png')),
),
//botõesdenavegação
新的ListTile(
开头:Icon(Icons.vpn_key),
标题:new Text(“ Alterar Senha”),
onTap :(){
Navigator.push(
上下文
MaterialPageRoute(
生成器:(上下文)=> AlterarSenhaScreen(),
),
);
}),
新的Divider(),
新的ListTile(
领先:Icon(Icons.info),
标题:new Text(“ About”),
onTap :(){
Navigator.pop(上下文);
}),
新的ListTile(
前导:图标(Icons.power_settings_new),
标题:new Text(“ Logout”),
onTap :(){
Navigator.pop(上下文);
}),
],enter code here
),
),
);
}
}