I´m new in flutter and i´m trying to create a navigation to another page called Registro();
I'm trying with this solutionthat i found in a post here in stackoverflow.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(home: Login());
}
}
class Login extends StatelessWidget {
const Login({Key? key}) : super(key: key);
static const String _title = 'Sample App';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const MyStatefulWidget(),
bottomNavigationBar: BottomAppBar(
elevation: 3,
child: Row(
children: <Widget>[
const Text('¿No tienes una cuenta?'),
TextButton(
child: const Text(
'Registrate',
style: TextStyle(fontSize: 20),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => new Registro()),
);
},
)
],
mainAxisAlignment: MainAxisAlignment.center,
),
),
),
);
}
}
Also i tried this solution -> and doesnt works :c
Navigator operation requested with a context that does not include a Navigator