Add initial project structure and configuration files for iOS and Android
This commit is contained in:
106
lib/app.dart
Normal file
106
lib/app.dart
Normal file
@@ -0,0 +1,106 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'config/themes.dart';
|
||||
import 'config/routes.dart';
|
||||
import 'di/injection.dart';
|
||||
import 'features/auth/controllers/auth_cubit.dart';
|
||||
import 'features/auth/controllers/auth_state.dart';
|
||||
import 'features/auth/screens/login_screen.dart';
|
||||
import 'features/dashboard/screens/dashboard_screen.dart';
|
||||
|
||||
class KMobile extends StatelessWidget {
|
||||
const KMobile({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Set status bar color
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
),
|
||||
);
|
||||
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<AuthCubit>(
|
||||
create: (_) => getIt<AuthCubit>(),
|
||||
),
|
||||
// Add other Bloc/Cubit providers here
|
||||
],
|
||||
child: MaterialApp(
|
||||
title: 'Banking App',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppThemes.lightTheme,
|
||||
darkTheme: AppThemes.darkTheme,
|
||||
themeMode: ThemeMode.system, // Use system theme by default
|
||||
onGenerateRoute: AppRoutes.generateRoute,
|
||||
initialRoute: AppRoutes.splash,
|
||||
builder: (context, child) {
|
||||
return MediaQuery(
|
||||
// Prevent font scaling to maintain design consistency
|
||||
data: MediaQuery.of(context)
|
||||
.copyWith(textScaler: const TextScaler.linear(1.0)),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
home: BlocBuilder<AuthCubit, AuthState>(
|
||||
builder: (context, state) {
|
||||
// Handle different authentication states
|
||||
if (state is AuthInitial || state is AuthLoading) {
|
||||
return const _SplashScreen();
|
||||
}
|
||||
|
||||
if (state is Authenticated) {
|
||||
return const DashboardScreen();
|
||||
}
|
||||
|
||||
return const LoginScreen();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Simple splash screen component
|
||||
class _SplashScreen extends StatelessWidget {
|
||||
const _SplashScreen();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Replace with your bank logo
|
||||
Image.asset(
|
||||
'assets/images/logo.png',
|
||||
width: 150,
|
||||
height: 150,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Icon(
|
||||
Icons.account_balance,
|
||||
size: 100,
|
||||
color: Colors.blue,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
'SecureBank',
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const CircularProgressIndicator(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user