step 3 : login proses
This commit is contained in:
5
lib/app/app_extension.dart
Normal file
5
lib/app/app_extension.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
|
||||
String formatDateJiffy(String serverDate) {
|
||||
return Jiffy.parse(serverDate).format(pattern: 'dd-MM-yyyy');
|
||||
}
|
||||
101
lib/app/constant.dart
Normal file
101
lib/app/constant.dart
Normal file
@@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Constant {
|
||||
// static double designHeight = 1024;
|
||||
// static double designWidth = 1440;
|
||||
|
||||
// base url
|
||||
static String baseURL = "http://devone.aplikasi.web.id/";
|
||||
|
||||
static String bearerName = "scan-ktp";
|
||||
|
||||
static double designHeightPhone = 844;
|
||||
static double designWidthPhone = 390;
|
||||
|
||||
// color theme
|
||||
static Color inputanGrey = const Color(0xff637381);
|
||||
static Color bgButton = const Color(0xFF0098DA);
|
||||
static Color bgRed = const Color(0xffFF4842).withOpacity(0.08);
|
||||
static Color bgGrey = const Color(0xffF9F9F9);
|
||||
static Color bgBlue = Colors.blue;
|
||||
static Color bgIcon = const Color(0xffA8CF45);
|
||||
static Color textCardGrey = const Color.fromRGBO(0, 0, 0, 0.60);
|
||||
|
||||
static Color textBlack = const Color(0xff212B36);
|
||||
static Color textWhite = Color(0xffFDFDFD);
|
||||
static Color textRed = Color(0xffFF4842);
|
||||
// background upload file
|
||||
static Color bgUploadFile = Color.fromRGBO(207, 207, 207, 0.20);
|
||||
|
||||
// size convertion
|
||||
static double getActualXPhone({
|
||||
required BuildContext context,
|
||||
required double x,
|
||||
}) {
|
||||
return x / designWidthPhone * MediaQuery.of(context).size.width;
|
||||
}
|
||||
|
||||
static double getActualYPhone({
|
||||
required BuildContext context,
|
||||
required double y,
|
||||
}) {
|
||||
return y / designHeightPhone * MediaQuery.of(context).size.height;
|
||||
}
|
||||
|
||||
// typography
|
||||
static TextStyle titleRiwayat({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 20),
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle cardText({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 14),
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle title_700({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 36),
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle title_400({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 16),
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titleInputan500({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 16),
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titlePosisiHP({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 18),
|
||||
fontWeight: FontWeight.normal,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titleInputan600({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 16),
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titleButton500({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 15),
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
}
|
||||
}
|
||||
57
lib/app/route.dart
Normal file
57
lib/app/route.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../screen/home/home_screen.dart';
|
||||
import '../screen/login/login_screen.dart';
|
||||
import '../screen/splash/splash_screen.dart';
|
||||
|
||||
const splashRoute = "/splashRoute";
|
||||
const loginRoute = "/loginRoute";
|
||||
const homeRoute = "/homeRoute";
|
||||
const scanRoute = "/scanRoute";
|
||||
const editScanRoute = "/editScanRoute";
|
||||
|
||||
class AppRoute {
|
||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||
// splash screen
|
||||
if (settings.name == splashRoute) {
|
||||
return MaterialPageRoute(builder: (context) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaler: TextScaler.linear(1.0), padding: EdgeInsets.all(0)),
|
||||
child: SplashScreen(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// login screen
|
||||
if (settings.name == loginRoute) {
|
||||
return MaterialPageRoute(builder: (context) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaler: TextScaler.linear(1.0), padding: EdgeInsets.all(0)),
|
||||
child: LoginScreen(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// home screen
|
||||
if (settings.name == homeRoute) {
|
||||
return MaterialPageRoute(builder: (context) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaler: TextScaler.linear(1.0), padding: EdgeInsets.all(0)),
|
||||
child: HomeScreen(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return MaterialPageRoute(builder: (context) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
padding: const EdgeInsets.all(0),
|
||||
textScaler: TextScaler.linear(1.0)),
|
||||
child: SplashScreen(),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user