You've already forked flutter-rp-example
First commit
This commit is contained in:
61
lib/main.dart
Normal file
61
lib/main.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sampleapp/services/auth/auth.dart';
|
||||
import 'package:sampleapp/router/router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'globals.dart';
|
||||
import 'locator.dart';
|
||||
import 'services/auth/auth_view_model.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// Setup injections
|
||||
await setup();
|
||||
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
@override
|
||||
_MyAppState createState() => _MyAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
late ReflexRouterDelegate delegate;
|
||||
late AuthService authService;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
authService = locator.get<AuthService>();
|
||||
delegate = locator.get<ReflexRouterDelegate>();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChangeNotifierProvider<AuthViewModel>(
|
||||
create: (_) => AuthViewModel(authService),
|
||||
child: MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('fr'),
|
||||
Locale('es'),
|
||||
Locale('pl'),
|
||||
],
|
||||
theme: ThemeData(
|
||||
scaffoldBackgroundColor: Globals.RP_BG_COLOR,
|
||||
),
|
||||
home: Router(routerDelegate: delegate),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AuthRepository {}
|
||||
Reference in New Issue
Block a user