123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- import 'package:flutter/material.dart';
- import 'package:go_router/go_router.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) => const Login(),)
- ]
- ),
- ],
- );
- 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)),
- ),
- // home: MyHomePage(),
- 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<Lang> createState() => _LangState();
- }
- class _LangState extends State<Lang> {
- 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<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'))
- ],
- ),
- );
- }
- }
- // class Judul extends StatelessWidget {
- // const Judul({
- // Key? key,
- // }) : super(key: key);
- // @override
- // Widget build(BuildContext context) {
- // var theme = Theme.of(context);
- // var style = theme.textTheme.displayMedium!.copyWith(
- // color: Colors.orange,
- // );
- // return Column(
- // children: [
- // Text('TelNow', style: style),
- // ],
- // );
- // }
- // }
- 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>(EdgeInsets.all(50)),
- foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
- shape: MaterialStateProperty.all<RoundedRectangleBorder>(
- RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(18.0),
- )
- )
- ),
- child: Text('Pindai QR'),)
- ),
- );
- }
- }
- // class Footer extends StatelessWidget {
- // const Footer({
- // Key? key,
- // }) : super(key: key);
- // @override
- // Widget build(BuildContext context) {
- // return Column(
- // children: [
- // Text('Kebijakan Privasi'),
- // Text('Versi 4.0.0.0'),
- // ],
- // );
- // }
- // }
- // 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'),
- // ),
- // ],
- // ),
- // ),
- // );
- // }
- // }
|