Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Muhammad Fauzul Ashari
- // 41520010223
- // 24/06/22
- import 'package:flutter/material.dart';
- void main() {
- runApp(
- const MaterialApp(
- home: Page1(),
- ),
- );
- }
- class Page1 extends StatefulWidget {
- const Page1({Key? key}) : super(key: key);
- _FormState createState() => _FormState();
- }
- class _FormState extends State<Page1> {
- final inputPage1 = TextEditingController();
- final nim1 = TextEditingController();
- getItemAndNavigate(BuildContext context) {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) =>
- Page2(inputPage2: inputPage1.text, nim2: nim1.text)),
- );
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: const Text('UAS'),
- ),
- body: Center(
- child: Column(
- children: [
- Image.network(
- 'https://www.mercubuana.ac.id/img/logo_baru_umb.jpg',
- width: 300,
- height: 300,
- ),
- Padding(
- padding: const EdgeInsets.all(20.0),
- child: TextField(
- decoration: const InputDecoration(
- hintText: 'Nama Lengkap?',
- prefixIcon: Icon(Icons.people),
- labelText: 'Nama Lengkap'),
- controller: inputPage1,
- ),
- ),
- Padding(
- padding: const EdgeInsets.all(20.0),
- child: TextField(
- decoration: const InputDecoration(
- hintText: 'NIM?',
- prefixIcon: Icon(Icons.lock),
- labelText: 'NIM'),
- controller: nim1, // Controller buat nyimpen text.
- ),
- ),
- ElevatedButton(
- onPressed: () => getItemAndNavigate(context),
- child: const Padding(
- padding: EdgeInsets.fromLTRB(120.0, 10.0, 120.0, 10.0),
- child: Text('Masuk'),
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
- class Page2 extends StatelessWidget {
- final inputPage2;
- final nim2;
- const Page2({Key? key, @required this.inputPage2, this.nim2})
- : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- backgroundColor: Colors.amber,
- title: Text('Konfirmasi'),
- ),
- body: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- // mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Padding(
- padding: EdgeInsets.only(left: 8.0, top: 10.0),
- child: Text(
- 'Nama Lengkap',
- style: TextStyle(fontSize: 10.0),
- ),
- ),
- Padding(
- padding: const EdgeInsets.only(left: 8.0),
- child: Text(
- '$inputPage2',
- style: TextStyle(fontSize: 18.0),
- ),
- ),
- const Padding(
- padding: EdgeInsets.only(left: 8.0, top: 10.0),
- child: Text(
- 'NIM',
- style: TextStyle(fontSize: 10.0),
- ),
- ),
- Padding(
- padding: const EdgeInsets.only(left: 8.0),
- child: Text(
- '$nim2',
- style: TextStyle(fontSize: 18.0),
- ),
- )
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment