get 1.0.2 get: ^1.0.2 copied to clipboard
A consistent Flutter route navigation library that does not rebuild materialApp with each navigation..
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(MaterialApp(
title: 'Navigation Basics',
home: FirstRoute(),
));
}
class FirstRoute extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('First Route'),
),
body: Center(
child: RaisedButton(
child: Text('Open route'),
onPressed: () {
Get.to(context, SecondRoute());
},
),
),
);
}
}
class SecondRoute extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Second Route"),
),
body: Center(
child: RaisedButton(
onPressed: () {
Get.back(context);
},
child: Text('Go back!'),
),
),
);
}
}