feat(auth)!: use form_bloc package
This commit is contained in:
@@ -14,14 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:authentication_bloc_example/constants.dart';
|
||||
import 'package:authentication_bloc_example/home/home_page.dart';
|
||||
import 'package:authentication_bloc_example/login/login_page.dart';
|
||||
import 'package:authentication_bloc_example/model.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:example/constants.dart';
|
||||
import 'package:example/home/home_page.dart';
|
||||
import 'package:example/login/login_page.dart';
|
||||
import 'package:example/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class App extends StatelessWidget {
|
||||
const App({Key? key}) : super(key: key);
|
||||
@@ -31,7 +32,8 @@ class App extends StatelessWidget {
|
||||
FormEntry(formFieldName, Name.pure()),
|
||||
FormEntry(formFieldPhone, Phone.pure()),
|
||||
FormEntry(formFieldPro, Boolean.pure()),
|
||||
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(), export: false),
|
||||
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(),
|
||||
export: false),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -42,7 +44,8 @@ class App extends StatelessWidget {
|
||||
FormEntry(formFieldPro, Boolean.pure()),
|
||||
FormEntry(formFieldSiren, Siren.pure()),
|
||||
FormEntry(formFieldIban, Iban.pure()),
|
||||
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(), export: false),
|
||||
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(),
|
||||
export: false),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File generated by FlutterFire CLI.
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
|
||||
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
|
||||
import 'package:flutter/foundation.dart'
|
||||
show defaultTargetPlatform, kIsWeb, TargetPlatform;
|
||||
@@ -17,54 +17,37 @@ import 'package:flutter/foundation.dart'
|
||||
class DefaultFirebaseOptions {
|
||||
static FirebaseOptions get currentPlatform {
|
||||
if (kIsWeb) {
|
||||
return web;
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for web - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
}
|
||||
// ignore: missing_enum_constant_in_switch
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
return android;
|
||||
case TargetPlatform.iOS:
|
||||
return ios;
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for ios - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
case TargetPlatform.macOS:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for macos - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
default:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions are not supported for this platform.',
|
||||
);
|
||||
}
|
||||
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions are not supported for this platform.',
|
||||
);
|
||||
}
|
||||
|
||||
static const FirebaseOptions web = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCxdDUpkpW7onOicIcIDcIVvPC8ll1twCQ',
|
||||
appId: '1:136771801992:web:e757595ae62e646297203d',
|
||||
messagingSenderId: '136771801992',
|
||||
projectId: 'tchat-beta',
|
||||
authDomain: 'tchat-beta.firebaseapp.com',
|
||||
databaseURL: 'https://tchat-beta.firebaseio.com',
|
||||
storageBucket: 'tchat-beta.appspot.com',
|
||||
);
|
||||
|
||||
static const FirebaseOptions android = FirebaseOptions(
|
||||
apiKey: 'AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk',
|
||||
appId: '1:136771801992:android:d20e0361057e815197203d',
|
||||
appId: '1:136771801992:android:4ff419f07afdad6097203d',
|
||||
messagingSenderId: '136771801992',
|
||||
projectId: 'tchat-beta',
|
||||
databaseURL: 'https://tchat-beta.firebaseio.com',
|
||||
storageBucket: 'tchat-beta.appspot.com',
|
||||
);
|
||||
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCDbbhjbFrQwLXuIANdJzjkDk8uOETnn7w',
|
||||
appId: '1:136771801992:ios:6fe69c0bea08b7b397203d',
|
||||
messagingSenderId: '136771801992',
|
||||
projectId: 'tchat-beta',
|
||||
databaseURL: 'https://tchat-beta.firebaseio.com',
|
||||
storageBucket: 'tchat-beta.appspot.com',
|
||||
iosClientId:
|
||||
'136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.example.example',
|
||||
);
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/forgot_password/widgets/forgot_password_form.dart';
|
||||
import 'package:authentication_bloc_example/forgot_password/widgets/forgot_password_form.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
+2
-1
@@ -15,8 +15,9 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class _EmailInput extends StatelessWidget {
|
||||
@override
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/home/widgets/infos.dart';
|
||||
import 'package:authentication_bloc_example/home/widgets/infos.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import 'package:example/home/widgets/email_verification.dart';
|
||||
import 'package:authentication_bloc_example/home/widgets/email_verification.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/home/widgets/avatar.dart';
|
||||
import 'package:authentication_bloc_example/home/widgets/avatar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:example/constants.dart';
|
||||
import 'package:authentication_bloc_example/constants.dart';
|
||||
|
||||
class UserInfo extends StatelessWidget {
|
||||
const UserInfo({Key? key}) : super(key: key);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/login/widgets/login_form.dart';
|
||||
import 'package:authentication_bloc_example/login/widgets/login_form.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/app/app.dart';
|
||||
import 'package:example/constants.dart';
|
||||
import 'package:example/forgot_password/forgot_password_page.dart';
|
||||
import 'package:example/sign_up/sign_up_page.dart';
|
||||
import 'package:authentication_bloc_example/app/app.dart';
|
||||
import 'package:authentication_bloc_example/constants.dart';
|
||||
import 'package:authentication_bloc_example/forgot_password/forgot_password_page.dart';
|
||||
import 'package:authentication_bloc_example/sign_up/sign_up_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class _EmailInput extends StatelessWidget {
|
||||
@override
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/app/app.dart';
|
||||
import 'package:example/app/bloc_observer.dart';
|
||||
import 'package:example/firebase_options.dart';
|
||||
import 'package:authentication_bloc_example/app/app.dart';
|
||||
import 'package:authentication_bloc_example/app/bloc_observer.dart';
|
||||
import 'package:authentication_bloc_example/firebase_options.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/sign_up/widgets/sign_up_form.dart';
|
||||
import 'package:authentication_bloc_example/sign_up/widgets/sign_up_form.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SignUpPage extends StatelessWidget {
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:example/app/app.dart';
|
||||
import 'package:example/constants.dart';
|
||||
import 'package:authentication_bloc_example/app/app.dart';
|
||||
import 'package:authentication_bloc_example/constants.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class _NameInput extends StatelessWidget {
|
||||
@override
|
||||
@@ -253,11 +254,11 @@ class _DebugButton extends StatelessWidget {
|
||||
return BlocBuilder<SignUpCubit, SignUpState>(
|
||||
builder: (context, state) {
|
||||
return ElevatedButton(
|
||||
onPressed: () {
|
||||
log(state.toString());
|
||||
} ,
|
||||
child: const Text('DEBUG'),
|
||||
);
|
||||
onPressed: () {
|
||||
log(state.toString());
|
||||
},
|
||||
child: const Text('DEBUG'),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user