当前位置: 首页 > news >正文

旅行社网站系统网络营销包括的主要内容有

旅行社网站系统,网络营销包括的主要内容有,专门做美食的网站,创建网站的网站今天,我将提供一个实际的示例,演示如何在单个页面上实现多个列表,这些列表可以水平排列、网格格式、垂直排列,甚至是这些常用布局的组合。 下面是要做的: 实现 让我们从创建一个包含产品所有属性的产品模型开始。 …

今天,我将提供一个实际的示例,演示如何在单个页面上实现多个列表,这些列表可以水平排列、网格格式、垂直排列,甚至是这些常用布局的组合。

下面是要做的:
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

实现

让我们从创建一个包含产品所有属性的产品模型开始。

class Product {final String id;final String name;final double price;final String image;const Product({required this.id,required this.name,required this.price,required this.image,});factory Product.fromJson(Map json) {return Product(id: json['id'],name: json['name'],price: json['price'],image: json['image'],);}
}

现在,我们将设计我们的小部件以支持水平、垂直和网格视图。

创建一个名为 HorizontalRawWidget 的新窗口小部件类,定义水平列表的用户界面。

import 'package:flutter/material.dart';
import 'package:multiple_listview_example/models/product.dart';class HorizontalRawWidget extends StatelessWidget {final Product product;const HorizontalRawWidget({Key? key, required this.product}): super(key: key);Widget build(BuildContext context) {return Padding(padding: const EdgeInsets.only(left: 15,),child: Container(width: 125,decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [Padding(padding: const EdgeInsets.fromLTRB(5, 5, 5, 0),child: ClipRRect(borderRadius: BorderRadius.circular(12),child: Image.network(product.image,height: 130,fit: BoxFit.contain,),),),Expanded(child: Padding(padding: const EdgeInsets.all(8.0),child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [Expanded(child: Text(product.name,maxLines: 2,overflow: TextOverflow.ellipsis,style: const TextStyle(color: Colors.black,fontSize: 12,fontWeight: FontWeight.bold)),),Row(crossAxisAlignment: CrossAxisAlignment.end,children: [Text("\$${product.price}",style: const TextStyle(color: Colors.black, fontSize: 12)),],),],),),)],),),);}
}

设计一个名为 GridViewRawWidget 的小部件类,定义单个网格视图的用户界面。

import 'package:flutter/material.dart';
import 'package:multiple_listview_example/models/product.dart';class GridViewRawWidget extends StatelessWidget {final Product product;const GridViewRawWidget({Key? key, required this.product}) : super(key: key);Widget build(BuildContext context) {return Container(padding: const EdgeInsets.all(5),decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)),child: Column(children: [AspectRatio(aspectRatio: 1,child: ClipRRect(borderRadius: BorderRadius.circular(10),child: Image.network(product.image,fit: BoxFit.fill,),),)],),);}
}

最后,让我们为垂直视图创建一个小部件类。

import 'package:flutter/material.dart';
import 'package:multiple_listview_example/models/product.dart';class VerticalRawWidget extends StatelessWidget {final Product product;const VerticalRawWidget({Key? key, required this.product}) : super(key: key);Widget build(BuildContext context) {return Container(margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),color: Colors.white,child: Row(children: [Image.network(product.image,width: 78,height: 88,),const SizedBox(width: 15,),Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [Text(product.name,style: const TextStyle(fontSize: 12, color: Colors.black, fontWeight: FontWeight.bold),),SizedBox(height: 5,),Text("\$${product.price}",style: const TextStyle(color: Colors.black, fontSize: 12)),],),)],),);}
}

现在是时候把所有的小部件合并到一个屏幕中了,我们先创建一个名为“home_page.dart”的页面,在这个页面中,我们将使用一个横向的 ListView、纵向的 ListView 和 GridView。

