修复:大量的ScreenUtil误用,导致界面可能出现问题

(cherry picked from commit 2829da5267a14a9e0f43ff56060a68f1f8b2ca6a)
This commit is contained in:
2025-11-01 04:32:01 -07:00
committed by speakeloudest
parent 18ec3e36fc
commit b7a78aa76a
13 changed files with 79 additions and 79 deletions
@@ -77,7 +77,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
children: [
Padding(
padding:
EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w),
EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
child: const KRHomeConnectionOptionsView(),
),
],
@@ -118,7 +118,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
// 4. 连接选项(分组和国家入口)
Padding(
padding:
EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w),
EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
child: const KRHomeConnectionOptionsView(),
),
],
@@ -144,7 +144,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
Widget _kr_buildErrorView(BuildContext context) {
return Container(
height: 200.w,
height: 200.h,
padding: EdgeInsets.all(16.w),
child: Center(
child: Column(
@@ -155,7 +155,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
size: 48.w,
color: Theme.of(context).colorScheme.error,
),
SizedBox(height: 16.w),
SizedBox(height: 16.h),
Text(
AppTranslations.kr_home.error,
style: KrAppTextStyle(
@@ -164,7 +164,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
color: Theme.of(context).textTheme.bodyMedium?.color,
),
),
SizedBox(height: 8.w),
SizedBox(height: 8.h),
Text(
AppTranslations.kr_home.checkNetwork,
style: KrAppTextStyle(
@@ -172,7 +172,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
color: Theme.of(context).textTheme.bodySmall?.color,
),
),
SizedBox(height: 24.w),
SizedBox(height: 24.h),
SizedBox(
width: 200.w,
height: 44.h,
@@ -26,7 +26,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w),
width: double.infinity,
height: 116.w,
height: 116.h,
decoration: ShapeDecoration(
color: Theme.of(context).cardColor,
shape: RoundedRectangleBorder(
@@ -73,7 +73,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
),
],
),
SizedBox(height: 10.w),
SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -99,7 +99,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
fontWeight: FontWeight.w500,
),
),
SizedBox(height: 6.w),
SizedBox(height: 6.h),
Row(
children: [
Obx(() {
@@ -26,7 +26,7 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
color: Theme.of(context).textTheme.bodyMedium?.color,
),
),
SizedBox(height: 8.w),
SizedBox(height: 8.h),
_buildConnectionOption(
"home_ct",
AppTranslations.kr_home.countryRegion,
@@ -66,7 +66,7 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
height: 32.w,
color: Theme.of(context).textTheme.bodyMedium?.color,
),
SizedBox(height: 12.w),
SizedBox(height: 12.h),
Row(
children: [
Expanded(
@@ -64,7 +64,7 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
),
// 倒计时显示
SizedBox(height: 10.w),
SizedBox(height: 10.h),
Row(
children: [
Container(
@@ -123,7 +123,7 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
?.color,
),
),
SizedBox(height: 4.w),
SizedBox(height: 4.h),
Text(
AppTranslations.kr_home.subscriptionEndMessage,
style: KrAppTextStyle(
@@ -71,7 +71,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
Widget _buildServerList(BuildContext context) {
return Container(
width: ScreenUtil().screenWidth,
height: 360.w, // 减小高度比例
height: 360.h, // 减小高度比例
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
@@ -83,7 +83,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
children: [
// 标题栏
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w),
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -221,7 +221,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
country.isExpand.value = !country.isExpand.value;
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 12.w),
padding: EdgeInsets.symmetric(vertical: 12.h),
child: Row(
children: [
KRCountryFlag(
@@ -302,7 +302,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 8.w,
vertical: 8.h,
horizontal: 16.w,
),
decoration: BoxDecoration(
@@ -397,7 +397,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 4.w),
padding: EdgeInsets.symmetric(vertical: 4.h),
child: _kr_buildNodeListItem(
context,
item: server,
@@ -444,13 +444,13 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
onClose: () =>
controller.kr_currentListStatus.value = KRHomeViewsListStatus.kr_none,
),
SizedBox(height: 16.w),
SizedBox(height: 16.h),
Expanded(
child: Column(
children: [
Expanded(child: listContent),
// 添加底部间距
SizedBox(height: 12.w),
SizedBox(height: 12.h),
],
),
),
@@ -544,7 +544,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
return Container(
key: ValueKey(item.id),
padding: EdgeInsets.symmetric(vertical: 8.w),
padding: EdgeInsets.symmetric(vertical: 8.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -575,7 +575,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
? Container(
margin: EdgeInsets.only(left: 4.w),
padding: EdgeInsets.symmetric(
horizontal: 4.w, vertical: 1.w),
horizontal: 4.w, vertical: 1.h),
decoration: BoxDecoration(
color: krModernGreenLight.withOpacity(0.1),
borderRadius: BorderRadius.circular(4.w),
@@ -593,7 +593,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
),
],
),
SizedBox(height: 2.w),
SizedBox(height: 2.h),
Text(
item.city,
style: KrAppTextStyle(
@@ -666,7 +666,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
InkWell(
onTap: () => controller.kr_urlTest(),
child: Container(
padding: EdgeInsets.symmetric(vertical: 8.w),
padding: EdgeInsets.symmetric(vertical: 8.h),
margin: EdgeInsets.only(top: 8.w), // 添加上方间距
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@@ -719,7 +719,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
),
),
if (!controller.kr_isLatency.value) ...[
SizedBox(height: 2.w),
SizedBox(height: 2.h),
Text(
AppTranslations.kr_home.refreshLatencyDesc,
style: KrAppTextStyle(
@@ -766,7 +766,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 8.w),
padding: EdgeInsets.symmetric(vertical: 8.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -801,7 +801,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
Container(
margin: EdgeInsets.only(left: 4.w),
padding: EdgeInsets.symmetric(
horizontal: 4.w, vertical: 1.w),
horizontal: 4.w, vertical: 1.h),
decoration: BoxDecoration(
color:
krModernGreenLight.withOpacity(0.1),
@@ -818,7 +818,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
),
],
),
SizedBox(height: 2.w),
SizedBox(height: 2.h),
Obx(() {
// 获取当前自动选择的节点
String selectedNode =
@@ -920,7 +920,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 4.w),
padding: EdgeInsets.symmetric(vertical: 4.h),
child: _kr_buildNodeListItem(
context,
item: node,
@@ -65,7 +65,7 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
),
// 倒计时显示
SizedBox(height: 10.w),
SizedBox(height: 10.h),
Row(
children: [
Container(
@@ -133,7 +133,7 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
: Theme.of(context).textTheme.bodyMedium?.color,
),
),
SizedBox(height: 4.w),
SizedBox(height: 4.h),
Text(
AppTranslations.kr_home.trialEndMessage,
style: KrAppTextStyle(
@@ -37,7 +37,7 @@ class KRSubscribeSelectorView extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w),
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.05),
borderRadius: BorderRadius.only(
@@ -78,7 +78,7 @@ class KRSubscribeSelectorView extends StatelessWidget {
final subscribes = homeController.kr_subscribeService.kr_availableSubscribes;
if (subscribes.isEmpty) {
return Padding(
padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 12.w),
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 12.w),
child: Column(
children: [
Icon(
@@ -86,7 +86,7 @@ class KRSubscribeSelectorView extends StatelessWidget {
size: 48.w,
color: Theme.of(context).textTheme.bodyLarge?.color?.withOpacity(0.3),
),
SizedBox(height: 12.w),
SizedBox(height: 12.h),
Text(
AppTranslations.kr_purchaseMembership.noData,
style: KrAppTextStyle(
@@ -105,7 +105,7 @@ class KRSubscribeSelectorView extends StatelessWidget {
),
child: ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.symmetric(vertical: 4.w, horizontal: 4.w),
padding: EdgeInsets.symmetric(vertical: 4.h, horizontal: 4.w),
itemCount: subscribes.length,
itemBuilder: (context, index) {
final subscribe = subscribes[index];
@@ -123,7 +123,7 @@ class KRSubscribeSelectorView extends StatelessWidget {
),
);
}),
SizedBox(height: 8.w),
SizedBox(height: 8.h),
],
),
);
@@ -159,7 +159,7 @@ class _SubscribeItem extends StatelessWidget {
}
return Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 2.w),
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 2.h),
child: Material(
color: Colors.transparent,
child: InkWell(
@@ -199,7 +199,7 @@ class _SubscribeItem extends StatelessWidget {
),
if (isCurrent)
Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 2.w),
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 2.h),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(16.r),
@@ -222,7 +222,7 @@ class _SubscribeItem extends StatelessWidget {
),
],
),
SizedBox(height: 8.w),
SizedBox(height: 8.h),
Text(
isUnlimited
? AppTranslations.kr_purchaseMembership.unlimitedTraffic
@@ -234,7 +234,7 @@ class _SubscribeItem extends StatelessWidget {
),
),
if (!isUnlimited) ...[
SizedBox(height: 8.w),
SizedBox(height: 8.h),
ClipRRect(
borderRadius: BorderRadius.circular(4.r),
child: LinearProgressIndicator(