WIP: something is going on

This commit is contained in:
2024-04-04 16:35:33 +02:00
parent 3cc8edfc8c
commit 8e91619b47
7 changed files with 143 additions and 70 deletions

View File

@@ -1,54 +1,42 @@
import 'package:flutter/material.dart';
import 'package:grpc/grpc_web.dart';
import 'package:softplayer_web/components/menubar.dart';
import 'package:softplayer_web/helpers/page_wrapper.dart';
import 'package:softplayer_web/pages/about.dart';
import 'package:softplayer_web/pages/catalog.dart';
import 'package:softplayer_web/pages/home.dart';
// import 'package:grpc/grpc.dart';
// import 'package:softplayer_dart_proto/accounts/accounts_v1.pb.dart';
// import 'package:softplayer_dart_proto/main.dart';
// import 'package:grpc/grpc_web.dart';
void main() async {
// GrpcWebClientChannel channel = GrpcWebClientChannel.xhr(Uri.parse('http://softplayer.badhouseplants.net:80'));
// final stub = AccountsClient(channel);
// final accWithPassword = AccountWithPassword(
// data: AccountData(
// name: "test",
// email: "test@test.test",
// ),
// accountPassword: AccountPassword(password: "test"),
// );
//
// try {
// final response = await stub.signUp(
// accWithPassword,
// );
// print('Greeter client received: ${response}');
// } catch (e) {
// print('Caught error: $e');
// }
runApp(const MyApp());
const String backendURL = String.fromEnvironment(
'SOFTPLAYER_BACKEND_URL',
defaultValue: 'http://softplayer.badhouseplants.net:8080',
);
GrpcWebClientChannel grpcChannel = GrpcWebClientChannel.xhr(Uri.parse(backendURL));
runApp(MyApp(channel: grpcChannel));
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
const MyApp({super.key, required this.channel});
// A channel that should be used to fire grpc calls
final GrpcWebClientChannel channel;
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
title: 'Softplayer',
routes: {
'/': (context) => const HomePage(),
'/catalog': (context) => const CatalogPage(),
'/about': (context) => const AboutPage(),
'/': (context) => PageWrapper(
child: HomePage(),
appBar: MenuPanel(tab: TabName.home),
),
},
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
//home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}