login
This commit is contained in:
@@ -28,6 +28,8 @@ class ApiClient {
|
||||
ApiClient(this._dio, this._env) {
|
||||
_dio.options.baseUrl = _env.baseUrl;
|
||||
_dio.options.connectTimeout = const Duration(seconds: 20);
|
||||
_dio.options.validateStatus = (status) =>
|
||||
status != null && status >= 200 && status < 500;
|
||||
_dio.interceptors.add(BadNetworkErrorInterceptor());
|
||||
_dio.interceptors.add(BadRequestErrorInterceptor());
|
||||
_dio.interceptors.add(InternalServerErrorInterceptor());
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
class AppConstant {
|
||||
static const String appName = "";
|
||||
static const String appName = "Apskel POS";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class LocalStorageKey {
|
||||
static const String token = 'token';
|
||||
static const String user = 'user';
|
||||
}
|
||||
@@ -1,46 +1,66 @@
|
||||
part of 'theme.dart';
|
||||
|
||||
class AppColor {
|
||||
/// primary = #3949AB
|
||||
static const Color primary = Color(0xff36175e);
|
||||
// Primary Colors
|
||||
static const Color primary = Color(0xFF36175e);
|
||||
static const Color primaryLight = Color(0xFF5a2d85);
|
||||
static const Color primaryDark = Color(0xFF1e0d35);
|
||||
|
||||
/// grey = #B7B7B7
|
||||
static const Color grey = Color(0xffB7B7B7);
|
||||
// Secondary Colors
|
||||
static const Color secondary = Color(0xFF4CAF50);
|
||||
static const Color secondaryLight = Color(0xFF81C784);
|
||||
static const Color secondaryDark = Color(0xFF388E3C);
|
||||
|
||||
/// light = #F8F5FF
|
||||
static const Color light = Color(0xffF8F5FF);
|
||||
// Background Colors
|
||||
static const Color background = Color(0xFFF8F9FA);
|
||||
static const Color backgroundLight = Color(0xFFFFFFFF);
|
||||
static const Color backgroundDark = Color(0xFF1A1A1A);
|
||||
static const Color surface = Color(0xFFFFFFFF);
|
||||
static const Color surfaceDark = Color(0xFF2D2D2D);
|
||||
|
||||
/// blueLight = #C7D0EB
|
||||
static const Color blueLight = Color(0xffC7D0EB);
|
||||
// Text Colors
|
||||
static const Color textPrimary = Color(0xFF212121);
|
||||
static const Color textSecondary = Color(0xFF757575);
|
||||
static const Color textLight = Color(0xFFBDBDBD);
|
||||
static const Color textWhite = Color(0xFFFFFFFF);
|
||||
|
||||
/// black = #000000
|
||||
static const Color black = Color(0xff000000);
|
||||
// Status Colors
|
||||
static const Color success = Color(0xFF4CAF50);
|
||||
static const Color error = Color(0xFFE53E3E);
|
||||
static const Color warning = Color(0xFFFF9800);
|
||||
static const Color info = Color(0xFF2196F3);
|
||||
|
||||
/// white = #FFFFFF
|
||||
static const Color white = Color(0xffFFFFFF);
|
||||
static const Color whiteText = Color(0xfff1eaf9);
|
||||
// Border Colors
|
||||
static const Color border = Color(0xFFE0E0E0);
|
||||
static const Color borderLight = Color(0xFFF0F0F0);
|
||||
static const Color borderDark = Color(0xFFBDBDBD);
|
||||
|
||||
/// green = #50C474
|
||||
static const Color green = Color(0xff50C474);
|
||||
// Basic Color
|
||||
static const Color white = Color(0xFFFFFFFF);
|
||||
static const Color black = Color(0xFF000000);
|
||||
|
||||
/// red = #F4261A
|
||||
static const Color red = Color(0xffF4261A);
|
||||
// Gradient Colors
|
||||
static const List<Color> primaryGradient = [
|
||||
Color(0xFF36175e),
|
||||
Color(0xFF5a2d85),
|
||||
];
|
||||
|
||||
/// card = #E5E5E5
|
||||
static const Color card = Color(0xffE5E5E5);
|
||||
static const List<Color> successGradient = [
|
||||
Color(0xFF4CAF50),
|
||||
Color(0xFF81C784),
|
||||
];
|
||||
|
||||
/// disabled = #C8D1E1
|
||||
static const Color disabled = Color(0xffC8D1E1);
|
||||
static const List<Color> backgroundGradient = [
|
||||
Color(0xFFF5F5F5),
|
||||
Color(0xFFE8E8E8),
|
||||
];
|
||||
|
||||
/// subtitle = #7890CD
|
||||
static const Color subtitle = Color(0xff7890CD);
|
||||
|
||||
/// stroke = #EFF0F6
|
||||
static const Color stroke = Color(0xffEFF0F6);
|
||||
|
||||
static const Color background = Color.fromARGB(255, 241, 241, 241);
|
||||
|
||||
static const Color primaryLight = Color(0xFF5A3E8A);
|
||||
static const Color greyLight = Color(0xFFE0E0E0);
|
||||
static const Color greyDark = Color(0xFF707070);
|
||||
// Opacity Variations
|
||||
static Color primaryWithOpacity(double opacity) =>
|
||||
primary.withOpacity(opacity);
|
||||
static Color successWithOpacity(double opacity) =>
|
||||
success.withOpacity(opacity);
|
||||
static Color errorWithOpacity(double opacity) => error.withOpacity(opacity);
|
||||
static Color warningWithOpacity(double opacity) =>
|
||||
warning.withOpacity(opacity);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
part of 'theme.dart';
|
||||
|
||||
class AppStyle {
|
||||
// TODO: define style
|
||||
static TextStyle xs = TextStyle(color: AppColor.black, fontSize: 11);
|
||||
|
||||
static TextStyle sm = TextStyle(color: AppColor.black, fontSize: 12);
|
||||
|
||||
static TextStyle md = TextStyle(color: AppColor.black, fontSize: 14);
|
||||
|
||||
static TextStyle lg = TextStyle(color: AppColor.black, fontSize: 16);
|
||||
|
||||
static TextStyle xl = TextStyle(color: AppColor.black, fontSize: 18);
|
||||
|
||||
static TextStyle xxl = TextStyle(color: AppColor.black, fontSize: 20);
|
||||
|
||||
static TextStyle h6 = TextStyle(color: AppColor.black, fontSize: 22);
|
||||
|
||||
static TextStyle h5 = TextStyle(color: AppColor.black, fontSize: 24);
|
||||
|
||||
static TextStyle h4 = TextStyle(color: AppColor.black, fontSize: 26);
|
||||
|
||||
static TextStyle h3 = TextStyle(color: AppColor.black, fontSize: 28);
|
||||
|
||||
static TextStyle h2 = TextStyle(color: AppColor.black, fontSize: 30);
|
||||
|
||||
static TextStyle h1 = TextStyle(color: AppColor.black, fontSize: 32);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ class ThemeApp {
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: AppColor.primary),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
hintStyle: const TextStyle(color: AppColor.grey),
|
||||
hintStyle: const TextStyle(color: AppColor.textSecondary),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide(color: AppColor.primary),
|
||||
borderSide: BorderSide(color: AppColor.borderDark),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
@@ -36,7 +36,11 @@ class ThemeApp {
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide(color: AppColor.primary),
|
||||
borderSide: BorderSide(color: AppColor.borderDark),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide(color: AppColor.error),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class ApiPath {
|
||||
static const String login = '/api/v1/auth/login';
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
class AppValidator {
|
||||
static String? validateEmail(String? value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Email wajib diisi';
|
||||
}
|
||||
final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||
if (!emailRegex.hasMatch(value)) {
|
||||
return 'Format email tidak valid';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static String? validatePassword(String? value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Password wajib diisi';
|
||||
}
|
||||
if (value.length < 8) {
|
||||
return 'Password minimal 8 karakter';
|
||||
}
|
||||
// if (!RegExp(r'[A-Z]').hasMatch(value)) {
|
||||
// return 'Password harus mengandung huruf besar';
|
||||
// }
|
||||
// if (!RegExp(r'[0-9]').hasMatch(value)) {
|
||||
// return 'Password harus mengandung angka';
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user