Flutter-导航栏

import 'package:flutter/material.dart';

void main() {

runApp(MaterialApp(

title:'Navigate',

home: FirstVC(),

));

}

class FirstVC extends StatelessWidget {

@override

  Widget build(BuildContext context) {

return Scaffold(

appBar: AppBar(title: Text('Navigate')),

body: Center(

child: RaisedButton(onPressed: () {

Navigator.push(context, MaterialPageRoute(builder: (context) => SecondVC()));

},child: Text('Btn'),),

),

);

}

}

class SecondVC extends StatelessWidget {

@override

  Widget build(BuildContext context) {

// TODO: implement build

    return Scaffold(

appBar: AppBar(title: Text('222222')),

body: Center(

child: RaisedButton(onPressed: (){

Navigator.pop(context);

},child: Text('back'),

)

),);

}

}

你可能感兴趣的:(Flutter-导航栏)