Created
September 24, 2020 04:34
-
-
Save kennedisimbolo/450c5b7110fe869d8bb50132021d2232 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(new MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: new Halutama(), | |
title: 'Navigasi', | |
//Atur route | |
routes: <String, WidgetBuilder>{ | |
'/Halutama': (BuildContext context) => new Halutama(), | |
'/Haldua': (BuildContext context) => new Haldua(), | |
}, | |
)); | |
} | |
class Halutama extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: AppBar( | |
leading: IconButton( | |
color: Colors.white, | |
icon: Icon(IconData(59530, fontFamily: 'MaterialIcons')), | |
onPressed: null, | |
), | |
title: Text('Halaman Utama'), | |
backgroundColor: Colors.yellow, | |
), | |
body: new Center( | |
child: new Container( | |
child: new IconButton( | |
icon: Icon(Icons.category, size: 30.00, color: Colors.red), | |
onPressed: () { | |
Navigator.pushNamed(context, '/Haldua'); | |
}, | |
), | |
), | |
), | |
); | |
} | |
} | |
class Haldua extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: AppBar( | |
title: Text('Halaman Kedua'), | |
backgroundColor: Colors.green, | |
), | |
body: new Center( | |
child: new Container( | |
child: new IconButton( | |
icon: Icon(Icons.movie, size: 40.0, color: Colors.blue), | |
onPressed: () { | |
Navigator.pushNamed(context, '/Halutama'); | |
}, | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment