import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:namer_app/list.dart'; import 'package:namer_app/login.dart'; void main() { runApp(MyApp()); } final _router = GoRouter( routes: [ GoRoute(path: '/', builder: (context, state) => MyHomePage(), //), routes: [ GoRoute( path: 'login', builder: (context, state) => LoginPage(), ), GoRoute( path: 'list', builder: (context, state) => ListPage(), ), ]), ], ); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp.router( title: 'TelNow Lat', theme: ThemeData( useMaterial3: true, colorScheme: ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 0, 255, 255)), ), routerConfig: _router, ); } } class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Theme.of(context).colorScheme.primaryContainer, body: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Lang(), Expanded( child: Center( child: Text( 'TelNow', style: TextStyle(color: Colors.orange, fontSize: 48), )), ), Padding( padding: const EdgeInsets.only(left: 120, right: 120), child: Text( 'Silakan pindai QR terlebih dulu untuk mulai menggunakan aplikasi.', softWrap: true, textAlign: TextAlign.center, ), ), Expanded( child: Center(child: Pindai()), ), Text('Kebijakan Privasi'), Text('Versi 4.0.0.0'), Container( color: Theme.of(context).colorScheme.primaryContainer, ) ], ), ); } } class Lang extends StatefulWidget { const Lang({ Key? key, }) : super(key: key); @override State createState() => _LangState(); } class _LangState extends State { var selectedIndex = 0; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(8.0), child: Row( children: [ Expanded(child: Container()), ElevatedButton( onPressed: () { print('EN'); }, style: ButtonStyle( foregroundColor: MaterialStateProperty.all(Colors.white), backgroundColor: MaterialStateProperty.all(Colors.white70), shape: MaterialStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(20), bottomLeft: Radius.circular(20)), ))), child: Text('EN'), ), ElevatedButton( onPressed: () { print('ID'); }, style: ButtonStyle( foregroundColor: MaterialStateProperty.all(Colors.white), backgroundColor: MaterialStateProperty.all(Colors.red), shape: MaterialStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.only( topRight: Radius.circular(20), bottomRight: Radius.circular(20)), side: BorderSide(color: Colors.red), ))), child: Text('ID')) ], ), ); } } class Pindai extends StatelessWidget { const Pindai({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return Expanded( child: Center( child: ElevatedButton( onPressed: () => context.go('/login'), style: ButtonStyle( padding: MaterialStateProperty.all(EdgeInsets.all(50)), foregroundColor: MaterialStateProperty.all(Colors.black), shape: MaterialStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(18.0), ))), child: Text('Pindai QR'), )), ); } }