Signup and signing are ready

This commit is contained in:
2024-04-05 17:14:56 +02:00
parent d47336e34e
commit 45a52d5410
5 changed files with 259 additions and 121 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:grpc/grpc_web.dart';
import 'package:softplayer_web/api/grpc/accounts.dart';
import 'package:softplayer_web/components/menubar.dart';
import 'package:softplayer_web/helpers/page_wrapper.dart';
import 'package:softplayer_web/pages/about.dart';
@@ -9,7 +10,7 @@ import 'package:softplayer_web/pages/home.dart';
void main() async {
const String backendURL = String.fromEnvironment(
'SOFTPLAYER_BACKEND_URL',
defaultValue: 'http://softplayer.badhouseplants.net:8080',
defaultValue: 'https://softplayer-backend.badhouseplants.net:8080',
);
GrpcWebClientChannel grpcChannel =
GrpcWebClientChannel.xhr(Uri.parse(backendURL));
@@ -18,28 +19,36 @@ void main() async {
}
class MyApp extends StatelessWidget {
const MyApp({super.key, required this.channel});
// A channel that should be used to fire grpc calls
MyApp({super.key, required this.channel});
final GrpcWebClientChannel channel;
late final AccountsGrpc accountsGrpc = AccountsGrpc(channel: channel);
@override
Widget build(BuildContext context) {
accountsGrpc.init();
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Softplayer',
routes: {
'/': (context) => const PageWrapper(
appBar: MenuPanel(tab: TabName.home),
child: HomePage(),
'/': (context) => PageWrapper(
appBar: MenuPanel(
tab: TabName.home,
accountsGrpc: accountsGrpc,
),
child: const HomePage(),
),
'/catalog': (context) => const PageWrapper(
appBar: MenuPanel(tab: TabName.catalog),
child: CatalogPage(),
'/catalog': (context) => PageWrapper(
appBar: MenuPanel(
tab: TabName.catalog,
accountsGrpc: accountsGrpc,
),
child: const CatalogPage(),
),
'/about': (context) => const PageWrapper(
appBar: MenuPanel(tab: TabName.about),
child: AboutPage(),
'/about': (context) => PageWrapper(
appBar: MenuPanel(
tab: TabName.about,
accountsGrpc: accountsGrpc,
),
child: const AboutPage(),
)
},
theme: ThemeData(