mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 01:47:41 +00:00
affc35f335
* Add iPad responsive layout * Set magic number to position input field on wider screens * Adjust screen resolution * Update target device family for ios * Add icons for iPad * Revert width adjustment for ipad * Fix overflowing balance * Fix overflowing balance * Fix PR issues * Remove unused icons [skip ci] --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ResponsiveLayoutUtil {
|
|
static const double _kMobileThreshold = 768;
|
|
static const double kDesktopMaxWidthConstraint = 400;
|
|
static const double kPopupWidth = 400;
|
|
static const double kPopupSpaceHeight = 100;
|
|
static const _kIpadMaxWidth = 2560.0;
|
|
|
|
const ResponsiveLayoutUtil._();
|
|
|
|
static final instance = ResponsiveLayoutUtil._();
|
|
|
|
bool get isMobile =>
|
|
WidgetsBinding.instance.platformDispatcher.views.first.physicalSize.width < _kMobileThreshold;
|
|
|
|
bool get isIpad {
|
|
final width = WidgetsBinding.instance.platformDispatcher.views.first.physicalSize.width;
|
|
return width >= _kMobileThreshold && !(width > _kIpadMaxWidth);
|
|
}
|
|
|
|
/// Returns dynamic size.
|
|
///
|
|
/// If screen size is mobile, it returns 66% ([scale]) of the [originalValue].
|
|
double getDynamicSize(
|
|
double originalValue, {
|
|
double? mobileSize,
|
|
double? scale,
|
|
}) {
|
|
scale ??= 2 / 3;
|
|
mobileSize ??= originalValue * scale;
|
|
final value = isMobile ? mobileSize : originalValue;
|
|
|
|
return value.roundToDouble();
|
|
}
|
|
}
|