Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- title: Text('Settings'),
+ title: const Text('Settings'),
),
body: FutureBuilder<ProxmoxGeneralSettingsModel>(
future: _settings,
child: Column(
children: [
SwitchListTile(
- title: Text('Validate SSL connections'),
- subtitle: Text('e.g. validates certificates'),
+ title: const Text('Validate SSL connections'),
+ subtitle: const Text('e.g. validates certificates'),
value: settings.sslValidation!,
onChanged: (value) async {
await settings
);
}
- return Center(
+ return const Center(
child: CircularProgressIndicator(),
);
}),
// 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);
+ static const Color orange = Color(0xFFE57000);
+ static const Color supportGrey = Color(0xFFABBABA);
+ static const Color supportBlue = Color(0xFF00617F);
}
class ProxmoxLoginForm extends StatefulWidget {
Widget build(BuildContext context) {
if (widget.accessDomains == null) {
return TextFormField(
- decoration: InputDecoration(
+ decoration: const InputDecoration(
icon: Icon(Icons.vpn_lock),
labelText: 'Origin',
hintText: 'e.g. 192.168.1.2',
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextFormField(
- decoration: InputDecoration(
+ decoration: const InputDecoration(
icon: Icon(Icons.vpn_lock),
labelText: 'Origin',
),
enabled: false,
),
TextFormField(
- decoration: InputDecoration(
+ decoration: const InputDecoration(
icon: Icon(Icons.person),
labelText: 'Username',
),
autofillHints: [AutofillHints.username],
),
DropdownButtonFormField(
- decoration: InputDecoration(icon: Icon(Icons.domain)),
+ decoration: const InputDecoration(icon: Icon(Icons.domain)),
items: widget.accessDomains!
.map((e) => DropdownMenuItem(
child: ListTile(
Stack(
children: [
TextFormField(
- decoration: InputDecoration(
+ decoration: const InputDecoration(
icon: Icon(Icons.lock),
labelText: 'Password',
),
Align(
alignment: Alignment.bottomRight,
child: IconButton(
- constraints: BoxConstraints.tight(Size(58, 58)),
+ constraints: BoxConstraints.tight(const Size(58, 58)),
iconSize: 24,
icon:
Icon(_obscure ? Icons.visibility : Icons.visibility_off),
disabledBackgroundColor: Colors.grey,
),
),
- colorScheme: ColorScheme.dark().copyWith(
+ colorScheme: const ColorScheme.dark().copyWith(
primary: ProxmoxColors.orange,
secondary: ProxmoxColors.orange,
onSecondary: ProxmoxColors.supportGrey),
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
- icon: Icon(Icons.close),
+ icon: const Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
),
}
}
: null,
- child: Text('Continue'),
+ child: const Text('Continue'),
),
),
),
showDialog(
context: context,
builder: (context) => AlertDialog(
- title: Text('Version Error'),
- content: Text(
+ title: const Text('Version Error'),
+ content: const Text(
'Proxmox VE version not supported, please update your instance to use this app.'),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
- child: Text('Close'),
+ child: const Text('Close'),
),
],
),
if (e.runtimeType == HandshakeException) {
showDialog(
context: context,
- builder: (context) => ProxmoxCertificateErrorDialog(),
+ builder: (context) => const ProxmoxCertificateErrorDialog(),
);
} else {
showDialog(
} on HandshakeException {
showDialog(
context: context,
- builder: (context) => ProxmoxCertificateErrorDialog(),
+ builder: (context) => const ProxmoxCertificateErrorDialog(),
);
}
return response;
children: [
Text(
message,
- style: TextStyle(
+ style: const TextStyle(
fontSize: 20,
),
),
- Padding(
- padding: const EdgeInsets.only(top: 20.0),
+ const Padding(
+ padding: EdgeInsets.only(top: 20.0),
child: CircularProgressIndicator(),
)
],
@override
Widget build(BuildContext context) {
return AlertDialog(
- title: Text('Connection error'),
+ title: const Text('Connection error'),
content: Text('Could not establish connection: ${this.exception}'),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
- child: Text('Close'),
+ child: const Text('Close'),
),
],
);
@override
Widget build(BuildContext context) {
return AlertDialog(
- title: Text('API Error'),
+ title: const Text('API Error'),
content: SingleChildScrollView(
child: Text(exception.message),
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
- child: Text('Close'),
+ child: const Text('Close'),
),
],
);
@override
Widget build(BuildContext context) {
return AlertDialog(
- title: Text('Certificate error'),
+ title: const Text('Certificate error'),
content: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('Your connection is not private.'),
+ const Text('Your connection is not private.'),
Text(
'Note: Consider to disable SSL validation,'
' if you use a self signed, not commonly trusted, certificate.',
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
- child: Text('Close'),
+ child: const Text('Close'),
),
TextButton(
onPressed: () => Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => ProxmoxGeneralSettingsForm())),
- child: Text('Settings'),
+ child: const Text('Settings'),
)
],
);
.firstMatch(ticket!)!;
final time = DateTime.fromMillisecondsSinceEpoch(
int.parse(ticketRegex.group(3)!, radix: 16) * 1000);
- return DateTime.now().isAfter(time.add(Duration(hours: 1)));
+ return DateTime.now().isAfter(time.add(const Duration(hours: 1)));
}
}
child: Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
appBar: AppBar(
- title: Column(
+ title: const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
),
actions: [
IconButton(
- icon: Icon(Icons.settings),
+ icon: const Icon(Icons.settings),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ProxmoxGeneralSettingsForm(),
future: loginStorage,
builder: (context, snapshot) {
if (!snapshot.hasData) {
- return Center(
+ return const Center(
child: CircularProgressIndicator(),
);
}
if (snapshot.hasData &&
(snapshot.data!.logins?.isEmpty ?? true)) {
- return Center(
+ return const Center(
child: Text('Add an account'),
);
}
if (activeSessions.isNotEmpty) {
items.addAll([
- Padding(
- padding: const EdgeInsets.all(12.0),
+ const Padding(
+ padding: EdgeInsets.all(12.0),
child: Text(
'Active Sessions',
style: TextStyle(
...activeSessions.map((s) => ListTile(
title: Text(s.fullHostname),
subtitle: Text(s.fullUsername),
- trailing: Icon(Icons.navigate_next),
+ trailing: const Icon(Icons.navigate_next),
leading: PopupMenuButton(
- icon: Icon(Icons.more_vert, color: Colors.green),
+ icon: const Icon(Icons.more_vert, color: Colors.green),
itemBuilder: (context) => [
PopupMenuItem(
child: ListTile(
dense: true,
- leading: Icon(Icons.logout),
- title: Text('Logout'),
+ leading: const Icon(Icons.logout),
+ title: const Text('Logout'),
onTap: () async {
await snapshot.data!
.rebuild((b) => b.logins
]);
}
items.addAll([
- Padding(
- padding: const EdgeInsets.all(12.0),
+ const Padding(
+ padding: EdgeInsets.all(12.0),
child: Text(
'Available Sites',
style: TextStyle(
ListTile(
title: Text(login.fullHostname),
subtitle: Text(login.fullUsername),
- trailing: Icon(Icons.navigate_next),
+ trailing: const Icon(Icons.navigate_next),
leading: PopupMenuButton(
itemBuilder: (context) => [
if (login.passwordSaved ?? false)
PopupMenuItem(
child: ListTile(
dense: true,
- leading: Icon(Icons.key_off),
- title: Text('Delete Password'),
+ leading: const Icon(Icons.key_off),
+ title: const Text('Delete Password'),
onTap: () async {
await deletePassword(login.identifier!);
PopupMenuItem(
child: ListTile(
dense: true,
- leading: Icon(Icons.delete),
- title: Text('Delete'),
+ leading: const Icon(Icons.delete),
+ title: const Text('Delete'),
onTap: () async {
await deletePassword(login.identifier!);
await snapshot.data!
}),
floatingActionButton: FloatingActionButton.extended(
onPressed: () => _login(isCreate: true),
- label: Text('Add'),
- icon: Icon(Icons.account_circle),
+ label: const Text('Add'),
+ icon: const Icon(Icons.account_circle),
),
),
);
Widget build(BuildContext context) {
return Theme(
data: ThemeData.dark().copyWith(
- colorScheme: ColorScheme.dark().copyWith(
+ colorScheme: const ColorScheme.dark().copyWith(
secondary: ProxmoxColors.orange,
onSecondary: ProxmoxColors.supportGrey)),
child: Scaffold(
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
- icon: Icon(Icons.close),
+ icon: const Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
),
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
- Padding(
- padding: const EdgeInsets.fromLTRB(0, 100.0, 0, 30.0),
+ const Padding(
+ padding: EdgeInsets.fromLTRB(0, 100.0, 0, 30.0),
child: Icon(
Icons.lock,
size: 48,
),
),
- Text(
+ const Text(
'Verify',
style: TextStyle(
fontSize: 36,
color: Colors.white,
fontWeight: FontWeight.bold),
),
- Text(
+ const Text(
'Check your second factor provider',
style: TextStyle(
color: Colors.white38,
child: Column(
children: <Widget>[
DropdownButtonFormField(
- decoration: InputDecoration(
+ decoration: const InputDecoration(
labelText: 'Method',
icon: Icon(Icons.input)),
items: _tfa_kinds
TextField(
controller: _codeController,
textAlign: TextAlign.center,
- decoration: InputDecoration(
+ decoration: const InputDecoration(
labelText: 'Code',
icon: Icon(Icons.pin)),
keyboardType: _selected_tfa_kind == 'totp'
child: TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.white,
- backgroundColor: Color(0xFFE47225),
+ backgroundColor: const Color(0xFFE47225),
disabledBackgroundColor: Colors.grey,
),
onPressed: () => _submitTfaCode(),
- child: Text('Continue'),
+ child: const Text('Continue'),
),
),
),
),
),
if (_isLoading)
- ProxmoxProgressOverlay(
+ const ProxmoxProgressOverlay(
message: 'Verifying second-factor...',
)
],