@@ -6,22 +6,48 @@ import 'constants.dart';
6
6
7
7
class SignUp extends StatelessWidget {
8
8
const SignUp ({Key ? key}) : super (key: key);
9
-
10
9
@override
11
10
Widget build (BuildContext context) {
11
+ void navigateHome (AuthResponse response) {
12
+ Navigator .of (context).pushReplacementNamed ('/home' );
13
+ }
14
+
15
+ final darkModeThemeData = ThemeData .dark ().copyWith (
16
+ colorScheme: const ColorScheme .dark (
17
+ primary: Color .fromARGB (248 , 183 , 183 , 183 ), // text below main button
18
+ ),
19
+ textSelectionTheme: TextSelectionThemeData (
20
+ cursorColor: Colors .blueGrey[300 ], // cursor when typing
21
+ ),
22
+ inputDecorationTheme: InputDecorationTheme (
23
+ fillColor: Colors .grey[800 ], // background of text entry
24
+ filled: true ,
25
+ border: OutlineInputBorder (
26
+ borderRadius: BorderRadius .circular (8 ),
27
+ borderSide: BorderSide .none,
28
+ ),
29
+ labelStyle: const TextStyle (color: Color .fromARGB (179 , 255 , 255 , 255 )), // text labeling text entry
30
+ ),
31
+ elevatedButtonTheme: ElevatedButtonThemeData (
32
+ style: ElevatedButton .styleFrom (
33
+ backgroundColor: const Color .fromARGB (255 , 22 , 135 , 188 ), // main button
34
+ foregroundColor: const Color .fromARGB (255 , 255 , 255 , 255 ), // main button text
35
+ shape: RoundedRectangleBorder (
36
+ borderRadius: BorderRadius .circular (8 ),
37
+ ),
38
+ ),
39
+ ),
40
+ );
41
+
12
42
return Scaffold (
13
43
appBar: appBar ('Sign In' ),
14
44
body: ListView (
15
45
padding: const EdgeInsets .all (24.0 ),
16
46
children: [
17
47
SupaEmailAuth (
18
48
redirectTo: kIsWeb ? null : 'io.supabase.flutter://' ,
19
- onSignInComplete: (response) {
20
- Navigator .of (context).pushReplacementNamed ('/home' );
21
- },
22
- onSignUpComplete: (response) {
23
- Navigator .of (context).pushReplacementNamed ('/home' );
24
- },
49
+ onSignInComplete: navigateHome,
50
+ onSignUpComplete: navigateHome,
25
51
metadataFields: [
26
52
MetaDataField (
27
53
prefixIcon: const Icon (Icons .person),
@@ -36,6 +62,34 @@ class SignUp extends StatelessWidget {
36
62
),
37
63
],
38
64
),
65
+
66
+ const Divider (),
67
+ optionText,
68
+ spacer,
69
+
70
+ // Dark theme example
71
+ Card (
72
+ elevation: 10 ,
73
+ color: const Color .fromARGB (255 , 24 , 24 , 24 ),
74
+ child: Padding (
75
+ padding: const EdgeInsets .all (30 ),
76
+ child: Theme (
77
+ data: darkModeThemeData,
78
+ child: SupaEmailAuth (
79
+ redirectTo: kIsWeb ? null : 'io.supabase.flutter://' ,
80
+ onSignInComplete: navigateHome,
81
+ onSignUpComplete: navigateHome,
82
+ prefixIconEmail: null ,
83
+ prefixIconPassword: null ,
84
+ localization: const SupaEmailAuthLocalization (
85
+ enterEmail: "email" ,
86
+ enterPassword: "password" ,
87
+ dontHaveAccount: "sign up" ,
88
+ forgotPassword: "forgot password" ),
89
+ ),
90
+ ),
91
+ )),
92
+
39
93
const Divider (),
40
94
optionText,
41
95
spacer,
0 commit comments