ui improvements

pull/174/head
Sikander Saleem 3 months ago
parent 41a4005d41
commit 6e1eb0d0bb

@ -4,8 +4,11 @@ import 'dart:math' as math;
import 'package:flutter/material.dart'; // These are the Viewport values of your Figma Design. import 'package:flutter/material.dart'; // These are the Viewport values of your Figma Design.
// These are used in the code as a reference to create your UI Responsively. // These are used in the code as a reference to create your UI Responsively.
const num figmaDesignWidth = 430; // iPhone X / 12 base width, const num figmaDesignWidth = 430; // iPhone X / 12 base width, 375
const num figmaDesignHeight = 927; // iPhone X / 12 base height const num figmaDesignHeight = 927; // iPhone X / 12 base height 812
const num figmaDesignWidthTF = 375;
const num figmaDesignHeightTF = 812;
extension ConstrainedResponsive on num { extension ConstrainedResponsive on num {
/// Width with max cap for tablets /// Width with max cap for tablets
@ -50,9 +53,9 @@ extension ResponsiveExtension on num {
double get w { double get w {
double baseScale = (this * _screenWidth) / figmaDesignWidth; double baseScale = (this * _screenWidth) / figmaDesignWidth;
if (_isFoldable) { if (_isFoldable|| isTablet ) {
// For foldables, use more conservative width scaling // For foldables, use more conservative width scaling
double scale = _screenWidth / figmaDesignWidth; double scale = _screenWidth / figmaDesignWidthTF;
scale = scale.clamp(0.8, 1.4); scale = scale.clamp(0.8, 1.4);
return this * scale; return this * scale;
} }
@ -64,9 +67,9 @@ extension ResponsiveExtension on num {
double get h { double get h {
double baseScale = (this * _screenHeight) / figmaDesignHeight; double baseScale = (this * _screenHeight) / figmaDesignHeight;
if (_isFoldable) { if (_isFoldable || isTablet ) {
// For foldables, use height-based scaling but with constraints // For foldables, use height-based scaling but with constraints
double scale = (_screenHeight / figmaDesignHeight).clamp(0.8, 1.4); double scale = (_screenHeight / figmaDesignHeightTF).clamp(0.8, 1.4);
return this * scale; return this * scale;
} }
@ -79,7 +82,7 @@ extension ResponsiveExtension on num {
if (_isFoldable || isTablet) { if (_isFoldable || isTablet) {
// Use the same logic as enhanced width for foldables // Use the same logic as enhanced width for foldables
double scale = _screenWidth / figmaDesignWidth; double scale = _screenWidth / figmaDesignWidthTF;
scale = scale.clamp(0.8, 1.4); scale = scale.clamp(0.8, 1.4);
return this * scale; return this * scale;
} }

@ -1,8 +1,10 @@
import 'dart:io'; import 'dart:io';
import 'package:device_preview/device_preview.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
@ -89,7 +91,9 @@ Future<void> callInitializations() async {
void main() async { void main() async {
await callInitializations(); await callInitializations();
runApp( runApp(
EasyLocalization( DevicePreview(
enabled: false,
builder: (context) => EasyLocalization(
supportedLocales: const <Locale>[ supportedLocales: const <Locale>[
Locale('en', 'US'), Locale('en', 'US'),
Locale('ar', 'SA'), Locale('ar', 'SA'),
@ -203,6 +207,7 @@ void main() async {
create: (_) => getIt.get<AskDoctorViewModel>(), create: (_) => getIt.get<AskDoctorViewModel>(),
) )
], child: MyApp()), ], child: MyApp()),
), // Wrap your app
), ),
); );
} }
@ -243,4 +248,3 @@ class MyApp extends StatelessWidget {
} }
} }
// flutter pub run easy_localization:generate -S assets/langs -f keys -o locale_keys.g.dart // flutter pub run easy_localization:generate -S assets/langs -f keys -o locale_keys.g.dart

@ -299,9 +299,9 @@ class _LandingPageState extends State<LandingPage> {
backgroundColor: Color(0xFF2B353E), backgroundColor: Color(0xFF2B353E),
borderColor: Color(0xFF2B353E), borderColor: Color(0xFF2B353E),
textColor: AppColors.whiteColor, textColor: AppColors.whiteColor,
fontSize: 14, fontSize: 14.f,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
borderRadius: 12, borderRadius: 12.r,
height: 40.h, height: 40.h,
), ),
], ],

@ -1,4 +1,3 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -69,7 +68,7 @@ class CollapsingListView extends StatelessWidget {
automaticallyImplyLeading: isLeading, automaticallyImplyLeading: isLeading,
pinned: true, pinned: true,
toolbarHeight: 40.h, toolbarHeight: 40.h,
leadingWidth: isLeading ? null : double.infinity, leadingWidth: isLeading ? 40.w + 32.w : double.infinity,
systemOverlayStyle: SystemUiOverlayStyle(statusBarBrightness: Brightness.light), systemOverlayStyle: SystemUiOverlayStyle(statusBarBrightness: Brightness.light),
surfaceTintColor: Colors.transparent, surfaceTintColor: Colors.transparent,
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
@ -93,23 +92,22 @@ class CollapsingListView extends StatelessWidget {
// : null, // : null,
leading: Visibility( leading: Visibility(
visible: isLeading, visible: isLeading,
child: Container(
height: 32.h,
width: 32.w,
alignment: appState.isArabic() ? Alignment.centerRight : Alignment.centerLeft,
margin: EdgeInsets.fromLTRB(24.w, 0, 24.w, 0),
child: Transform.flip( child: Transform.flip(
flipX: appState.isArabic(), flipX: appState.isArabic(),
child: IconButton( child: Utils.buildSvgWithAssets(icon: isClose ? AppAssets.close_bottom_nav_trans : AppAssets.arrow_back_new, width: 24.h, height: 24.h),
icon: Utils.buildSvgWithAssets(icon: isClose ? AppAssets.close_bottom_nav_trans : AppAssets.arrow_back_new, width: 24.h, height: 24.h), ),
padding: EdgeInsets.zero, ).onPress(() {
constraints: BoxConstraints(),
style: const ButtonStyle(tapTargetSize: MaterialTapTargetSize.shrinkWrap),
onPressed: () {
if (leadingCallback != null) { if (leadingCallback != null) {
leadingCallback!(); leadingCallback!();
} else { } else {
context.pop(); context.pop();
} }
}, }),
highlightColor: Colors.transparent,
),
),
) )
// : ScrollAnimatedTitle( // : ScrollAnimatedTitle(
// title: title, // title: title,
@ -218,7 +216,7 @@ class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget
}); });
@override @override
Size get preferredSize => const Size.fromHeight(50.0); Size get preferredSize => const Size.fromHeight(56.0);
@override @override
State<ScrollAnimatedTitle> createState() => _ScrollAnimatedTitleState(); State<ScrollAnimatedTitle> createState() => _ScrollAnimatedTitleState();
@ -265,7 +263,7 @@ class _ScrollAnimatedTitleState extends State<ScrollAnimatedTitle> {
final isRtl = Directionality.of(context) == TextDirection.RTL; final isRtl = Directionality.of(context) == TextDirection.RTL;
return Container( return Container(
// height: (widget.preferredSize.height - _fontSize / 2).h, // height: (widget.preferredSize.height - _fontSize / 2).h,
height: 60.h, height: 56.h,
alignment: isRtl ? (widget.showBack ? Alignment.topRight : Alignment.centerRight) : (widget.showBack ? Alignment.topLeft : Alignment.centerLeft), alignment: isRtl ? (widget.showBack ? Alignment.topRight : Alignment.centerRight) : (widget.showBack ? Alignment.topLeft : Alignment.centerLeft),
padding: EdgeInsets.fromLTRB(24.w, 0, 24.w, 0), padding: EdgeInsets.fromLTRB(24.w, 0, 24.w, 0),
child: Row( child: Row(

@ -83,6 +83,7 @@ dependencies:
open_filex: ^4.7.0 open_filex: ^4.7.0
flutter_swiper_view: ^1.1.8 flutter_swiper_view: ^1.1.8
flutter_callkit_incoming: ^3.0.0 flutter_callkit_incoming: ^3.0.0
device_preview: ^1.3.1
location: ^8.0.1 location: ^8.0.1
gms_check: ^1.0.4 gms_check: ^1.0.4

Loading…
Cancel
Save