import 'dart:async';
import 'package:flutter/material.dart';
+import 'package:collection/src/iterable_extensions.dart';
import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart'
as proxclient;
import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart';
});
}
+// FIXME: copied from pve_flutter_frontend, re-use common set
+class ProxmoxColors {
+ static final Color orange = Color(0xFFE57000);
+ static final Color supportGrey = Color(0xFFABBABA);
+ static final Color supportBlue = Color(0xFF00617F);
+}
+
class ProxmoxLoginForm extends StatefulWidget {
final TextEditingController originController;
final FormFieldValidator<String> originValidator;
const ProxmoxLoginForm({
Key? key,
- /*required*/ required this.originController,
- /*required*/ /*required*/ required this.usernameController,
- /*required*/ required this.passwordController,
- /*required*/ required this.accessDomains,
- /*required*/ required this.originValidator,
+ required this.originController,
+ required this.usernameController,
+ required this.passwordController,
+ required this.accessDomains,
+ required this.originValidator,
this.selectedDomain,
- /*required*/ required this.onDomainChanged,
+ required this.onDomainChanged,
this.onPasswordSubmitted,
this.onOriginSubmitted,
}) : super(key: key);
items: widget.accessDomains!
.map((e) => DropdownMenuItem(
child: ListTile(
- title: Text(e!.realm!),
+ title: Text(e!.realm),
subtitle: Text(e.comment ?? ''),
),
value: e,
.toList(),
onChanged: widget.onDomainChanged,
selectedItemBuilder: (context) =>
- widget.accessDomains!.map((e) => Text(e!.realm!)).toList(),
+ widget.accessDomains!.map((e) => Text(e!.realm)).toList(),
value: widget.selectedDomain,
),
Stack(
@override
Widget build(BuildContext context) {
return Theme(
- data: ThemeData.dark().copyWith(accentColor: Color(0xFFE47225)),
+ //data: ThemeData.dark().copyWith(accentColor: Color(0xFFE47225)),
+ data: ThemeData.dark().copyWith(
+ colorScheme: ColorScheme.dark().copyWith(
+ secondary: ProxmoxColors.orange,
+ onSecondary: ProxmoxColors.supportGrey)),
child: Scaffold(
- backgroundColor: Theme.of(context).primaryColor,
+ backgroundColor: ProxmoxColors.supportBlue,
extendBodyBehindAppBar: true,
appBar: AppBar(
elevation: 0.0,
}
}
: null,
- color: Color(0xFFE47225),
+ color: ProxmoxColors.orange,
disabledColor: Colors.grey,
child: Text('Continue'),
),
}
}
: null,
- color: Color(0xFFE47225),
+ color: ProxmoxColors.orange,
child: Text('Continue'),
disabledColor: Colors.grey,
),
final status = await client.getClusterStatus();
final hostname =
- status.singleWhere((element) => element!.local ?? false)!.name;
+ status.singleWhereOrNull((element) => element.local ?? false)?.name;
var loginStorage = await ProxmoxLoginStorage.fromLocalStorage();
if (widget.isCreate!) {
}
}
- response?.sort((a, b) => a!.realm!.compareTo(b!.realm!));
+ response?.sort((a, b) => a!.realm.compareTo(b!.realm));
final selection = response?.singleWhere(
(e) => e!.realm == widget.userModel?.realm,