step 3 : buat screen splash screen
This commit is contained in:
213
lib/app/constant.dart
Normal file
213
lib/app/constant.dart
Normal file
@@ -0,0 +1,213 @@
|
||||
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 textTrueBlack = const Color(0xff000000);
|
||||
static Color textBlack = const Color(0xff212B36);
|
||||
static Color textLightGrey = const Color(0xff919EAB);
|
||||
static Color textOrange = const Color(0xffF15A29);
|
||||
static Color textDarkGrey = const Color(0xff637381);
|
||||
static Color bgAddressPresensi = const Color.fromRGBO(241, 90, 41, 0.08);
|
||||
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 titleH1_700({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 24),
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titleH2_600({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 12),
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle logintitle_700({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 15),
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titleH2_400_12({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 12),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontFamily: 'Public Sans');
|
||||
}
|
||||
|
||||
static TextStyle titleH2_600_14({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 14),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Public Sans');
|
||||
}
|
||||
|
||||
static TextStyle titleH2_400_14({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 14),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontFamily: 'Public Sans');
|
||||
}
|
||||
|
||||
static TextStyle titleH1_500_18({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 18),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Public Sans');
|
||||
}
|
||||
|
||||
static TextStyle titleH1_700_18({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 18),
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: 'Public Sans');
|
||||
}
|
||||
|
||||
static TextStyle titleH2_700({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontFamily: 'Quicksand',
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 14),
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titleH3_700({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontFamily: 'Quicksand',
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 16),
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titleH2_500({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontFamily: 'Quicksand',
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 12),
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titleH2_400({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontFamily: 'Public Sans',
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 12),
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle titlePresensiH2_700({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontFamily: 'Quicksand',
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 24),
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle time_700({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 28),
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: 'Quicksand',
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle subtitle_600_14({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 14),
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: 'Public Sans',
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle subtitle_500_12({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 12),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Public Sans',
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle date_600({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 16),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Quicksand',
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle title_screen({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 24),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Public Sans',
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle body_16({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 16),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Public Sans',
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle body_14({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 14),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Public Sans',
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle body_12({required BuildContext context}) {
|
||||
return TextStyle(
|
||||
fontSize: Constant.getActualYPhone(context: context, y: 12),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Public Sans',
|
||||
);
|
||||
}
|
||||
|
||||
static Color primaryBlue = const Color(0xff0C53B7);
|
||||
static Color bgBlue = const Color(0xff1890FF).withOpacity(0.16);
|
||||
static Color primaryOrange = const Color(0xffF15A29);
|
||||
static Color bgOrange = const Color(0xffF15A29).withOpacity(0.16);
|
||||
static Color secondaryBlue = const Color(0xff43ADA5);
|
||||
static Color bgSecondaryBlue = const Color(0xff43ADA5).withOpacity(0.16);
|
||||
static Color primaryGreen = const Color(0xff229A16);
|
||||
static Color bgGreen = const Color(0xff54D62C).withOpacity(0.08);
|
||||
static Color primaryRed = const Color(0xffB72136);
|
||||
static Color bgRed = const Color(0xffFF4842).withOpacity(0.08);
|
||||
}
|
||||
28
lib/app/route.dart
Normal file
28
lib/app/route.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../screen/splash_screen.dart';
|
||||
|
||||
const splashRoute = "/splashRoute";
|
||||
|
||||
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(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
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