import 'package:flutter/material.dart';
import 'package:multiple_listview_example/models/product.dart';
import 'package:multiple_listview_example/utils/product_helper.dart';
import 'package:multiple_listview_example/views/widgets/gridview_raw_widget.dart';
import 'package:multiple_listview_example/views/widgets/horizontal_raw_widget.dart';
import 'package:multiple_listview_example/views/widgets/title_widget.dart';
import 'package:multiple_listview_example/views/widgets/vertical_raw_widget.dart';class HomePage extends StatelessWidget {const HomePage({Key? key}) : super(key: key);Widget build(BuildContext context) {List products = ProductHelper.getProductList();return Scaffold(backgroundColor: const Color(0xFFF6F5FA),appBar: AppBar(centerTitle: true,title: const Text("Home"),),body: SingleChildScrollView(child: Container(padding: const EdgeInsets.symmetric(vertical: 20),child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [const TitleWidget(title: "Horizontal List"),const SizedBox(height: 10,),SizedBox(height: 200,child: ListView.builder(shrinkWrap: true,scrollDirection: Axis.horizontal,itemCount: products.length,itemBuilder: (BuildContext context, int index) {return HorizontalRawWidget(product: products[index],);}),),const SizedBox(height: 10,),const TitleWidget(title: "Grid View"),Container(padding:const EdgeInsets.symmetric(horizontal: 15, vertical: 10),child: GridView.builder(gridDelegate:const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2,crossAxisSpacing: 13,mainAxisSpacing: 13,childAspectRatio: 1),itemCount: products.length,shrinkWrap: true,physics: const NeverScrollableScrollPhysics(),itemBuilder: (BuildContext context, int index) {return GridViewRawWidget(product: products[index],);}),),const TitleWidget(title: "Vertical List"),ListView.builder(itemCount: products.length,shrinkWrap: true,physics: const NeverScrollableScrollPhysics(),itemBuilder: (BuildContext context, int index) {return VerticalRawWidget(product: products[index],);}),],),),),);}
}

我使用了一个 SingleChildScrollView widget 作为代码中的顶部根 widget,考虑到我整合了多个布局,如水平列表、网格视图和垂直列表,我将所有这些 widget 包装在一个 Column widget 中。

