From 80f5f0f5ef11a4cbe227dff0569141617acbe143 Mon Sep 17 00:00:00 2001 From: bluesea <307723040@qq.com> Date: Mon, 13 May 2024 15:08:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=83=E5=B1=80=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../imgcategorypage/imgcategorypage_view.dart | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/wallpaper/lib/pages/imgcategorypage/imgcategorypage_view.dart b/wallpaper/lib/pages/imgcategorypage/imgcategorypage_view.dart index 67f2c24..3ba3d89 100644 --- a/wallpaper/lib/pages/imgcategorypage/imgcategorypage_view.dart +++ b/wallpaper/lib/pages/imgcategorypage/imgcategorypage_view.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:wallpaper/pages/imgcategorypage/imgcategorypage_controller.dart'; import 'package:wallpaper/models/imgnetodel.dart'; +import 'package:transparent_image/transparent_image.dart'; class ImgCategoryPageView extends GetView { // const ImgCategoryPageView({super.key}); @@ -11,13 +12,51 @@ class ImgCategoryPageView extends GetView { @override Widget build(BuildContext context) { + final Widget bodyView = getBodyWidget(); + return Scaffold( appBar: AppBar( title: Text(stitle), ), - body: const Center( - child: Text("下载的..."), - ), + body: bodyView, ); } + + + + + + + //返回内容 + Widget getBodyWidget(){ + return Obx(() => GridView.count( + crossAxisCount: 2, + mainAxisSpacing: 10, + crossAxisSpacing: 10, + childAspectRatio: 0.7, + padding: const EdgeInsets.symmetric(horizontal: 10), + children: List.generate(dataModel.data!.length, (index) { + return getBodyItem(dataModel.data![index].previewThumb!,index); + }), + )); + } + + Stack getBodyItem(String imgUrl,int index){ + return Stack(//堆叠效果 + children: [ + FadeInImage.memoryNetwork( + width: double.infinity, + height: double.infinity, + placeholder: kTransparentImage, + image: imgUrl, + fit: BoxFit.cover, + ), + ], + ); + } + + + + + } \ No newline at end of file