first commit

This commit is contained in:
Sas Andy
2024-10-01 09:37:38 +07:00
commit e3073d9823
268 changed files with 26689 additions and 0 deletions

270
lib/app/constant.dart Normal file
View File

@@ -0,0 +1,270 @@
import 'package:mitra_corporate/app/route.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:mitra_corporate/model/menu_model.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../model/surat_jalan_model.dart';
import '../widgets/custom_snackbar_widget.dart';
class Constant {
static String baseUrl = "";
static String protocol = "";
static String tokenName = "oneMitraPramita";
static double designHeight = 1024;
static double designWidth = 1440;
static String version = "Versi 1.01";
static String ipAddress = "";
// //color Theme
// static Color textBlack = Color(0xff212B36);
// static Color textGrey = Color(0xff919EAB);
// static Color textBlue = Color(0xff1939B7);
// static Color textWhite = Color(0xffffffff);
// static Color backgroundColor = Color(0xffFCFAFA);
// static Color primaryBlue = Color(0xff1939B7);
// static Color buttonPrimary1 = Color(0xff1E1BD3);
// static Color buttonPrimary2 = Color(0xff5959FF);
//typoGraphy
static TextStyle h1_700({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 36),
fontWeight: FontWeight.w700,
);
}
static TextStyle h2_600({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 28),
fontWeight: FontWeight.w600,
);
}
static TextStyle h3_400({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 24),
fontWeight: FontWeight.w600,
);
}
static TextStyle h4_600({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 18),
fontWeight: FontWeight.w600,
);
}
static TextStyle body1_600({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 16),
fontWeight: FontWeight.w600,
);
}
static TextStyle body2_400({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 16),
fontWeight: FontWeight.w500,
);
}
static TextStyle body2_700({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 16),
fontWeight: FontWeight.w700,
);
}
static TextStyle body3_600({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 14),
fontWeight: FontWeight.w600,
);
}
static TextStyle body3_500({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 14),
fontWeight: FontWeight.w500,
);
}
static TextStyle body3_400({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 14),
fontWeight: FontWeight.w400,
);
}
static TextStyle caption1_600({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 12),
fontWeight: FontWeight.w600,
);
}
static TextStyle caption1_400({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 12),
fontWeight: FontWeight.w400,
);
}
static TextStyle caption2_600({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 10),
fontWeight: FontWeight.w600,
);
}
static TextStyle caption2_400({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 10),
fontWeight: FontWeight.w400,
);
}
static TextStyle button_large({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 15),
fontWeight: FontWeight.w700,
);
}
static TextStyle button_medium({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 14),
fontWeight: FontWeight.w700,
);
}
static TextStyle button_small({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualX(context: context, x: 13),
fontWeight: FontWeight.w700,
);
}
//size convertion
static double getActualX({
required BuildContext context,
required double x,
}) {
return x / designWidth * MediaQuery.of(context).size.width;
}
static double getActualY({
required BuildContext context,
required double y,
}) {
return y / designHeight * MediaQuery.of(context).size.height;
}
static String convertToIdr(dynamic number, int decimalDigit) {
NumberFormat currencyFormatter = NumberFormat.currency(
locale: 'id',
symbol: 'Rp ',
decimalDigits: decimalDigit,
);
return currencyFormatter.format(number);
}
//color Theme
static Color textBlack = Color(0xff212B36);
static Color textGrey = Color(0xff637381);
static Color textBlue = Color(0xff1939B7);
static Color textWhite = Color(0xffffffff);
static Color textYellow = Color(0xffB78103);
static Color textGreen = Color(0xff229A16);
static Color textPurple = Color(0xffBF07FF);
static Color backgroundColor = Color(0xffFCFAFA);
static Color primaryBlue = Color(0xff1939B7);
static Color buttonPrimary1 = Color(0xff1E1BD3);
static Color buttonPrimary2 = Color(0xff5959FF);
static Color grey_200 = Color(0xffF4F6F8);
static Color yellow_016 = Color(0xffFFC107).withOpacity(0.16);
static Color green_016 = Color(0xff54D62C).withOpacity(0.16);
static Color blue_016 = Color(0xff1890FF).withOpacity(0.16);
static Color green = Color(0xff00AB55);
static Color purple_016 = Color(0xffbf07ff).withOpacity(0.16);
static Color selectedMenuBg = Color(0xffFF0000).withOpacity(0.1);
//Pramita color
static Color primaryRed = Color(0xffFF0000);
static List<dateFilterModel> dateFilter = [
dateFilterModel(id: "1", name: "Tanggal Surat Jalan"),
dateFilterModel(id: "2", name: "Tanggal Kedatangan"),
];
static List<MenuModel> menuList = [
MenuModel(
icon: EvaIcons.grid,
subValue: [1],
title: "Dashboard",
index: 1,
mainValue: 1),
MenuModel(
icon: EvaIcons.fileAdd,
subValue: [2],
title: "Registrasi Pasien",
index: 2,
mainValue: 2),
MenuModel(
icon: EvaIcons.clipboard,
subValue: [3, 5],
title: "Kirim Order",
index: 3,
mainValue: 3),
MenuModel(
icon: EvaIcons.shoppingCart,
subValue: [6],
title: "List Order",
index: 4,
mainValue: 6),
// MenuModel(
// icon: EvaIcons.fileText,
// subValue: [4, 7],
// title: "Hasil",
// index: 5,
// mainValue: 4),
];
static List<MenuModel> getMenuModel() {
List<MenuModel> data = menuList;
data.sort(
(a, b) => a.index.compareTo(b.index),
);
return data;
}
static autoLogout({
required BuildContext context,
required String msg,
bool? isSplashScreen,
}) async {
if (msg == "Invalid token") {
final SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.remove(tokenName);
Navigator.pushNamed(context, loginRoute);
if (isSplashScreen != true) {
SanckbarWidget(
context, "Invalid token, please login again", snackbarType.warning);
}
}
}
static setBaseUrl(String text, String? protocol) {
var prt = protocol;
if (protocol == null) {
prt = "https://";
}
// baseUrl = "$protocol//devbandungraya.aplikasi.web.id/one-api/one_mitra/";
// ipAddress = "devbandungraya.aplikasi.web.id";
// protocol = protocol;
baseUrl = "$protocol//$text/one-api/one_mitra/";
ipAddress = text;
print(baseUrl);
}
}

