|
|
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart' hide ConnectionState;
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:nomo/app/constants/iconfont/iconfont.dart';
|
|
|
+import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
|
|
|
import '../../../../config/theme/theme_extensions/theme_extension.dart';
|
|
|
import '../../../../config/translations/strings_enum.dart';
|
|
|
import '../../../base/base_view.dart';
|
|
|
@@ -26,114 +27,129 @@ class HomeView extends BaseView<HomeController> {
|
|
|
|
|
|
@override
|
|
|
Widget buildContent(BuildContext context) {
|
|
|
- return Container(
|
|
|
- width: double.maxFinite,
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 14.w),
|
|
|
- child: SafeArea(
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ return SafeArea(
|
|
|
+ child: Container(
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 14.w),
|
|
|
+ child: Stack(
|
|
|
children: [
|
|
|
- Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ Column(
|
|
|
children: [
|
|
|
- Obx(
|
|
|
- () => ClickOpacity(
|
|
|
- onTap: () => Get.toNamed(Routes.SUBSCRIPTION),
|
|
|
- child: IXImage(
|
|
|
- source: controller.isPremium
|
|
|
- ? Assets.premium
|
|
|
- : Assets.free,
|
|
|
- width: controller.isPremium ? 92.w : 64.w,
|
|
|
- height: 28.w,
|
|
|
- sourceType: ImageSourceType.asset,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ClickOpacity(
|
|
|
- child: Padding(
|
|
|
- padding: EdgeInsets.only(
|
|
|
- left: 10.w,
|
|
|
- right: 0.w,
|
|
|
- top: 10.w,
|
|
|
- bottom: 10.w,
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Obx(
|
|
|
+ () => ClickOpacity(
|
|
|
+ onTap: () => Get.toNamed(Routes.SUBSCRIPTION),
|
|
|
+ child: IXImage(
|
|
|
+ source: controller.isPremium
|
|
|
+ ? Assets.premium
|
|
|
+ : Assets.free,
|
|
|
+ width: controller.isPremium ? 92.w : 64.w,
|
|
|
+ height: 28.w,
|
|
|
+ sourceType: ImageSourceType.asset,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
- child: Icon(
|
|
|
- IconFont.icon09,
|
|
|
- size: 26.w,
|
|
|
- color: Get.reactiveTheme.hintColor,
|
|
|
+ ClickOpacity(
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.only(
|
|
|
+ left: 10.w,
|
|
|
+ right: 0.w,
|
|
|
+ top: 10.w,
|
|
|
+ bottom: 10.w,
|
|
|
+ ),
|
|
|
+ child: Icon(
|
|
|
+ IconFont.icon09,
|
|
|
+ size: 26.w,
|
|
|
+ color: Get.reactiveTheme.hintColor,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ onTap: () {
|
|
|
+ Get.toNamed(Routes.SETTING);
|
|
|
+ // ErrorDialog.show(
|
|
|
+ // message:
|
|
|
+ // "The VPN was disconnected unexpectedly. Would you like to reconnect now to stay protected?",
|
|
|
+ // );
|
|
|
+ },
|
|
|
),
|
|
|
- ),
|
|
|
- onTap: () {
|
|
|
- Get.toNamed(Routes.SETTING);
|
|
|
- // ErrorDialog.show(
|
|
|
- // message:
|
|
|
- // "The VPN was disconnected unexpectedly. Would you like to reconnect now to stay protected?",
|
|
|
- // );
|
|
|
- },
|
|
|
+ ],
|
|
|
),
|
|
|
- ],
|
|
|
- ),
|
|
|
|
|
|
- // 80.verticalSpaceFromWidth,
|
|
|
- Padding(
|
|
|
- padding: EdgeInsets.symmetric(vertical: 20.w),
|
|
|
- child: CarouselSlider(
|
|
|
- options: CarouselOptions(height: 80.w, viewportFraction: 1.0),
|
|
|
- items: [1, 2, 3, 4, 5].map((i) {
|
|
|
- return Builder(
|
|
|
- builder: (BuildContext context) {
|
|
|
- return IXImage(
|
|
|
- source: Assets.bannerTest,
|
|
|
- width: double.infinity,
|
|
|
- height: 80.w,
|
|
|
- sourceType: ImageSourceType.asset,
|
|
|
- borderRadius: 14.r,
|
|
|
- );
|
|
|
- },
|
|
|
- );
|
|
|
- }).toList(),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Text(
|
|
|
- Strings.activeTime.tr,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 18.sp,
|
|
|
- height: 1.3,
|
|
|
- color: Get.reactiveTheme.hintColor,
|
|
|
- ),
|
|
|
- ),
|
|
|
- 2.verticalSpaceFromWidth,
|
|
|
- Obx(
|
|
|
- () => Text(
|
|
|
- controller.coreController.timer,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 28.sp,
|
|
|
- height: 1.2,
|
|
|
- color: Get.reactiveTheme.primaryColor,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
+ Expanded(
|
|
|
+ child: SmartRefresher(
|
|
|
+ enablePullDown: true,
|
|
|
+ enablePullUp: false,
|
|
|
+ controller: controller.refreshController,
|
|
|
+ onRefresh: controller.onRefresh,
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ // 80.verticalSpaceFromWidth,
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 20.w),
|
|
|
+ child: CarouselSlider(
|
|
|
+ options: CarouselOptions(
|
|
|
+ height: 80.w,
|
|
|
+ viewportFraction: 1.0,
|
|
|
+ ),
|
|
|
+ items: [1, 2, 3, 4, 5].map((i) {
|
|
|
+ return Builder(
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return IXImage(
|
|
|
+ source: Assets.bannerTest,
|
|
|
+ width: double.infinity,
|
|
|
+ height: 80.w,
|
|
|
+ sourceType: ImageSourceType.asset,
|
|
|
+ borderRadius: 14.r,
|
|
|
+ );
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }).toList(),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ Strings.activeTime.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 18.sp,
|
|
|
+ height: 1.3,
|
|
|
+ color: Get.reactiveTheme.hintColor,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ 2.verticalSpaceFromWidth,
|
|
|
+ Obx(
|
|
|
+ () => Text(
|
|
|
+ controller.coreController.timer,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 28.sp,
|
|
|
+ height: 1.2,
|
|
|
+ color: Get.reactiveTheme.primaryColor,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
|
|
|
- 20.verticalSpaceFromWidth,
|
|
|
- // 位置选择按钮和最近位置(叠在一起的效果)
|
|
|
- Stack(
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- alignment: Alignment.center,
|
|
|
- margin: EdgeInsets.only(top: 138.w),
|
|
|
- child: _buildConnectionButton(),
|
|
|
+ 20.verticalSpaceFromWidth,
|
|
|
+ // 位置选择按钮和最近位置(叠在一起的效果)
|
|
|
+ Stack(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ margin: EdgeInsets.only(top: 138.w),
|
|
|
+ child: _buildConnectionButton(),
|
|
|
+ ),
|
|
|
+ _buildLocationStack(),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
- _buildLocationStack(),
|
|
|
],
|
|
|
),
|
|
|
- Expanded(
|
|
|
- child: Column(
|
|
|
- mainAxisAlignment: MainAxisAlignment.end,
|
|
|
- children: [
|
|
|
- MenuList(),
|
|
|
- if (Platform.isAndroid) 10.verticalSpaceFromWidth,
|
|
|
- ],
|
|
|
- ),
|
|
|
+ Positioned(
|
|
|
+ bottom: Platform.isAndroid ? 10.w : 0,
|
|
|
+ left: 0,
|
|
|
+ right: 0,
|
|
|
+ child: MenuList(),
|
|
|
),
|
|
|
],
|
|
|
),
|