honghengqiang 1 year ago
parent
commit
c71c8658b5

BIN
build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill


+ 3 - 3
build/web/flutter_service_worker.js

@@ -4,9 +4,9 @@ const TEMP = 'flutter-temp-cache';
 const CACHE_NAME = 'flutter-app-cache';
 const RESOURCES = {
   "version.json": "31e94b74b10adf8c4726b9f6a1aaac70",
-"index.html": "6008d0c0abb73108dea1b7154615c9a0",
-"/": "6008d0c0abb73108dea1b7154615c9a0",
-"main.dart.js": "9699b6e6a0d815f22037b815465359dc",
+"index.html": "7f91f02daf9efe0dfd6a07b28d12a8e5",
+"/": "7f91f02daf9efe0dfd6a07b28d12a8e5",
+"main.dart.js": "e1f8765650b885e02b766f74b91fdfa0",
 "flutter.js": "1cfe996e845b3a8a33f57607e8b09ee4",
 "favicon.png": "5dcef449791fa27946b3d35ad8803796",
 "icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1",

+ 1 - 1
build/web/index.html

@@ -34,7 +34,7 @@
 
   <script>
     // The value below is injected by flutter build, do not touch.
-    var serviceWorkerVersion = '1434413365';
+    var serviceWorkerVersion = '3203128498';
   </script>
   <!-- This script adds the flutter initialization JS code -->
   <script src="flutter.js" defer></script>

File diff suppressed because it is too large
+ 443 - 422
build/web/main.dart.js


+ 114 - 84
lib/detail/country_detail.dart

@@ -2,100 +2,130 @@ import 'dart:html';
 
 import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:hengyi/utils/dio_util.dart';
 
 class CountryDetailWidget extends StatelessWidget {
-  const CountryDetailWidget({super.key});
+  CountryDetailWidget(this.countryId, {super.key});
+
+  final int countryId;
 
   @override
   Widget build(BuildContext context) {
-    return Column(
-      mainAxisAlignment: MainAxisAlignment.center,
-      children: [
-        Expanded(
-          flex: 1,
-          child: Column(
-            children: [
-              Container(
-                margin: const EdgeInsets.only(top: 20),
-                height: 150,
-                child: Row(
-                  mainAxisAlignment: MainAxisAlignment.center,
-                  children: [
-                    const Text(
-                      "美国",
-                      style: TextStyle(
-                          fontSize: 24,
-                          fontWeight: FontWeight.bold,
-                          color: Colors.black),
-                    ),
-                    Image(
-                      image: const AssetImage("images/logo.png"),
-                      width: 200.w,
-                      height: 150.w,
-                    )
-                  ],
-                ),
-              ),
-              Container(
-                color: Colors.grey[300],
-                height: 60.h,
-                width: 800.w,
-                margin: EdgeInsets.only(top: 20.w),
-                child: Row(
-                  mainAxisAlignment: MainAxisAlignment.start,
-                  children: [
-                    Row(
+    return FutureBuilder(
+        future: NetworkUtil().getCountryDetail(countryId),
+        builder: (context, snapshot) {
+          if (snapshot.connectionState == ConnectionState.done) {
+            if (snapshot.hasData) {
+              return Column(
+                mainAxisAlignment: MainAxisAlignment.center,
+                children: [
+                  Expanded(
+                    flex: 1,
+                    child: Column(
                       children: [
-                        Text(
-                          "签证须知:",
-                          style: TextStyle(
-                              fontSize: 14.sp,
-                              color: Colors.red,
-                              fontWeight: FontWeight.bold),
+                        Container(
+                          margin: const EdgeInsets.only(top: 20),
+                          height: 150,
+                          child: Row(
+                            mainAxisAlignment: MainAxisAlignment.center,
+                            children: [
+                              Text(
+                                snapshot.data?.countryName ?? "",
+                                style: const TextStyle(
+                                    fontSize: 24,
+                                    fontWeight: FontWeight.bold,
+                                    color: Colors.black),
+                              ),
+                              Image(
+                                image: NetworkImage(
+                                    snapshot.data?.countryImgUrl ?? ""),
+                                width: 200.w,
+                                height: 150.w,
+                              ),
+                            ],
+                          ),
                         ),
-                        Text(
-                          "具体内容",
-                          style: TextStyle(
-                              fontSize: 14.sp,
-                              color: Colors.black,
-                              fontWeight: FontWeight.bold),
+                        Container(
+                          color: Colors.grey[300],
+                          height: 60.h,
+                          width: 800.w,
+                          margin: EdgeInsets.only(top: 20.w),
+                          child: Row(
+                            mainAxisAlignment: MainAxisAlignment.start,
+                            children: [
+                              Row(
+                                children: [
+                                  Text(
+                                    "签证须知:",
+                                    style: TextStyle(
+                                        fontSize: 14.sp,
+                                        color: Colors.red,
+                                        fontWeight: FontWeight.bold),
+                                  ),
+                                  Text(
+                                    snapshot.data?.countryContent ?? "",
+                                    style: TextStyle(
+                                        fontSize: 14.sp,
+                                        color: Colors.black,
+                                        fontWeight: FontWeight.bold),
+                                  ),
+                                ],
+                              )
+                            ],
+                          ),
                         ),
+                        GestureDetector(
+                          onTap: () {
+                            if (snapshot.data != null &&
+                                snapshot.data!.countryVisitVisaUrl.isNotEmpty) {
+                              downLoadFile(snapshot.data!.countryVisitVisaUrl);
+                            }
+                          },
+                          child: Container(
+                            margin: EdgeInsets.only(top: 20.w),
+                            child: Text(
+                              "${snapshot.data?.countryName ?? ""}-旅游签证材料清单",
+                              style: TextStyle(
+                                  fontSize: 14.sp,
+                                  color: Colors.red,
+                                  fontWeight: FontWeight.bold),
+                            ),
+                          ),
+                        ),
+                        GestureDetector(
+                          onTap: () {
+                            if (snapshot.data != null &&
+                                snapshot.data!.countryVisitVisaUrl.isNotEmpty) {
+                              downLoadFile(
+                                  snapshot.data!.countryBusinessVisaUrl);
+                            }
+                          },
+                          child: Container(
+                            margin: EdgeInsets.only(top: 20.w),
+                            child: Text(
+                              "${snapshot.data?.countryName ?? ""}-商务签证材料清单",
+                              style: TextStyle(
+                                  fontSize: 14.sp,
+                                  color: Colors.red,
+                                  fontWeight: FontWeight.bold),
+                            ),
+                          ),
+                        )
                       ],
-                    )
-                  ],
-                ),
-              ),
-              GestureDetector(
-                onTap: () {
-                  downLoadFile(
-                      "https://cos.appmeta.cn/eeaac010563eb2cf6c32d828a7be8956b775d811.apk?sign=f673649c442673cfbc0f17693955f0f3&t=1678935183");
-                },
-                child: Container(
-                  margin: EdgeInsets.only(top: 20.w),
-                  child: Text(
-                    "美国-旅游签证材料清单",
-                    style: TextStyle(
-                        fontSize: 14.sp,
-                        color: Colors.red,
-                        fontWeight: FontWeight.bold),
+                    ),
                   ),
-                ),
-              ),
-              Container(
-                margin: EdgeInsets.only(top: 20.w),
-                child: Text(
-                  "美国-商务签证材料清单",
-                  style: TextStyle(
-                      fontSize: 14.sp,
-                      color: Colors.red,
-                      fontWeight: FontWeight.bold),
-                ),
-              )
-            ],
-          ),
-        ),
-      ],
-    );
+                ],
+              );
+            } else {
+              return Text("Error:${snapshot.error}");
+            }
+          } else {
+            return Container(
+              alignment: Alignment.center,
+              child: const CircularProgressIndicator(),
+            );
+          }
+        });
   }
 
   ///调用浏览器的下载功能下载文件

+ 5 - 2
lib/detail/detail.dart

@@ -7,7 +7,9 @@ import 'package:hengyi/widget/common_footer.dart';
 import 'package:hengyi/widget/common_title.dart';
 
 class DetailPageWidget extends StatefulWidget {
-  const DetailPageWidget({super.key});
+  DetailPageWidget(this.countryId, {super.key});
+
+  final int countryId;
 
   @override
   State<DetailPageWidget> createState() => _DetailPageWidgetState();
@@ -27,6 +29,7 @@ class _DetailPageWidgetState extends State<DetailPageWidget>
   @override
   Widget build(BuildContext context) {
     return MaterialApp(
+      title: "夫为",
       home: Scaffold(
         body: Column(
           children: [
@@ -49,7 +52,7 @@ class _DetailPageWidgetState extends State<DetailPageWidget>
                 child: TabBarView(
               controller: _tabController,
               children: [
-                CountryDetailWidget(),
+                CountryDetailWidget(widget.countryId),
                 ContactUSWidget(),
                 AboutUSWidget(),
               ],

+ 1 - 1
lib/home/item_country.dart

@@ -13,7 +13,7 @@ class CountryItemWidget extends StatelessWidget {
   Widget build(BuildContext context) {
     return GestureDetector(
       onTap: () {
-        Util.gotoPage(context, const DetailPageWidget());
+        Util.gotoPage(context, DetailPageWidget(country.id));
       },
       child: Column(
         mainAxisAlignment: MainAxisAlignment.center,

+ 1 - 0
lib/main.dart

@@ -15,6 +15,7 @@ class MyApp extends StatelessWidget {
       designSize: const Size(1280, 1920),
       builder: (BuildContext context, Widget? child) {
         return MaterialApp(
+          title: "夫为",
           home: HomePage(),
         );
       },

+ 2 - 2
lib/utils/dio_util.dart

@@ -27,12 +27,12 @@ class NetworkUtil {
   }
 
   ///获取国家详情
-  Future<List<CountryDetailEntity>> getCountryDetail(int id) async {
+  Future<CountryDetailEntity> getCountryDetail(int id) async {
     var queryParams = {"country_id": id};
     var response = await Dio().get(
         "${AppConfig.baseUrl}api/home/visa/country/detail",
         queryParameters: queryParams);
     var data = json.decode(response.toString());
-    return BaseModelEntity<List<CountryDetailEntity>>.fromJson(data).data;
+    return BaseModelEntity<CountryDetailEntity>.fromJson(data).data;
   }
 }

Some files were not shown because too many files changed in this diff