Spaces:
Build error
Build error
File size: 2,628 Bytes
3382f47 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
import 'package:flutter/material.dart';
import 'package:auto_gpt_flutter_client/services/auth_service.dart';
class FirebaseAuthView extends StatelessWidget {
// TODO: This should be initialized in the main.dart instead of here
final AuthService _authService = AuthService();
FirebaseAuthView({super.key}); // Initialize the auth service
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
OutlinedButton(
onPressed: () async {
final user = await _authService.signInWithGoogle();
if (user != null) {
print(
"Successfully signed in with Google: ${user.user?.displayName}");
}
},
style: OutlinedButton.styleFrom(
foregroundColor: Colors.blue,
side: const BorderSide(color: Colors.blue, width: 2),
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset('assets/images/google_logo.svg.png', width: 24),
const SizedBox(width: 8),
const Text('Sign in with Google',
style: TextStyle(fontWeight: FontWeight.w300)),
],
),
),
const SizedBox(height: 20),
OutlinedButton(
onPressed: () async {
final user = await _authService.signInWithGitHub();
if (user != null) {
print(
"Successfully signed in with GitHub: ${user.user?.displayName}");
}
},
style: OutlinedButton.styleFrom(
foregroundColor: Colors.black,
side: const BorderSide(color: Colors.black, width: 2),
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset('assets/images/github_logo.svg.png', width: 24),
const SizedBox(width: 8),
const Text('Sign in with GitHub',
style: TextStyle(fontWeight: FontWeight.w300)),
],
),
),
],
),
),
);
}
}
|