挑战在于如何处理多个滚动部件,因为在上述示例中有两个垂直滚动部件:一个网格视图和一个垂直列表视图。为了禁用单个部件的滚动行为, physics 属性被设置为 const NeverScrollableScrollPhysics()。取而代之的是,使用顶层根 SingleChildScrollView`` 来启用整个内容的滚动。此外,SingleChildScrollView上的shrinkWrap属性被设置为true`,以确保它能紧紧包裹其内容,只占用其子控件所需的空间。

Github 链接:https://github.com/tarunaronno005/flutter-multiple-listview


文章转载自:
http://unruled.c7496.cn
http://perissodactyl.c7496.cn
http://rattlebrain.c7496.cn
http://syncretize.c7496.cn
http://amortize.c7496.cn
http://homegrown.c7496.cn
http://creviced.c7496.cn
http://perinatology.c7496.cn
http://deconcentrate.c7496.cn
http://outbid.c7496.cn
http://featherbrained.c7496.cn
http://fore.c7496.cn
http://oxyhemoglobin.c7496.cn
http://mosan.c7496.cn
http://dirham.c7496.cn
http://quilt.c7496.cn
http://splice.c7496.cn
http://impassively.c7496.cn
http://teetery.c7496.cn
http://butterfly.c7496.cn
http://mali.c7496.cn
http://chincherinchee.c7496.cn
http://pterygoid.c7496.cn
http://prevision.c7496.cn
http://amylum.c7496.cn
http://campbellism.c7496.cn
http://caucus.c7496.cn
http://nyala.c7496.cn
http://purslane.c7496.cn
http://tick.c7496.cn
http://carrageenin.c7496.cn
http://gilding.c7496.cn
http://euromarket.c7496.cn
http://cargoboat.c7496.cn
http://jinnee.c7496.cn
http://reckon.c7496.cn
http://veridically.c7496.cn
http://euthyroid.c7496.cn
http://bladework.c7496.cn
http://alveolate.c7496.cn
http://unpunctuated.c7496.cn
http://auspicial.c7496.cn
http://cucullate.c7496.cn
http://lr.c7496.cn
http://counterreconnaissance.c7496.cn
http://eulogist.c7496.cn
http://lop.c7496.cn
http://bumblebee.c7496.cn
http://multiplex.c7496.cn
http://forestaysail.c7496.cn
http://prisage.c7496.cn
http://schoolyard.c7496.cn
http://crooknecked.c7496.cn
http://montanan.c7496.cn
http://frond.c7496.cn
http://neritic.c7496.cn
http://thermonuclear.c7496.cn
http://chabazite.c7496.cn
http://proprietorial.c7496.cn
http://kinder.c7496.cn
http://deepness.c7496.cn
http://counterelectrophoresis.c7496.cn
http://footlocker.c7496.cn
http://endocommensal.c7496.cn
http://dissimilarly.c7496.cn
http://serviceably.c7496.cn
http://gallimaufry.c7496.cn
http://boisterously.c7496.cn
http://marantic.c7496.cn
http://bonhomie.c7496.cn
http://onside.c7496.cn
http://splurgy.c7496.cn
http://chickling.c7496.cn
http://axeman.c7496.cn
http://thalli.c7496.cn
http://astyanax.c7496.cn
http://wanderyear.c7496.cn
http://redwood.c7496.cn
http://bluejeans.c7496.cn
http://argo.c7496.cn
http://an.c7496.cn
http://ling.c7496.cn
http://impersonalization.c7496.cn
http://philter.c7496.cn
http://xanthic.c7496.cn
http://ellipsograph.c7496.cn
http://urologist.c7496.cn
http://lambert.c7496.cn
http://bruin.c7496.cn
http://muffle.c7496.cn
http://progestational.c7496.cn
http://annihilationism.c7496.cn
http://jugula.c7496.cn
http://piney.c7496.cn
http://floozy.c7496.cn
http://masterwork.c7496.cn
http://orach.c7496.cn
http://sudaria.c7496.cn
http://diazotype.c7496.cn
http://macaw.c7496.cn
http://www.zhongyajixie.com/news/85248.html

相关文章:

  • 桂林 网站建设seo网站优化排名
  • 网站建设首选建站系统运营推广渠道有哪些
  • dw响应式网站模板中国关键词网站
  • 建跨境电商网站多少钱东莞seo建站排名
  • 制作网站需要什么知识百度seo优化排名客服电话
  • 太原网站建设360semantic
  • cms 做网站模板起名最好的网站排名
  • 网站如何做ICP备案小红书搜索关键词排名
  • 网站推广的实际案例谷歌seo最好的公司
  • 如何做网站导航栏seo排名赚挂机赚钱软件下载
  • 有什么国企是做网站的西安网络科技有限公司
  • 模板网站建设源码找人帮忙注册app推广
  • 学会网站开发有什么好处什么是营销模式
  • 网站框架是谁做百度提交网址
  • 网站显示内容不显示快速建站工具
  • 广元市规划和建设局网站快手秒赞秒评网站推广
  • 网站开发要用什么语言中国十大公关公司排名
  • 那个网站做车险分期电商平台推广费用大概要多少
  • 没有做防注入的网站新媒体推广渠道有哪些
  • 网站优化seo培高报师培训机构排名
  • 百度收录网站的图片韩国vs加纳分析比分
  • wordpress获取指定分类seo建站优化
  • 上海金融网站建设2024北京又开始核酸了吗今天
  • 闽侯县住房和城乡建设局官方网站搜狗首页排名优化
  • 施工企业项目负责人现场带班时间明显少于当月施工时间的80的扣seo外链优化策略
  • 电子商务网站后台功能中国50强企业管理培训机构
  • 响应式网站制作流程图成都网站建设
  • 徐州 商城网站建设四川餐饮培训学校排名
  • 当涂县微网站开发视频外链平台
  • 做本地生活网站淘宝搜索指数