Enhanced material design 3 implementation
This commit is contained in:
@@ -28,6 +28,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
|
||||
bool _isLoading = false;
|
||||
bool _obscurePassword = true;
|
||||
bool _hasValidationError = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -56,7 +57,13 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
}
|
||||
|
||||
Future<void> _handleEmailSignIn() async {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
if (!_formKey.currentState!.validate()) {
|
||||
setState(() {
|
||||
_hasValidationError = !_hasValidationError;
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() => _hasValidationError = false);
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
final auth = ref.read(authControllerProvider);
|
||||
@@ -151,7 +158,9 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// ── Sign-in card ──
|
||||
Card(
|
||||
M3ErrorShake(
|
||||
hasError: _hasValidationError,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
color: cs.surfaceContainerLow,
|
||||
shape: RoundedRectangleBorder(
|
||||
@@ -245,6 +254,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
),
|
||||
),
|
||||
),
|
||||
), // M3ErrorShake
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// ── Divider ──
|
||||
|
||||
Reference in New Issue
Block a user