Siopas Inventory PETI for ISTW Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.0 KiB

import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:siopas/migrations/databasehelper.dart';
import 'package:siopas/pages/transfer_peti/edit.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/peminjaman_barang/peminjaman_stock_page.dart';
import 'pages/peminjaman_barang/create.dart';
import 'pages/peminjaman_barang/show.dart';
import 'pages/pengembalian_barang/edit.dart';
import 'pages/pengembalian_barang/index.dart';
import 'pages/sign_in_page.dart';
import 'pages/splash_page.dart';
import 'pages/transfer_peti/index.dart';
import 'providers/asset_status_provider.dart';
import 'providers/auth_provider.dart';
import 'providers/m_status_provider.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await SqfliteDatabaseHelper.instance.db;
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp, // Atur orientasi ke potrait
]);
runApp(MyApp());
configLoading(); // Pindahkan baris ini ke sini setelah runApp
}
void configLoading() {
EasyLoading.instance
..displayDuration = const Duration(milliseconds: 2000)
..indicatorType = EasyLoadingIndicatorType.fadingCircle
..loadingStyle = EasyLoadingStyle.dark
..indicatorSize = 45.0
..radius = 10.0
..progressColor = Colors.yellow
..backgroundColor = Colors.green
..indicatorColor = Colors.yellow
..textColor = Colors.yellow
..maskColor = Colors.blue.withOpacity(0.5)
..userInteractions = true
..dismissOnTap = false;
}
class MyApp extends StatelessWidget {
MyApp() {
EasyLoading.init(); // Inisialisasi EasyLoading
}
@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,
home: SplashPage(),
routes: {
'/sign-in': (context) => SignInPage(),
'/home': (context) => MainPage(),
'/peminjaman-barang': (context) => AssetStatusPage(),
'/peminjaman-barang/create': (context) => CreatePeminjamanBarang(),
'/pengembalian-barang': (context) => PengembalianBarangPage(),
'/pengembalian-barang/edit': (context) =>
CreatePengembalianBarangPage(),
'/transfer-peti': (context) => TransferPetiPage(),
'/transfer-peti/edit': (context) => EditTransferPetiPage(),
},
builder: EasyLoading.init(),
),
);
}
}