@@ -5,26 +5,23 @@ import 'package:app/presentation/ui/custom/app_theme_switch.dart';
55import 'package:app/presentation/ui/custom/loading_screen.dart' ;
66import 'package:common/core/resource.dart' ;
77import 'package:domain/bloc/auth/auth_cubit.dart' ;
8- import 'package:domain/services/auth_service.dart' ;
98import 'package:flutter/foundation.dart' ;
109import 'package:flutter/material.dart' ;
1110import 'package:flutter_bloc/flutter_bloc.dart' ;
1211
1312import '../../custom/environment_selector.dart' ;
1413
1514class LoginPage extends StatelessWidget {
16- AuthService get _authService => getIt ();
17-
1815 const LoginPage ({super .key});
1916
17+ AuthCubit get _authCubit => getIt ();
18+
2019 @override
2120 Widget build (BuildContext context) {
22- return Stack (
23- children: [
24- Scaffold (
25- appBar: AppBar (),
26- backgroundColor: context.theme.colorScheme.surface,
27- body: Padding (
21+ return Scaffold (
22+ body: Stack (
23+ children: [
24+ Padding (
2825 padding: EdgeInsets .all (spacing.m),
2926 child: Column (
3027 mainAxisAlignment: MainAxisAlignment .center,
@@ -36,7 +33,7 @@ class LoginPage extends StatelessWidget {
3633 child: ElevatedButton (
3734 child: const Text ('Login' ),
3835 onPressed: () {
39- _authService. logInWithCredentials (
36+ _authCubit. login (
4037 'Rootstrap' ,
4138 '12345678' ,
4239 );
@@ -50,9 +47,9 @@ class LoginPage extends StatelessWidget {
5047 ],
5148 ),
5249 ),
53- ),
54- const _Loading () ,
55- ] ,
50+ const _Loading ( ),
51+ ] ,
52+ ) ,
5653 );
5754 }
5855}
@@ -64,8 +61,15 @@ class _Loading extends StatelessWidget {
6461 Widget build (BuildContext context) {
6562 return BlocBuilder <AuthCubit , Resource >(
6663 builder: (context, state) {
67- return LoadingScreen (
68- isLoading: state is RLoading ,
64+ if (state is ! RLoading ) {
65+ return const SizedBox .shrink ();
66+ }
67+
68+ return Container (
69+ color: Colors .black.withAlpha (50 ),
70+ width: double .maxFinite,
71+ height: double .maxFinite,
72+ child: const LoadingScreen (),
6973 );
7074 },
7175 );
0 commit comments