From 783fd124e7af36a3a4c4137c12b9c1dfd07bfd69 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 26 Oct 2025 12:27:41 +0300 Subject: [PATCH] run time changes --- .../widgets/request_category_fragment.dart | 3 ++- lib/extensions/context_extension.dart | 12 ++++++++++++ lib/new_views/common_widgets/app_bottom_nav_bar.dart | 2 +- .../land_page/create_request-type_bottomsheet.dart | 2 +- lib/new_views/pages/login_page.dart | 10 ++++++---- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/dashboard_latest/widgets/request_category_fragment.dart b/lib/dashboard_latest/widgets/request_category_fragment.dart index 95af0330..e1a20b0a 100644 --- a/lib/dashboard_latest/widgets/request_category_fragment.dart +++ b/lib/dashboard_latest/widgets/request_category_fragment.dart @@ -72,8 +72,9 @@ class RequestCategoryFragment extends StatelessWidget { Widget getTabs({required BuildContext context, required DashBoardProvider requestsProvider, required UsersTypes? userType}) { List tabs = CategoryTabs.getTabs(userType: userType ?? UsersTypes.normal_user, context: context); + return SizedBox( - height: 44 + 16, + height: 44 + (context.isTablet() ? 36 : 16), child: ListView.separated( scrollDirection: Axis.horizontal, separatorBuilder: (cxt, index) => 12.width, diff --git a/lib/extensions/context_extension.dart b/lib/extensions/context_extension.dart index 1f36d4ba..3969f65d 100644 --- a/lib/extensions/context_extension.dart +++ b/lib/extensions/context_extension.dart @@ -20,6 +20,18 @@ extension BuildContextExtension on BuildContext { UserProvider get userProvider => Provider.of(this, listen: false); + bool isTablet() { + final mediaQueryData = MediaQuery.of(this); + final double screenWidth = mediaQueryData.size.width; + final double screenHeight = mediaQueryData.size.height; + final double devicePixelRatio = mediaQueryData.devicePixelRatio; + + // You can define your own thresholds for what constitutes a "tablet" + // based on physical size and pixel density. + bool isTablet = (devicePixelRatio < 2 && (screenWidth >= 700 || screenHeight >= 700)) || (devicePixelRatio >= 2 && (screenWidth >= 1000 || screenHeight >= 1000)); + return isTablet; + } + void showConfirmDialog(String message, {String? title, VoidCallback? onTap}) => showDialog( context: this, builder: (BuildContext cxt) => ConfirmDialog(message: message, onTap: onTap, title: title), diff --git a/lib/new_views/common_widgets/app_bottom_nav_bar.dart b/lib/new_views/common_widgets/app_bottom_nav_bar.dart index f1c47f6d..115198e4 100644 --- a/lib/new_views/common_widgets/app_bottom_nav_bar.dart +++ b/lib/new_views/common_widgets/app_bottom_nav_bar.dart @@ -24,7 +24,7 @@ class AppBottomNavigationBar extends StatelessWidget { NavItemModel(1, "request_icon", context.translation.workOrder), //TODO unCommit this to disable task // if (!isEngineer||isUserFMS) - NavItemModel(2, "add_icon", context.translation.calendar, showLabel: false), + NavItemModel(2, "add_icon", context.translation.calendar, showLabel: false), NavItemModel(3, "assets", context.translation.assets), NavItemModel(4, "contact", context.translation.contact), ]; diff --git a/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart b/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart index cca09e6e..2ba89428 100644 --- a/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart +++ b/lib/new_views/pages/land_page/create_request-type_bottomsheet.dart @@ -73,7 +73,7 @@ class CreateRequestTypeBottomSheet extends StatelessWidget { size: 32, ), //24.height, - label.bodyText2(context).custom(color: context.isDark ? Colors.white : AppColor.black20), + label.bodyText2(context).custom(color: context.isDark ? Colors.white : AppColor.black20, fontSize: context.isTablet() ? 10.toScreenWidth : null), ], ), ), diff --git a/lib/new_views/pages/login_page.dart b/lib/new_views/pages/login_page.dart index 35eb9134..8c54e927 100644 --- a/lib/new_views/pages/login_page.dart +++ b/lib/new_views/pages/login_page.dart @@ -110,8 +110,9 @@ class _LoginPageState extends State { backgroundColor: AppColor.fieldBgColor(context), validator: (value) => Validator.hasValue(value!) ? null : context.translation.requiredField, labelText: context.translation.username, - style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), - labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: context.isDark ? Colors.white : const Color(0xff767676)), + style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)), textInputType: TextInputType.text, showWithoutDecoration: true, contentPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 12.toScreenHeight), @@ -125,8 +126,9 @@ class _LoginPageState extends State { showWithoutDecoration: true, labelText: context.translation.password, backgroundColor: AppColor.fieldBgColor(context), - style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), - labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: context.isDark ? Colors.white : const Color(0xff767676)), + style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)), + floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), contentPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 12.toScreenHeight), obscureText: !_passwordVisible, suffixIcon: Icon(