72 lines
1.4 KiB
Dart
72 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp.router(
|
|
title: 'GoodGo Client',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
|
|
useMaterial3: true,
|
|
),
|
|
routerConfig: _router,
|
|
);
|
|
}
|
|
}
|
|
|
|
final GoRouter _router = GoRouter(
|
|
routes: <RouteBase>[
|
|
GoRoute(
|
|
path: '/',
|
|
builder: (BuildContext context, GoRouterState state) {
|
|
return const HomeScreen();
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/login',
|
|
builder: (BuildContext context, GoRouterState state) {
|
|
return const LoginScreen();
|
|
},
|
|
),
|
|
],
|
|
);
|
|
|
|
class HomeScreen extends StatelessWidget {
|
|
const HomeScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('GoodGo Client'),
|
|
),
|
|
body: const Center(
|
|
child: Text('Welcome to GoodGo Client'),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class LoginScreen extends StatelessWidget {
|
|
const LoginScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Login'),
|
|
),
|
|
body: const Center(
|
|
child: Text('Login Screen'),
|
|
),
|
|
);
|
|
}
|
|
}
|