fartstack/frontend/lib/main.dart

46 lines
1.1 KiB
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:frontend/features/room/join_room.dart';
import 'package:go_router/go_router.dart';
import 'package:shared_models/fart_logger.dart';
import 'features/room/game_room.dart';
void main() {
// determine if flutter app is dev or prod env
FartLogger.listen(isDevelopment: kDebugMode);
runApp(ProviderScope(child: const MyApp()));
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
final router = buildAppRouter();
return MaterialApp.router(
title: 'FartStack Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
routerConfig: router,
);
}
}
GoRouter buildAppRouter() {
return GoRouter(routes: [
GoRoute(path: '/', builder: (ctx, state) => JoinRoomHome()),
GoRoute(
path: '/room/:roomUuid',
builder: (ctx, state) => GameRoomHome(
roomUuid: state.pathParameters['roomUuid'],
),
),
]);
}