diff --git a/lib/dashboard_latest/widgets/app_bar_widget.dart b/lib/dashboard_latest/widgets/app_bar_widget.dart index f65ed034..2ec335be 100644 --- a/lib/dashboard_latest/widgets/app_bar_widget.dart +++ b/lib/dashboard_latest/widgets/app_bar_widget.dart @@ -48,11 +48,11 @@ class AppBarWidget extends StatelessWidget { children: [ Text( snapshot.user?.username ?? "", // Simplified null check - style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontWeight: FontWeight.w600), + style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontWeight: FontWeight.w600, fontSize: context.isTablet() ? 14 : null), ), Text( snapshot.user?.type?.name.toCamelCase ?? "", // Simplified null check - style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20), + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20, fontSize: context.isTablet() ? 12 : null), ), ], ), diff --git a/lib/dashboard_latest/widgets/request_category_fragment.dart b/lib/dashboard_latest/widgets/request_category_fragment.dart index 95af0330..0736fe80 100644 --- a/lib/dashboard_latest/widgets/request_category_fragment.dart +++ b/lib/dashboard_latest/widgets/request_category_fragment.dart @@ -73,7 +73,7 @@ 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..85299f73 100644 --- a/lib/extensions/context_extension.dart +++ b/lib/extensions/context_extension.dart @@ -19,7 +19,14 @@ extension BuildContextExtension on BuildContext { SettingProvider get settingProvider => Provider.of(this, listen: false); 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; + 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_text_form_field.dart b/lib/new_views/common_widgets/app_text_form_field.dart index 2434230c..02cb825b 100644 --- a/lib/new_views/common_widgets/app_text_form_field.dart +++ b/lib/new_views/common_widgets/app_text_form_field.dart @@ -25,6 +25,7 @@ class AppTextFormField extends StatefulWidget { final TextStyle? style; final TextStyle? labelStyle; final TextStyle? hintStyle; + final TextStyle? floatingLabelStyle; final bool enable; final TextAlign? textAlign; final FocusNode? node; @@ -58,6 +59,7 @@ class AppTextFormField extends StatefulWidget { this.hintText, this.labelText, this.hintStyle, + this.floatingLabelStyle, this.textInputType = TextInputType.text, this.initialValue, // Provide default value this.enable = true, @@ -183,12 +185,16 @@ class _AppTextFormFieldState extends State { onChanged: widget.onChange, obscureText: widget.obscureText ?? false, keyboardType: widget.textInputType, - maxLines: widget.makeMultiLinesNull ? null:widget.textInputType == TextInputType.multiline ? 4 : 1, + maxLines: widget.makeMultiLinesNull + ? null + : widget.textInputType == TextInputType.multiline + ? 4 + : 1, obscuringCharacter: "*", controller: widget.controller, textInputAction: widget.textInputType == TextInputType.multiline ? null : widget.textInputAction ?? TextInputAction.next, onEditingComplete: widget.onAction ?? () => FocusScope.of(context).nextFocus(), - style: widget.style ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500,color:context.isDark?AppColor.white10: AppColor.black10), + style: widget.style ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.black10), onTap: widget.onTap, decoration: InputDecoration( alignLabelWithHint: widget.alignLabelWithHint, @@ -208,9 +214,12 @@ class _AppTextFormFieldState extends State { ? (widget.enableColor ?? AppColor.neutral40) : AppColor.background(context)), errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60), - floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20), + floatingLabelStyle: widget.floatingLabelStyle ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20), hintText: widget.hintText ?? "", - labelText: (widget.showSpeechToText && _speechToText.isListening) ? "Listening..." : widget.labelText ?? "", + // labelText: (widget.showSpeechToText && _speechToText.isListening) ? "Listening..." : widget.labelText ?? "", + label: Text( + (widget.showSpeechToText && _speechToText.isListening) ? "Listening..." : widget.labelText ?? "", + ), labelStyle: widget.labelStyle, hintStyle: widget.labelStyle, prefixIcon: widget.prefixIcon ?? 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 edd2ba89..20478b13 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 @@ -72,7 +72,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(