mobile-app/lib/main.dart

44 lines
1.3 KiB
Dart
Raw Normal View History

2024-10-21 12:33:46 +00:00
import 'package:daily_ledger/helper/AuthProvider.dart';
import 'package:daily_ledger/pages/Home/Home.dart';
import 'package:daily_ledger/pages/login.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (context) => AuthProvider()..autoLogin(),
child: MaterialApp(
debugShowCheckedModeBanner: false,
home: Consumer<AuthProvider>(
builder: (context, authProvider, _) {
return authProvider.isAuth
? const HomeScreen()
: const LoginScreen();
},
),
theme: ThemeData(
fontFamily: 'Manrope',
scaffoldBackgroundColor: const Color(0xffE9ECFF),
colorScheme: const ColorScheme.light(primary: Color(0xFF4545DB)),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: const Color(0xfff4f4f4),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(0),
borderSide: BorderSide.none,
),
),
),
),
);
}
}