Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() {
- runApp(MainApp());
- }
- class MainApp extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- debugShowCheckedModeBanner: false,
- home: HalamanPertama(),
- );
- }
- }
- class HalamanPertama extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text('Halaman Satu'),
- ),
- body: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- 'INI HALAMAN 1',
- style: TextStyle(
- fontSize: 20,
- fontWeight: FontWeight.bold,
- color: Colors.blue,
- ),
- ),
- SizedBox(height: 35),
- ElevatedButton(
- onPressed: () {
- //logic ketika tombol di tekan
- Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => HalamanKedua()),
- );
- },
- child: Text('Pindah Halaman'),
- ),
- ],
- ),
- ),
- );
- }
- }
- class HalamanKedua extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text('Halaman Dua'),
- ),
- body: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- 'INI HALAMAN 2',
- style: TextStyle(
- fontSize: 20,
- fontWeight: FontWeight.bold,
- color: Colors.orange,
- ),
- ),
- SizedBox(height: 35),
- ElevatedButton(
- onPressed: () {
- //logic ketika tombol di tekan
- Navigator.pop(context);
- },
- child: Text('Kembali'),
- ),
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement