before
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:prosappco/blocs/authentication_bloc/authentication_bloc.dart';
|
||||
import 'package:prosappco/blocs/sign_up_bloc/sign_up_bloc.dart';
|
||||
import 'package:prosappco/blocs/sing_in_bloc/sign_in_bloc.dart';
|
||||
import 'package:prosappco/screens/authentication/sign_in_screen.dart';
|
||||
import 'package:prosappco/screens/authentication/sign_up_screen.dart';
|
||||
|
||||
class SignScreen extends StatefulWidget {
|
||||
final int initialIndex;
|
||||
|
||||
SignScreen({super.key, required this.initialIndex});
|
||||
|
||||
@override
|
||||
State<SignScreen> createState() => _SignScreenState();
|
||||
}
|
||||
|
||||
class _SignScreenState extends State<SignScreen> with TickerProviderStateMixin {
|
||||
late TabController tabController;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
tabController = TabController(
|
||||
initialIndex: widget.initialIndex,
|
||||
length: 2,
|
||||
vsync: this,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
return BlocListener<AuthenticationBloc, AuthenticationState>(
|
||||
listener: (context, state) {
|
||||
if (state.status == AuthenticationStatus.authenticated) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
// Text('${context.read<SignInBloc>().state}'),
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
child: Column(
|
||||
children: [
|
||||
Center(
|
||||
child: Image(
|
||||
width: width * 0.7,
|
||||
image: AssetImage('images/logo_prosapp.png'),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
TabBar(
|
||||
controller: tabController,
|
||||
unselectedLabelColor:
|
||||
Theme.of(context).colorScheme.onBackground,
|
||||
labelColor: Theme.of(context).colorScheme.onBackground,
|
||||
tabs: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Text(
|
||||
'Inicia sesión',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Text(
|
||||
'Registrate',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TabBarView(controller: tabController, children: [
|
||||
BlocProvider<SignInBloc>(
|
||||
create: (context) =>
|
||||
Injector.appInstance.get<SignInBloc>(),
|
||||
child: SignInScreen(),
|
||||
),
|
||||
BlocProvider<SignUpBloc>(
|
||||
create: (context) =>
|
||||
Injector.appInstance.get<SignUpBloc>(),
|
||||
child: SignUpScreen(),
|
||||
),
|
||||
// BlocProvider<SignInBloc>(
|
||||
// create: (context) => SignInBloc(
|
||||
// userRepository: context
|
||||
// .read<AuthenticationBloc>()
|
||||
// .userRepository),
|
||||
// child: SignInScreen(),
|
||||
// ),
|
||||
// BlocProvider<SignUpBloc>(
|
||||
// create: (context) => SignUpBloc(
|
||||
// userRepository: context
|
||||
// .read<AuthenticationBloc>()
|
||||
// .userRepository),
|
||||
// child: SignUpScreen(),
|
||||
// ),
|
||||
]),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user