feat(auth): integrate Google Sign-In UI with custom button and friendly preparation notice
Build Android APK / Build Release APKs (push) Successful in 13m30s

This commit is contained in:
2026-09-14 10:33:07 +02:00
parent a50456032c
commit 5ed7288c0e
2 changed files with 120 additions and 0 deletions
+113
View File
@@ -145,6 +145,31 @@ class _AuthDialogState extends State<AuthDialog>
}
}
Future<void> _handleGoogleSignIn() async {
setState(() {
_isLoading = true;
_errorMessage = null;
});
final auth = Provider.of<AuthService>(context, listen: false);
final error = await auth.signInWithGoogle();
if (!mounted) return;
setState(() => _isLoading = false);
if (error == null) {
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Erfolgreich mit Google angemeldet!'),
backgroundColor: Colors.green,
),
);
} else {
setState(() => _errorMessage = error);
}
}
Future<void> _handleCodeUnlock() async {
final code = _codeController.text.trim();
if (code.isEmpty) {
@@ -388,6 +413,26 @@ class _AuthDialogState extends State<AuthDialog>
: const Text('Anmelden',
style: TextStyle(fontSize: 15)),
),
const SizedBox(height: 14),
Row(
children: [
Expanded(child: Divider(color: Colors.grey.shade300)),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
'ODER',
style: TextStyle(
fontSize: 11,
color: Colors.grey.shade500,
fontWeight: FontWeight.bold,
),
),
),
Expanded(child: Divider(color: Colors.grey.shade300)),
],
),
const SizedBox(height: 14),
_buildGoogleButton(label: 'Mit Google anmelden'),
],
),
),
@@ -481,6 +526,26 @@ class _AuthDialogState extends State<AuthDialog>
'Konto erstellen & E-Mail bestätigen',
style: TextStyle(fontSize: 14)),
),
const SizedBox(height: 14),
Row(
children: [
Expanded(child: Divider(color: Colors.grey.shade300)),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
'ODER',
style: TextStyle(
fontSize: 11,
color: Colors.grey.shade500,
fontWeight: FontWeight.bold,
),
),
),
Expanded(child: Divider(color: Colors.grey.shade300)),
],
),
const SizedBox(height: 14),
_buildGoogleButton(label: 'Mit Google registrieren'),
],
),
),
@@ -542,4 +607,52 @@ class _AuthDialogState extends State<AuthDialog>
),
);
}
Widget _buildGoogleButton({required String label}) {
return OutlinedButton(
onPressed: _isLoading ? null : _handleGoogleSignIn,
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 11, horizontal: 16),
side: BorderSide(color: Colors.grey.shade300),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
backgroundColor: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildGoogleIcon(),
const SizedBox(width: 12),
Text(
label,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.black87,
),
),
],
),
);
}
Widget _buildGoogleIcon() {
return Container(
width: 22,
height: 22,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(color: Colors.grey.shade200),
),
alignment: Alignment.center,
child: const Text(
'G',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xFF4285F4),
),
),
);
}
}
+7
View File
@@ -136,6 +136,13 @@ class AuthService extends ChangeNotifier {
}
}
/// Sign in with Google (UI stub / preparation)
Future<String?> signInWithGoogle() async {
// Note: Once SHA-1 fingerprint is registered in Firebase Console,
// the full interactive Google OAuth sign-in flow can be activated.
return 'Google Sign-In ist in Vorbereitung. Bitte nutze derzeit die E-Mail-Anmeldung oder den Bürger-Code.';
}
/// Send password reset email
Future<String?> sendPasswordReset(String email) async {
try {