athrainsky 2 years ago
parent
commit
67df0eb8cb
2 changed files with 102 additions and 14 deletions
  1. 24 0
      lib/login.dart
  2. 78 14
      lib/main.dart

+ 24 - 0
lib/login.dart

@@ -0,0 +1,24 @@
+import 'package:flutter/material.dart';
+
+class login extends StatelessWidget {
+  /// Constructs a [DetailsScreen]
+  const login({Key? key}) : super(key: key);
+
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      appBar: AppBar(title: const Text('Details Screen')),
+      body: Center(
+        child: Column(
+          mainAxisAlignment: MainAxisAlignment.center,
+          children: <ElevatedButton>[
+            ElevatedButton(
+              onPressed: () {print('x');},
+              child: const Text('Go back to the Home screen'),
+            ),
+          ],
+        ),
+      ),
+    );
+  }
+}

+ 78 - 14
lib/main.dart

@@ -5,19 +5,35 @@ void main() {
   runApp(MyApp());
 }
 
+final _router = GoRouter(
+  routes: [
+    GoRoute(
+      path: '/',
+      builder: (context, state) => MyHomePage(),
+      // routes: [
+      //   GoRoute(
+      //     path: '/login',
+      //     builder: (context, state) => Placeholder(),)
+      // ]
+    ),
+  ],
+);
+
 class MyApp extends StatelessWidget {
   const MyApp({super.key});
 
   @override
   Widget build(BuildContext context) {
-    return MaterialApp(
+    return MaterialApp.router(
         title: 'TelNow Lat',
         theme: ThemeData(
           useMaterial3: true,
           colorScheme: ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 0, 255, 255)),
         ),
-        home: MyHomePage(),
+        // home: MyHomePage(),
+        routerConfig: _router,
     );
+    
   }
 }
 
@@ -81,11 +97,33 @@ var selectedIndex = 0;
         children: [
           Expanded(child: Container()),
           ElevatedButton
-            (onPressed: (){print('EN');}, 
+            (onPressed: (){print('EN');},
+              style: ButtonStyle(
+                foregroundColor: MaterialStateProperty.all<Color>(Colors.white),
+                backgroundColor: MaterialStateProperty.all<Color>(Colors.white70),
+                shape: MaterialStateProperty.all<RoundedRectangleBorder>(
+                  RoundedRectangleBorder(
+                    borderRadius: BorderRadius.only(topLeft: Radius.circular(20), bottomLeft: Radius.circular(20)),
+                    //side: BorderSide(color: Colors.red),
+                    
+                  )
+                )
+              ), 
               child: Text('EN'),
           ),
           ElevatedButton
             (onPressed: (){print('ID');}, 
+              style: ButtonStyle(
+                  foregroundColor: MaterialStateProperty.all<Color>(Colors.white),
+                  backgroundColor: MaterialStateProperty.all<Color>(Colors.red),
+                  shape: MaterialStateProperty.all<RoundedRectangleBorder>(
+                    RoundedRectangleBorder(
+                      borderRadius: BorderRadius.only(topRight: Radius.circular(20), bottomRight: Radius.circular(20)),
+                      side: BorderSide(color: Colors.red),
+                      
+                    )
+                  )
+                ),
               child: Text('ID'))
         ],        
       ),
@@ -120,17 +158,22 @@ class Pindai extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
-    return Card(
-      child: Padding(
-        padding: const EdgeInsets.all(20),      
-        child: TextButton(
-          onPressed: () {
-            print('QR pressed!');
-          }, 
-          child: Text('Pindai QR'),
-          ),
-      ),
-    );
+    return Expanded(
+            child: Center(
+              child: ElevatedButton(
+                onPressed: () => context.go('/login'),
+                style: ButtonStyle(
+                  padding: MaterialStateProperty.all<EdgeInsets>(EdgeInsets.all(50)),
+                  foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
+                  shape: MaterialStateProperty.all<RoundedRectangleBorder>(
+                    RoundedRectangleBorder(
+                      borderRadius: BorderRadius.circular(18.0),
+                    )
+                  )
+                ),
+                child: Text('Pindai QR'),)
+            ),
+          );
   }
 }
 
@@ -150,4 +193,25 @@ class Pindai extends StatelessWidget {
 //   }
 // }
 
+class login extends StatelessWidget {
+  /// Constructs a [DetailsScreen]
+  const login({Key? key}) : super(key: key);
 
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      appBar: AppBar(title: const Text('Details Screen')),
+      body: Center(
+        child: Column(
+          mainAxisAlignment: MainAxisAlignment.center,
+          children: <ElevatedButton>[
+            ElevatedButton(
+              onPressed: () {print('x');},
+              child: const Text('Go back to the Home screen'),
+            ),
+          ],
+        ),
+      ),
+    );
+  }
+}