|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'pages/home/main_page.dart';
|
|
|
|
import 'pages/home/peminjaman_stock_page.dart';
|
|
|
|
import 'pages/peminjaman_barang/create.dart';
|
|
|
|
import 'pages/peminjaman_barang/show.dart';
|
|
|
|
import 'pages/sign_in_page.dart';
|
|
|
|
import 'pages/splash_page.dart';
|
|
|
|
import 'providers/asset_status_provider.dart';
|
|
|
|
import 'providers/auth_provider.dart';
|
|
|
|
import 'providers/m_status_provider.dart';
|
|
|
|
|
|
|
|
void main() async {
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
|
|
// var email = prefs.getString("email");
|
|
|
|
// var password = prefs.getString("password");
|
|
|
|
// var token = prefs.getString("token");
|
|
|
|
// await Firebase.initializeApp();
|
|
|
|
runApp(MyApp());
|
|
|
|
SystemChrome.setPreferredOrientations([
|
|
|
|
DeviceOrientation.portraitUp, // Atur orientasi ke potrait
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MultiProvider(
|
|
|
|
providers: [
|
|
|
|
ChangeNotifierProvider(
|
|
|
|
create: (context) => AuthProvider(),
|
|
|
|
),
|
|
|
|
ChangeNotifierProvider(
|
|
|
|
create: (context) => M_assetStatusProvider(),
|
|
|
|
),
|
|
|
|
ChangeNotifierProvider(
|
|
|
|
create: (context) => AssetStatusProvider(),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
child: MaterialApp(
|
|
|
|
theme: ThemeData(
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
|
|
),
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
routes: {
|
|
|
|
'/': (context) => SplashPage(),
|
|
|
|
'/sign-in': (context) => SignInPage(),
|
|
|
|
'/home': (context) => MainPage(),
|
|
|
|
'/peminjaman-barang': (context) => AssetStatusPage(),
|
|
|
|
'/peminjaman-barang/create': (context) => CreatePeminjamanBarang(),
|
|
|
|
// '/peminjaman-barang/show': (context) =>
|
|
|
|
// DetailPeminjamanBarangPage(assetId: 0),
|
|
|
|
// '/category': (context) => SurveyDetailPage(),
|
|
|
|
// '/map': (context) => GeoMapPage(),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|