Init core module
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class KeyboardUtils {
|
||||
void hideKeyboard(BuildContext context) {
|
||||
FocusScopeNode currentFocus = FocusScope.of(context);
|
||||
if (!currentFocus.hasPrimaryFocus) {
|
||||
currentFocus.unfocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class ResponsiveUtils {
|
||||
|
||||
static const int _minLargeWidth = 950;
|
||||
static const int _minMediumWidth = 600;
|
||||
|
||||
static const double _loginTextFieldWidthSmallScreen = 280.0;
|
||||
static const double _loginTextFieldWidthLargeScreen = 320.0;
|
||||
static const double _loginButtonWidth = 240.0;
|
||||
|
||||
double getSizeWidthScreen(BuildContext context) {
|
||||
return MediaQuery.of(context).size.width;
|
||||
}
|
||||
|
||||
double getSizeHeightScreen(BuildContext context) {
|
||||
return MediaQuery.of(context).size.height;
|
||||
}
|
||||
|
||||
bool isLargeScreen(BuildContext context) {
|
||||
return getSizeWidthScreen(context) >= _minLargeWidth;
|
||||
}
|
||||
|
||||
bool isSmallScreen(BuildContext context) {
|
||||
return getSizeWidthScreen(context) < _minMediumWidth;
|
||||
}
|
||||
|
||||
bool isMediumScreen(BuildContext context) {
|
||||
return getSizeWidthScreen(context) >= _minMediumWidth && getSizeWidthScreen(context) < _minLargeWidth;
|
||||
}
|
||||
|
||||
double getWidthLoginTextField(BuildContext context) => isSmallScreen(context)
|
||||
? _loginTextFieldWidthSmallScreen
|
||||
: _loginTextFieldWidthLargeScreen;
|
||||
|
||||
double getWidthLoginButton() => _loginButtonWidth;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CommonTextStyle {
|
||||
static final textStyleNormal = TextStyle(
|
||||
color: AppColor.primaryColor,
|
||||
fontSize: 14,
|
||||
fontStyle: FontStyle.normal,
|
||||
fontWeight: FontWeight.normal,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:core/presentation/constants/constants_ui.dart';
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
ThemeData appTheme() {
|
||||
return ThemeData(
|
||||
scaffoldBackgroundColor: Colors.white,
|
||||
fontFamily: ConstantsUI.fontApp,
|
||||
appBarTheme: appBarTheme(),
|
||||
textTheme: textTheme(),
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
);
|
||||
}
|
||||
|
||||
InputDecorationTheme inputDecorationTheme() {
|
||||
OutlineInputBorder outlineInputBorder = OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
borderSide: BorderSide(color: AppColor.baseTextColor),
|
||||
gapPadding: 10,
|
||||
);
|
||||
return InputDecorationTheme(
|
||||
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 42, vertical: 20),
|
||||
enabledBorder: outlineInputBorder,
|
||||
focusedBorder: outlineInputBorder,
|
||||
border: outlineInputBorder,
|
||||
);
|
||||
}
|
||||
|
||||
TextTheme textTheme() {
|
||||
return TextTheme(
|
||||
bodyText1: TextStyle(color: AppColor.baseTextColor),
|
||||
bodyText2: TextStyle(color: AppColor.baseTextColor),
|
||||
);
|
||||
}
|
||||
|
||||
AppBarTheme appBarTheme() {
|
||||
return AppBarTheme(
|
||||
color: Colors.white,
|
||||
elevation: 0,
|
||||
brightness: Brightness.light,
|
||||
iconTheme: IconThemeData(color: Colors.black),
|
||||
textTheme: TextTheme(
|
||||
headline6: TextStyle(color: Color(0XFF8B8B8B), fontSize: 18),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user