password check before email change, blindMasterMainInput use for all text inputs
This commit is contained in:
@@ -1,44 +1,102 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
|
||||
|
||||
class BlindMasterMainInput extends StatefulWidget {
|
||||
const BlindMasterMainInput(this.label, {super.key, this.controller, this.validator, this.color, this.password = false});
|
||||
/// A comprehensive, flexible text input widget that maintains consistent styling
|
||||
/// across the entire app while supporting all common text input use cases.
|
||||
class BlindMasterInput extends StatefulWidget {
|
||||
const BlindMasterInput(
|
||||
this.label, {
|
||||
super.key,
|
||||
this.controller,
|
||||
this.validator,
|
||||
this.color,
|
||||
this.password = false,
|
||||
this.enabled = true,
|
||||
this.keyboardType,
|
||||
this.prefixIcon,
|
||||
this.hintText,
|
||||
this.textCapitalization = TextCapitalization.none,
|
||||
this.inputFormatters,
|
||||
this.textAlign = TextAlign.start,
|
||||
this.maxLength,
|
||||
this.textInputAction,
|
||||
this.onFieldSubmitted,
|
||||
this.onChanged,
|
||||
this.focusedBorderColor,
|
||||
this.initialValue,
|
||||
this.autofocus = false,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final TextEditingController? controller;
|
||||
final Color? color;
|
||||
final bool password;
|
||||
final bool enabled;
|
||||
final TextInputType? keyboardType;
|
||||
final IconData? prefixIcon;
|
||||
final String? hintText;
|
||||
final TextCapitalization textCapitalization;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final TextAlign textAlign;
|
||||
final int? maxLength;
|
||||
final TextInputAction? textInputAction;
|
||||
final Function(String)? onFieldSubmitted;
|
||||
final Function(String)? onChanged;
|
||||
final Color? focusedBorderColor;
|
||||
final String? initialValue;
|
||||
final bool autofocus;
|
||||
|
||||
final String? Function(String?)? validator;
|
||||
|
||||
@override
|
||||
State<BlindMasterMainInput> createState() => _BlindMasterMainInputState();
|
||||
State<BlindMasterInput> createState() => _BlindMasterInputState();
|
||||
}
|
||||
|
||||
class _BlindMasterMainInputState extends State<BlindMasterMainInput> {
|
||||
class _BlindMasterInputState extends State<BlindMasterInput> {
|
||||
bool _obscureText = true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: TextFormField(
|
||||
initialValue: widget.initialValue,
|
||||
controller: widget.controller,
|
||||
validator: widget.validator,
|
||||
obscureText: widget.password && _obscureText,
|
||||
enableSuggestions: false,
|
||||
autocorrect: false,
|
||||
controller: widget.controller,
|
||||
enableSuggestions: !widget.password,
|
||||
autocorrect: !widget.password,
|
||||
enabled: widget.enabled,
|
||||
keyboardType: widget.keyboardType,
|
||||
textCapitalization: widget.textCapitalization,
|
||||
inputFormatters: widget.inputFormatters,
|
||||
textAlign: widget.textAlign,
|
||||
maxLength: widget.maxLength,
|
||||
textInputAction: widget.textInputAction,
|
||||
onFieldSubmitted: widget.onFieldSubmitted,
|
||||
onChanged: widget.onChanged,
|
||||
autofocus: widget.autofocus,
|
||||
style: TextStyle(
|
||||
color: widget.color
|
||||
color: widget.color,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
focusedBorder: widget.focusedBorderColor != null
|
||||
? OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(
|
||||
color: widget.focusedBorderColor!,
|
||||
width: 2,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
labelText: widget.label,
|
||||
hintText: widget.hintText,
|
||||
labelStyle: TextStyle(color: widget.color),
|
||||
contentPadding: EdgeInsets.all(10),
|
||||
contentPadding: const EdgeInsets.all(10),
|
||||
prefixIcon: widget.prefixIcon != null ? Icon(widget.prefixIcon) : null,
|
||||
suffixIcon: widget.password
|
||||
? IconButton(
|
||||
icon: Icon(
|
||||
@@ -51,8 +109,21 @@ class _BlindMasterMainInputState extends State<BlindMasterMainInput> {
|
||||
},
|
||||
)
|
||||
: null,
|
||||
counterText: widget.maxLength != null ? '' : null, // Hide character counter
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy alias for backward compatibility
|
||||
class BlindMasterMainInput extends BlindMasterInput {
|
||||
const BlindMasterMainInput(
|
||||
super.label, {
|
||||
super.key,
|
||||
super.controller,
|
||||
super.validator,
|
||||
super.color,
|
||||
super.password,
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:convert';
|
||||
import '../../BlindMasterResources/secure_transmissions.dart';
|
||||
import '../../BlindMasterResources/text_inputs.dart';
|
||||
import 'verify_reset_code_screen.dart';
|
||||
|
||||
class ForgotPasswordScreen extends StatefulWidget {
|
||||
@@ -139,13 +140,10 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
TextFormField(
|
||||
BlindMasterInput(
|
||||
'Email',
|
||||
controller: _emailController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Email',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.email),
|
||||
),
|
||||
prefixIcon: Icons.email,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
validator: _emailValidator,
|
||||
enabled: !_isLoading,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'dart:convert';
|
||||
import '../../BlindMasterResources/secure_transmissions.dart';
|
||||
import '../../BlindMasterResources/text_inputs.dart';
|
||||
import 'reset_password_form_screen.dart';
|
||||
|
||||
class VerifyResetCodeScreen extends StatefulWidget {
|
||||
@@ -220,14 +221,11 @@ class _VerifyResetCodeScreenState extends State<VerifyResetCodeScreen> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
TextFormField(
|
||||
BlindMasterInput(
|
||||
'Reset Code',
|
||||
controller: _codeController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Reset Code',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.security),
|
||||
prefixIcon: Icons.security,
|
||||
hintText: 'ABC123',
|
||||
),
|
||||
keyboardType: TextInputType.text,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
inputFormatters: [
|
||||
@@ -237,11 +235,6 @@ class _VerifyResetCodeScreenState extends State<VerifyResetCodeScreen> {
|
||||
validator: _codeValidator,
|
||||
enabled: !_isLoading && !_isResending,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
letterSpacing: 8,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton(
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'dart:convert';
|
||||
import 'package:blind_master/BlindMasterResources/error_snackbar.dart';
|
||||
import 'package:blind_master/BlindMasterResources/secure_transmissions.dart';
|
||||
import 'package:blind_master/BlindMasterScreens/accountManagement/change_password_screen.dart';
|
||||
import 'package:blind_master/BlindMasterScreens/accountManagement/verify_email_change_screen.dart';
|
||||
import 'package:blind_master/BlindMasterScreens/accountManagement/change_email_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
@@ -157,106 +157,21 @@ class _AccountScreenState extends State<AccountScreen> {
|
||||
}
|
||||
|
||||
Future<void> _handleChangeEmail() async {
|
||||
final TextEditingController emailController = TextEditingController();
|
||||
final formKey = GlobalKey<FormState>();
|
||||
final primaryColor = Theme.of(context).primaryColorLight;
|
||||
|
||||
final result = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext dialogContext) {
|
||||
return AlertDialog(
|
||||
title: Text('Change Email'),
|
||||
content: Form(
|
||||
key: formKey,
|
||||
child: TextFormField(
|
||||
controller: emailController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'New Email Address',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.email),
|
||||
),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter an email address';
|
||||
}
|
||||
final emailRegex = RegExp(r'^[^\s@]+@[^\s@]+\.[^\s@]+$');
|
||||
if (!emailRegex.hasMatch(value)) {
|
||||
return 'Please enter a valid email';
|
||||
}
|
||||
if (value == email) {
|
||||
return 'This is your current email';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(false),
|
||||
child: Text('Cancel'),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
onPressed: () async {
|
||||
if (formKey.currentState!.validate()) {
|
||||
Navigator.of(dialogContext).pop(true);
|
||||
}
|
||||
},
|
||||
child: Text('Send Verification'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
// Allow dialog to fully close before disposing controller
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
|
||||
if (result == true && mounted) {
|
||||
final newEmail = emailController.text.trim();
|
||||
|
||||
try {
|
||||
// Show loading indicator
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext loadingContext) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
if (email == null || email == 'N/A') {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
backgroundColor: Colors.red[700],
|
||||
content: Text('Unable to load current email'),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final localHour = DateTime.now().hour;
|
||||
final response = await securePost(
|
||||
{
|
||||
'newEmail': newEmail,
|
||||
'localHour': localHour,
|
||||
},
|
||||
'request-email-change',
|
||||
);
|
||||
|
||||
// Remove loading indicator
|
||||
if (mounted) Navigator.of(context).pop();
|
||||
|
||||
if (response == null) {
|
||||
throw Exception('No response from server');
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
if (!mounted) return;
|
||||
|
||||
// Navigate to waiting screen
|
||||
// Navigate to change email screen
|
||||
final success = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => EmailChangeWaitingScreen(newEmail: newEmail),
|
||||
builder: (context) => ChangeEmailScreen(currentEmail: email!),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -264,24 +179,6 @@ class _AccountScreenState extends State<AccountScreen> {
|
||||
if (success == true && mounted) {
|
||||
await fetchAccountInfo();
|
||||
}
|
||||
} else {
|
||||
final body = json.decode(response.body);
|
||||
throw Exception(body['error'] ?? 'Failed to send verification email');
|
||||
}
|
||||
} catch (e) {
|
||||
// Remove loading indicator if still showing
|
||||
if (mounted && Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(errorSnackbar(e));
|
||||
} finally {
|
||||
emailController.dispose();
|
||||
}
|
||||
} else {
|
||||
emailController.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
import 'dart:convert';
|
||||
import 'package:blind_master/BlindMasterResources/error_snackbar.dart';
|
||||
import 'package:blind_master/BlindMasterResources/secure_transmissions.dart';
|
||||
import 'package:blind_master/BlindMasterResources/text_inputs.dart';
|
||||
import 'package:blind_master/BlindMasterScreens/accountManagement/verify_email_change_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class ChangeEmailScreen extends StatefulWidget {
|
||||
final String currentEmail;
|
||||
|
||||
const ChangeEmailScreen({super.key, required this.currentEmail});
|
||||
|
||||
@override
|
||||
State<ChangeEmailScreen> createState() => _ChangeEmailScreenState();
|
||||
}
|
||||
|
||||
class _ChangeEmailScreenState extends State<ChangeEmailScreen> {
|
||||
final passwordController = TextEditingController();
|
||||
final newEmailController = TextEditingController();
|
||||
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
passwordController.dispose();
|
||||
newEmailController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
String? passwordValidator(String? input) {
|
||||
if (input == null || input.isEmpty) {
|
||||
return 'Password is required';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String? emailValidator(String? input) {
|
||||
if (input == null || input.isEmpty) {
|
||||
return 'Email address is required';
|
||||
}
|
||||
final emailRegex = RegExp(r'^[^\s@]+@[^\s@]+\.[^\s@]+$');
|
||||
if (!emailRegex.hasMatch(input)) {
|
||||
return 'Please enter a valid email';
|
||||
}
|
||||
if (input == widget.currentEmail) {
|
||||
return 'This is your current email';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<void> handleChangeEmail() async {
|
||||
if (!_formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Show loading indicator
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Theme.of(context).primaryColorLight,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final localHour = DateTime.now().hour;
|
||||
final payload = {
|
||||
'password': passwordController.text,
|
||||
'newEmail': newEmailController.text,
|
||||
'localHour': localHour,
|
||||
};
|
||||
|
||||
final response = await securePost(payload, 'request-email-change');
|
||||
|
||||
// Remove loading indicator
|
||||
if (mounted) Navigator.of(context).pop();
|
||||
|
||||
if (response == null) {
|
||||
throw Exception('No response from server');
|
||||
}
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
if (!mounted) return;
|
||||
|
||||
// Navigate to waiting screen
|
||||
final success = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => EmailChangeWaitingScreen(newEmail: newEmailController.text),
|
||||
),
|
||||
);
|
||||
|
||||
// If email was changed successfully, return true to refresh account info
|
||||
if (success == true && mounted) {
|
||||
Navigator.pop(context, true);
|
||||
}
|
||||
} else if (response.statusCode == 401) {
|
||||
throw Exception('Password is incorrect');
|
||||
} else if (response.statusCode == 409) {
|
||||
throw Exception('Email already in use');
|
||||
} else if (response.statusCode == 400) {
|
||||
final body = json.decode(response.body);
|
||||
throw Exception(body['error'] ?? 'Invalid request');
|
||||
} else {
|
||||
throw Exception('Failed to send verification email');
|
||||
}
|
||||
} catch (e) {
|
||||
// Remove loading indicator if still showing
|
||||
if (mounted && Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(errorSnackbar(e));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).primaryColorLight,
|
||||
foregroundColor: Colors.white,
|
||||
title: Text(
|
||||
'Change Email',
|
||||
style: GoogleFonts.aBeeZee(),
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
autovalidateMode: AutovalidateMode.onUnfocus,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 20),
|
||||
// Current email display
|
||||
Card(
|
||||
elevation: 2,
|
||||
color: Colors.blue[50],
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline, color: Colors.blue[700]),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
'Current Email',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.blue[700],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
widget.currentEmail,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
// Warning card
|
||||
Card(
|
||||
elevation: 2,
|
||||
color: Colors.orange[50],
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.warning_amber, color: Colors.orange[700]),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
'Important',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.orange[700],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
'After changing your email, ${widget.currentEmail} will no longer receive any communications from BlindMaster, including password reset codes.',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
Text(
|
||||
'Verify your identity and enter new email',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[700],
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
BlindMasterMainInput(
|
||||
'Current Password',
|
||||
controller: passwordController,
|
||||
password: true,
|
||||
validator: passwordValidator,
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Divider(),
|
||||
SizedBox(height: 20),
|
||||
BlindMasterMainInput(
|
||||
'New Email Address',
|
||||
controller: newEmailController,
|
||||
validator: emailValidator,
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
ElevatedButton(
|
||||
onPressed: handleChangeEmail,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).primaryColorLight,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.symmetric(vertical: 15),
|
||||
),
|
||||
child: Text(
|
||||
'Send Verification Email',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:blind_master/BlindMasterResources/error_snackbar.dart';
|
||||
import 'package:blind_master/BlindMasterResources/text_inputs.dart';
|
||||
import 'package:blind_master/BlindMasterScreens/addingDevices/set_device_name.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
@@ -58,7 +59,6 @@ class _DeviceSetupState extends State<DeviceSetup> {
|
||||
|
||||
final passControl = TextEditingController();
|
||||
final unameControl = TextEditingController();
|
||||
bool _obscureWifiPassword = true;
|
||||
|
||||
@override void initState() {
|
||||
super.initState();
|
||||
@@ -203,9 +203,6 @@ class _DeviceSetupState extends State<DeviceSetup> {
|
||||
bool ent = isEnterprise(network);
|
||||
bool open = isOpen(network);
|
||||
|
||||
// Reset password visibility state for new dialog
|
||||
_obscureWifiPassword = true;
|
||||
|
||||
Map<String, String> creds = await showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
@@ -225,9 +222,10 @@ class _DeviceSetupState extends State<DeviceSetup> {
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextFormField(
|
||||
BlindMasterInput(
|
||||
'Enterprise Login',
|
||||
controller: unameControl,
|
||||
decoration: const InputDecoration(hintText: "Enter your enterprise login"),
|
||||
hintText: "Enter your enterprise login",
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) => FocusScope.of(context).nextFocus(),
|
||||
validator: (value) => (value == null || value.isEmpty) ? "Empty username!" : null,
|
||||
@@ -236,22 +234,11 @@ class _DeviceSetupState extends State<DeviceSetup> {
|
||||
]
|
||||
),
|
||||
if (!open)
|
||||
TextFormField(
|
||||
BlindMasterInput(
|
||||
'WiFi Password',
|
||||
controller: passControl,
|
||||
obscureText: _obscureWifiPassword,
|
||||
decoration: InputDecoration(
|
||||
password: true,
|
||||
hintText: "Enter password",
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
_obscureWifiPassword ? Icons.visibility : Icons.visibility_off,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_obscureWifiPassword = !_obscureWifiPassword;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
validator: (value) => (value == null || value.length < 8) ? "Not long enough!" : null,
|
||||
textInputAction: TextInputAction.send,
|
||||
onFieldSubmitted: (value) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:blind_master/BlindMasterResources/secure_transmissions.dart';
|
||||
import 'package:blind_master/BlindMasterResources/text_inputs.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
@@ -151,21 +152,10 @@ class _CreateGroupDialogState extends State<CreateGroupDialog> {
|
||||
: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
BlindMasterInput(
|
||||
'Group Name',
|
||||
controller: _nameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Group Name',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).primaryColorDark,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
focusedBorderColor: Theme.of(context).primaryColorDark,
|
||||
onChanged: (_) {
|
||||
if (errorMessage != null) {
|
||||
setState(() {
|
||||
|
||||
@@ -211,12 +211,9 @@ class _DeviceScreenState extends State<DeviceScreen> {
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min, // Keep column compact
|
||||
children: <Widget>[
|
||||
TextFormField(
|
||||
BlindMasterInput(
|
||||
'Peripheral Name',
|
||||
controller: _newPeripheralNameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Peripheral Name',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
DropdownButtonFormField<int>(
|
||||
|
||||
Reference in New Issue
Block a user