Advertisement
yudiwbs

Untitled

Mar 28th, 2024
1,142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.70 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() {
  4.   runApp(const MyApp());
  5. }
  6.  
  7. class MyApp extends StatelessWidget {
  8.   const MyApp({super.key});
  9.  
  10.   // This widget is the root of your application.
  11.   @override
  12.   Widget build(BuildContext context) {
  13.     return MaterialApp(
  14.       title: 'Quiz UI Flutter',
  15.       theme: ThemeData(
  16.         colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
  17.         useMaterial3: true,
  18.       ),
  19.       home: const MyHomePage(title: 'Quiz UI Flutter'),
  20.     );
  21.   }
  22. }
  23.  
  24. class MyHomePage extends StatefulWidget {
  25.   const MyHomePage({super.key, required this.title});
  26.  
  27.   final String title;
  28.  
  29.   @override
  30.   State<MyHomePage> createState() => _MyHomePageState();
  31. }
  32.  
  33. class _MyHomePageState extends State<MyHomePage> {
  34.   @override
  35.   Widget build(BuildContext context) {
  36.     return Scaffold(
  37.       appBar: AppBar(
  38.         backgroundColor: Theme.of(context).colorScheme.inversePrimary,
  39.         title: Text(widget.title),
  40.       ),
  41.       body: Center(
  42.         child: Column(
  43.           mainAxisAlignment: MainAxisAlignment.start,
  44.           children: <Widget>[
  45.             const Text(
  46.               'Nomor Kelompok:  [isi no kelompok]',
  47.             ),
  48.             const Text(
  49.               'Mhs 1:  [isi nim, nama]',
  50.             ),
  51.             const Text(
  52.               'Mhs 2:  [isi nim, nama]',
  53.             ),
  54.             Container(
  55.               margin: const EdgeInsets.all(10),
  56.               child: ElevatedButton(
  57.                 onPressed: () {
  58.                   Navigator.of(context)
  59.                       .push(MaterialPageRoute(builder: (context) {
  60.                     return soalNo1();
  61.                   }));
  62.                 },
  63.                 child: const Text('   Jawaban No 1   '),
  64.               ),
  65.             ),
  66.             Container(
  67.               margin: const EdgeInsets.all(10),
  68.               child: ElevatedButton(
  69.                 onPressed: () {
  70.                   Navigator.of(context)
  71.                       .push(MaterialPageRoute(builder: (context) {
  72.                     return soalNo2();
  73.                   }));
  74.                 },
  75.                 child: const Text('   Jawaban No 2   '),
  76.               ),
  77.             ),
  78.           ],
  79.         ),
  80.       ),
  81.     );
  82.   }
  83.  
  84.   //jaawaban no 1
  85.   Widget soalNo1() {
  86.     return Scaffold(
  87.         appBar: AppBar(
  88.           backgroundColor: Theme.of(context).colorScheme.inversePrimary,
  89.         ),
  90.         body: const Text("ini jawaban no 1"));
  91.   }
  92.  
  93.   //jaawaban no 2
  94.   Widget soalNo2() {
  95.     return Scaffold(
  96.         appBar: AppBar(
  97.           backgroundColor: Theme.of(context).colorScheme.inversePrimary,
  98.         ),
  99.         body: const Text("ini jawaban no 2"));
  100.   }
  101. }
  102.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement