Some updates
Signed-off-by: Nikolai Rodionov <nrodionov@eos-uptrade.de>
This commit is contained in:
33
lib/api/third_party/chartmuseum.dart
vendored
33
lib/api/third_party/chartmuseum.dart
vendored
@@ -1,33 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class HelmChart {
|
||||
final String name;
|
||||
final String version;
|
||||
|
||||
const HelmChart({
|
||||
required this.name,
|
||||
required this.version,
|
||||
});
|
||||
}
|
||||
|
||||
Future<List<HelmChart>> fetchCharts() async {
|
||||
final dio = Dio();
|
||||
final response = await dio.get('https://helm.badhouseplants.net/api/charts',
|
||||
options: Options(headers: {
|
||||
"Accept": "application/json",
|
||||
}));
|
||||
if (response.statusCode == 200) {
|
||||
final Map<dynamic, dynamic> charsRaw = json.decode(response.data);
|
||||
|
||||
List<HelmChart> charts = [];
|
||||
charsRaw.forEach((key, value) {
|
||||
charts.add(HelmChart(name: key, version: value.first["version"]));
|
||||
});
|
||||
return charts;
|
||||
} else {
|
||||
throw Exception('Failed to load album');
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'dart:html';
|
||||
import 'package:web/web.dart' as web;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grpc/grpc_web.dart';
|
||||
@@ -39,8 +39,8 @@ class _LoginFormState extends State<LoginForm> {
|
||||
final password = passwordCtrl.text;
|
||||
final email = emailCtrl.text;
|
||||
accountsGrpc.signUp(username, email, password).then((rs) {
|
||||
window.localStorage["token"] = rs.token;
|
||||
window.localStorage["uuid"] = rs.uuid;
|
||||
web.window.localStorage.setItem("token", rs.token);
|
||||
web.window.localStorage.setItem("uuid", rs.uuid);
|
||||
widget.notifyParent();
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
}).catchError((e) {
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
// This project is not supposed to be cross-platform,
|
||||
// so we don't care about this warning
|
||||
// ignore: avoid_web_libraries_in_flutter
|
||||
import 'dart:html';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:softplayer_web/api/grpc/accounts.dart';
|
||||
import 'package:softplayer_web/components/sign_in_form.dart';
|
||||
import 'package:softplayer_web/components/sign_up_form.dart';
|
||||
|
||||
class MenuPanel extends StatefulWidget implements PreferredSizeWidget {
|
||||
final TabName tab;
|
||||
final AccountsGrpc accountsGrpc;
|
||||
const MenuPanel({
|
||||
super.key,
|
||||
required this.tab,
|
||||
required this.accountsGrpc,
|
||||
}) : preferredSize = const Size.fromHeight(kToolbarHeight);
|
||||
@override
|
||||
final Size preferredSize;
|
||||
@override
|
||||
State<StatefulWidget> createState() => _MenuPanel();
|
||||
}
|
||||
|
||||
enum TabName { home, catalog, about }
|
||||
|
||||
class _MenuPanel extends State<MenuPanel> {
|
||||
bool isSignedIn() {
|
||||
return window.localStorage.containsKey("token");
|
||||
}
|
||||
|
||||
List<Widget> accountActions() {
|
||||
if (isSignedIn()) {
|
||||
return [
|
||||
IconButton(
|
||||
onPressed: () => print("acc"),
|
||||
icon: const Icon(Icons.account_circle))
|
||||
];
|
||||
} else {
|
||||
return <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => SignInForm(
|
||||
accountsGrpc: widget.accountsGrpc,
|
||||
));
|
||||
},
|
||||
child: const Text("sign in")),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => SignUpForm(
|
||||
accountsGrpc: widget.accountsGrpc,
|
||||
));
|
||||
},
|
||||
child: const Text("sign up")),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
PreferredSizeWidget build(BuildContext context) {
|
||||
return AppBar(
|
||||
title: Row(children: [
|
||||
TextButton(
|
||||
child: const Text("Softplayer"),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, "/");
|
||||
}),
|
||||
]),
|
||||
backgroundColor: const Color.fromRGBO(46, 51, 78, 1.0),
|
||||
automaticallyImplyLeading: false,
|
||||
actions: accountActions(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:html';
|
||||
|
||||
import 'package:web/web.dart' as web;
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grpc/grpc_web.dart';
|
||||
@@ -51,7 +50,7 @@ class _StateRootWidget extends State<RootWidget> {
|
||||
}
|
||||
|
||||
bool isSignedIn() {
|
||||
return window.localStorage.containsKey("token");
|
||||
return web.window.localStorage.getItem("token") != null;
|
||||
}
|
||||
|
||||
final GlobalKey<ScaffoldState> _key = GlobalKey(); // Create a key
|
||||
|
||||
@@ -349,12 +349,12 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "046d3928e16fa4dc46e8350415661755ab759d9fc97fc21b5ab295f71e4f0499"
|
||||
sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "15.1.0"
|
||||
version: "15.2.0"
|
||||
web:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: web
|
||||
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies:
|
||||
http: ^1.6.0
|
||||
dio: ^5.9.2
|
||||
flutter_dotenv: ^6.0.1
|
||||
|
||||
web: ^1.1.1
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"dependencyDashboard": true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user