View File

@@ -0,0 +1,7 @@
import 'package:webview_flutter/webview_flutter.dart';
import 'package:webview_flutter_web/webview_flutter_web.dart';
void registerWebViewWebImplementation() {
// WebView.platform = WebWebViewPlatform();
WebViewPlatform.instance = WebWebViewPlatform();
}

View File

@@ -0,0 +1,3 @@
void registerWebViewWebImplementation() {
//
}

106
lib/app/route.dart Normal file
View File

@@ -0,0 +1,106 @@
import 'package:flutter/material.dart';
import 'package:mitra_corporate/screen/home/home_screen.dart';
import 'package:mitra_corporate/screen/loging/loging.dart';
import 'package:mitra_corporate/screen/splash_screen.dart/splash_screen.dart';
import '../screen/login/login_screen.dart';
const loginRoute = "/LoginScreen";
const registrasiPasienRoute = "/RegistrasiPasienScrenn";
const suratJalanRoute = "/SuratJalanScreen";
const suratJalanDetailRoute = "/SuratJalanDetailScreen";
const homeRoute = "/homeRoute";
const dashboardRoute = "/DashboardScreen";
const splashRoute = "/splashRoute";
const logingRoute = "/logingRoute";
class AppRoute {
static Route<dynamic>? generateRoute(RouteSettings settings) {
if (settings.name == loginRoute) {
return MaterialPageRoute(builder: (context) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
padding: const EdgeInsets.all(0),
textScaler: TextScaler.linear(1.0),
),
child: LoginScreen());
});
}
// if (settings.name == dashboardRoute) {
// return MaterialPageRoute(builder: (context) {
// return MediaQuery(
// data: MediaQuery.of(context).copyWith(
// textScaleFactor: 1.0,
// padding: const EdgeInsets.all(0),
// ),
// child: DashboardScreen());
// });
// }
if (settings.name == homeRoute) {
return MaterialPageRoute(builder: (context) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
padding: const EdgeInsets.all(0),
textScaler: TextScaler.linear(1.0),
),
child: HomeScreen());
});
}
// if (settings.name == registrasiPasienRoute) {
// return MaterialPageRoute(builder: (context) {
// return MediaQuery(
// data: MediaQuery.of(context).copyWith(
// textScaleFactor: 1.0,
// padding: const EdgeInsets.all(0),
// ),
// child: const RegistrasiPasienScreen());
// });
// }
// if (settings.name == suratJalanRoute) {
// return MaterialPageRoute(builder: (context) {
// return MediaQuery(
// data: MediaQuery.of(context).copyWith(
// textScaleFactor: 1.0,
// padding: const EdgeInsets.all(0),
// ),
// child: const SuratJalanScreen());
// });
// }
// if (settings.name == suratJalanDetailRoute) {
// return MaterialPageRoute(builder: (context) {
// return MediaQuery(
// data: MediaQuery.of(context).copyWith(
// textScaleFactor: 1.0,
// padding: const EdgeInsets.all(0),
// ),
// child: const SuratJalanDetailScreen());
// });
// }
if (settings.name == splashRoute) {
return MaterialPageRoute(builder: (context) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
padding: const EdgeInsets.all(0),
textScaler: TextScaler.linear(1.0),
),
child: const SplashScreen());
});
}
if (settings.name == logingRoute) {
return MaterialPageRoute(builder: (context) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
padding: const EdgeInsets.all(0),
textScaler: TextScaler.linear(1.0),
),
child: const LogingScreen());
});
}
return null;
}
}