同步数据

This commit is contained in:
2022-06-02 17:57:48 +08:00
parent 511fb330ca
commit ed024f5962
59 changed files with 3242 additions and 1213 deletions

View File

@@ -1,15 +0,0 @@
import 'package:flutter/material.dart';
class BuyPages extends StatefulWidget {
const BuyPages({Key? key}) : super(key: key);
@override
State<BuyPages> createState() => _BuyPagesState();
}
class _BuyPagesState extends State<BuyPages> {
@override
Widget build(BuildContext context) {
return const Text('下单购买');
}
}

View File

@@ -0,0 +1,430 @@
/*
* @Author: Aimee~
* @Date: 2022-05-26 13:16:03
* @LastEditTime: 2022-06-01 13:01:25
* @LastEditors: Aimee
* @FilePath: /gl_dao/lib/pages/store/buy/buy.dart
* @Description: 订单确认页面
*/
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../main_color.dart';
import '../../address/adds_list/adds_list_page.dart';
class BuyPages extends StatefulWidget {
const BuyPages({Key? key}) : super(key: key);
@override
State<BuyPages> createState() => _BuyPagesState();
}
class _BuyPagesState extends State<BuyPages> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: appBar(),
body: Stack(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 60),
child: ListView(
children: [
// 地址
selectAddress(),
// 分割线 - 供应商购买信息
Container(
height: 16,
width: MediaQuery.of(context).size.width,
color: tMainBg,
),
purchaseInfo(),
Container(
height: 16,
width: MediaQuery.of(context).size.width,
color: tMainBg,
),
purchaseInfo(),
],
),
),
buttomButton(),
],
),
);
}
// 自定义底部提交按钮
Widget buttomButton() {
return Positioned(
bottom: 0,
left: 0,
child: Container(
width: MediaQuery.of(context).size.width,
color: Colors.white,
child: SafeArea(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 1,
child: Container(
padding: const EdgeInsets.only(left: 20),
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: Colors.black.withOpacity(0.1),
),
),
),
width: double.infinity,
height: 59,
alignment: Alignment.centerLeft,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const Text(
'1999',
style: TextStyle(
fontSize: 26,
color: tMainRedColor,
fontWeight: FontWeight.w600,
),
),
Container(
padding: const EdgeInsets.only(bottom: 2),
child: const Text(
' DT积分',
style: TextStyle(
fontSize: 13,
color: tMainRedColor,
),
),
),
],
),
),
),
GestureDetector(
onTap: () {},
child: Container(
margin: const EdgeInsets.only(top: 1),
padding: const EdgeInsets.fromLTRB(26, 10, 26, 10),
height: 60,
alignment: Alignment.center,
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [tMainRedColor, tMainRedColor],
),
),
child: const Text(
'提交订单',
style: TextStyle(
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
),
),
);
}
// 自定义购买信息
Widget purchaseInfo() {
return Container(
width: MediaQuery.of(context).size.width - 32,
margin: const EdgeInsets.only(
top: 16,
left: 16,
right: 16,
bottom: 0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
height: 16,
width: 4,
color: tMainRedColor.withOpacity(0.5),
),
const SizedBox(width: 6),
const Text(
'供应商名称',
style: TextStyle(
fontSize: 16,
color: tTextColor333,
fontWeight: FontWeight.w500,
),
),
],
),
Container(
width: double.infinity,
height: 84,
margin: const EdgeInsets.only(top: 10),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: tMainBg,
borderRadius: BorderRadius.all(
Radius.circular(2),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
for (var i = 0; i < 10; i++)
if (i < 4)
Container(
margin: const EdgeInsets.only(right: 10),
decoration: const BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(0.0, 2.0), //阴影xy轴偏移量
blurRadius: 2.0, //阴影模糊程度
spreadRadius: 2.0 //阴影扩散程度
)
],
),
child: AspectRatio(
aspectRatio: 1.0 / 1.0, // 宽高比
child: ClipRRect(
child: Image.network(
'https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b',
fit: BoxFit.cover,
),
),
),
),
],
),
Container(
padding: const EdgeInsets.only(left: 4),
child: Column(
children: const [
Text(
'...',
style: TextStyle(
color: tMainRedColor,
fontSize: 28,
),
),
SizedBox(height: 6),
Text(
'共4件',
style: TextStyle(
color: tTextColor333,
fontSize: 14,
),
),
],
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: const [
Text(
'支付方式:',
style: TextStyle(
fontSize: 14,
color: tTextColor666,
),
),
SizedBox(width: 10),
Text(
'DT积分',
style: TextStyle(
fontSize: 14,
color: tTextColor333,
),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: const [
Text(
'总价:',
style: TextStyle(
fontSize: 14,
color: tTextColor666,
),
),
SizedBox(width: 4),
Text(
'1500',
style: TextStyle(
fontSize: 17,
color: tMainRedColor,
fontWeight: FontWeight.bold,
),
),
],
),
],
),
),
Container(
padding: const EdgeInsets.only(
top: 16,
bottom: 16,
),
child: TextField(
cursorColor: Colors.black,
maxLength: 150, // 文字最长
maxLines: 3, // 最多显示三行
decoration: InputDecoration(
hintText: "请输入备注信息", // 提示语的表单
hintStyle: const TextStyle(
fontSize: 14,
),
filled: true,
fillColor: tMainBg,
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(4.0),
),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey.withOpacity(0.3),
width: 1,
style: BorderStyle.solid,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey.withOpacity(0.3),
width: 1,
style: BorderStyle.solid,
),
),
),
),
),
],
),
);
}
// 自定义地址组件
Widget selectAddress() {
return Container(
width: MediaQuery.of(context).size.width - 32,
margin: const EdgeInsets.only(
top: 16,
left: 16,
right: 16,
bottom: 10,
),
padding: const EdgeInsets.only(top: 10),
child: Column(
children: [
Row(
children: const [
Text(
'张三丰',
style: TextStyle(
fontSize: 17,
color: tTextColor333,
fontWeight: FontWeight.w500,
),
),
SizedBox(width: 16),
Text(
'18823456789',
style: TextStyle(
fontSize: 17,
color: tTextColor333,
fontWeight: FontWeight.w500,
),
),
SizedBox(width: 10),
Icon(
Icons.edit_location_alt_outlined,
color: tMainRedColor,
size: 17,
)
],
),
Container(
padding: const EdgeInsets.only(
top: 12,
bottom: 8,
),
child: const Divider(height: 1),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width - 140,
child: const Text(
'张三丰张三丰张三丰张三丰张三丰张三丰张三丰张三丰张三丰张三丰张三丰张三丰张三丰张三丰',
style: TextStyle(
fontSize: 14,
color: tTextColor666,
),
),
),
GestureDetector(
onTap: () {
Get.to(const AddressListPage());
},
child: Row(
children: const [
Text(
'切换地址',
style: TextStyle(
fontSize: 14,
color: tTextColor333,
fontWeight: FontWeight.w500,
),
),
Icon(
Icons.chevron_right,
color: tTextColor333,
size: 24,
)
],
),
),
],
),
],
),
);
}
// 自定义顶部导航
PreferredSizeWidget appBar() {
return AppBar(
backgroundColor: tMainRedColor,
title: const Text(
'确认订单',
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
);
}
}

View File

@@ -1,15 +0,0 @@
import 'package:flutter/material.dart';
class StoreDetailsPages extends StatefulWidget {
const StoreDetailsPages({Key? key}) : super(key: key);
@override
State<StoreDetailsPages> createState() => _StoreDetailsPagesState();
}
class _StoreDetailsPagesState extends State<StoreDetailsPages> {
@override
Widget build(BuildContext context) {
return const Text('详情');
}
}

View File

@@ -0,0 +1,506 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:gl_dao/main_color.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import '../buy/buy.dart';
class StoreDetailsPages extends StatefulWidget {
const StoreDetailsPages({Key? key}) : super(key: key);
@override
State<StoreDetailsPages> createState() => _StoreDetailsPagesState();
}
class _StoreDetailsPagesState extends State<StoreDetailsPages>
with TickerProviderStateMixin {
// 声明滚动事件
final ScrollController scrollController = ScrollController();
// 顶部自定义导航透明度
double topBarOpacity = 0.0;
List<Map> imgList = [
{
"title": '1名创优品',
"url":
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b",
},
{
"title": '1耐克',
"url":
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b",
},
{
"title": '1百草味',
"url":
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b",
},
{
"title": '1MLB',
"url":
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b",
},
];
@override
void initState() {
super.initState();
// 页面滚动触发改变顶部自定义导航样式透明度
scrollController.addListener(() {
if (scrollController.offset >= 128) {
if (topBarOpacity != 1.0) {
setState(() {
topBarOpacity = 1.0;
});
}
} else if (scrollController.offset <= 128 &&
scrollController.offset >= 0) {
if (topBarOpacity != scrollController.offset / 128) {
setState(() {
topBarOpacity = scrollController.offset / 128;
});
}
} else if (scrollController.offset <= 0) {
if (topBarOpacity != 0.0) {
setState(() {
topBarOpacity = 0.0;
});
}
}
});
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: tMainBg,
body: Stack(
children: [
ListView(
controller: scrollController,
padding: const EdgeInsets.all(0),
children: [
// 轮播图
mySwiperWidget(),
// 标题,价格,月销量
titleWidget(),
// 规格 服务 作者
sizeWidget(),
// 商品详情
detailWidget(),
],
),
// 顶部导航
navWidget(),
// 底部按钮
bottomWidget(),
// demo(0.9),
],
),
);
}
// 自定义商品详情
Widget detailWidget() {
return Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(0, 16, 0, 0),
child: Column(
children: imgList.map((item) {
return Image.network(
item['url'],
fit: BoxFit.cover,
);
}).toList(),
),
);
}
// 自定义规格、服务、作者
Widget sizeWidget() {
return Container(
margin: const EdgeInsets.fromLTRB(16, 10, 16, 0),
padding: const EdgeInsets.fromLTRB(16, 16, 16, 6),
width: MediaQuery.of(context).size.width,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10),
),
boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(0.0, 15.0), //阴影xy轴偏移量
blurRadius: 15.0, //阴影模糊程度
spreadRadius: 1.0, //阴影扩散程度
),
],
),
child: Column(
children: [
Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(0, 6, 0, 6),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: const [
Text(
'规格',
style: TextStyle(
color: Colors.grey,
),
),
],
),
Container(
width: 250,
alignment: Alignment.centerRight,
child: const Text(
'1m * 1m',
style: TextStyle(
color: tTextColor333,
),
),
)
],
),
),
Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(0, 6, 0, 6),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: const [
Text(
'服务',
style: TextStyle(
color: Colors.grey,
),
),
],
),
Container(
width: 250,
alignment: Alignment.centerRight,
child: const Text(
'书画藏品',
style: TextStyle(
color: tTextColor333,
),
),
)
],
),
),
Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(0, 6, 0, 6),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: const [
Text(
'作者',
style: TextStyle(
color: Colors.grey,
),
),
],
),
Container(
width: 250,
alignment: Alignment.centerRight,
child: const Text(
' - ',
style: TextStyle(
color: tTextColor333,
),
),
)
],
),
),
],
),
);
}
// 自定义标题和销量价格
Widget titleWidget() {
return Container(
padding: const EdgeInsets.only(
top: 24,
left: 15,
right: 16,
bottom: 6,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
width: double.infinity,
child: Text(
'书画虎年大吉1米*1米',
style: TextStyle(
fontSize: 18,
color: tTextColor333,
fontWeight: FontWeight.w600,
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3, //行距0.5即行高的一半)
),
maxLines: 2,
),
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: const [
Text(
'1999',
style: TextStyle(
fontSize: 20,
color: tMainRedColor,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 2),
Padding(
padding: EdgeInsets.only(bottom: 2),
child: Text(
'DT积分',
style: TextStyle(
fontSize: 12,
color: tMainRedColor,
),
),
),
],
),
const Text(
'月销量10',
style: TextStyle(
fontSize: 13,
color: tTextColor999,
),
)
],
),
],
),
);
}
// 顶部轮播图
Widget mySwiperWidget() {
return Container(
width: MediaQuery.of(context).size.width,
height: 390,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
color: Colors.white,
),
child: Swiper(
itemBuilder: (BuildContext context, int index) {
//每次循环遍历时将i赋值给index imgList[index]['title'],
return SizedBox(
width: MediaQuery.of(context).size.width,
height: 390,
child: ClipRRect(
child: Image.network(
imgList[index]['url'],
fit: BoxFit.cover,
),
),
);
},
itemCount: imgList.length,
autoplay: false,
pagination: SwiperPagination(
builder: DotSwiperPaginationBuilder(
size: 6,
color: tTextColor999.withOpacity(.4),
activeSize: 6,
activeColor: tMainRedColor,
),
),
),
);
}
// 自定义顶部导航
Widget navWidget() {
return Positioned(
top: 0,
left: 0,
child: Container(
width: MediaQuery.of(context).size.width,
height: 90,
color: tMainRedColor.withOpacity(topBarOpacity),
padding: const EdgeInsets.only(
top: 40,
left: 15,
right: 15,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: back,
child: Icon(
Icons.arrow_back_ios,
size: 22,
color: topBarOpacity > 0 ? Colors.white : Colors.white,
),
),
Expanded(
flex: 1,
child: GestureDetector(
child: Container(
padding: const EdgeInsets.only(left: 10),
alignment: Alignment.center,
child: Text(
'商品详情',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: topBarOpacity > 0 ? Colors.white : Colors.white,
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
),
),
),
GestureDetector(
onTap: share,
child: Icon(
Icons.share,
size: 22,
color: topBarOpacity > 0 ? Colors.white : Colors.white,
),
),
],
),
),
);
}
// 自定义底部按钮
Widget bottomWidget() {
return Positioned(
bottom: 0,
child: SafeArea(
child: Container(
margin: const EdgeInsets.only(
left: 16,
right: 16,
),
width: MediaQuery.of(context).size.width - 32,
height: 50,
child: Row(
children: [
Container(
width: (MediaQuery.of(context).size.width - 32) / 2,
alignment: Alignment.center,
child: const Text(
'加入购物车',
style: TextStyle(
fontSize: 17,
color: tTextColor666,
fontWeight: FontWeight.w500,
),
),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8),
topLeft: Radius.circular(8),
),
),
),
GestureDetector(
onTap: () {
Get.to(const BuyPages());
},
child: Container(
width: (MediaQuery.of(context).size.width - 32) / 2,
alignment: Alignment.center,
child: const Text(
'立即购买',
style: TextStyle(
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
decoration: const BoxDecoration(
// color: tMainRedColor,
gradient: LinearGradient(
colors: [tMainRedColor, tMainRedColor],
),
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(8),
topRight: Radius.circular(8),
),
),
),
),
],
),
),
),
);
}
// 返回按钮
back() {
Get.back();
}
// 分享
share() {
// ignore: avoid_print
print('分享');
}
Widget demo(double opci) {
return ListView(
children: [
SizedBox(
width: 750,
child: Opacity(
opacity: opci,
child: Image.asset(
'assets/images/detail.png',
width: 750,
fit: BoxFit.cover,
alignment: Alignment.bottomCenter,
),
),
)
],
);
}
}

View File

@@ -1,14 +1,14 @@
/*
* @Author: zhangdongxue zhangdongxue@uz.cn
* @Date: 2022-05-27 15:10:21
* @LastEditors: zhangdongxue zhangdongxue@uz.cn
* @LastEditTime: 2022-05-27 15:51:10
* @FilePath: /gl_dao/lib/pages/store/widget/offline_bussiness.dart
* @LastEditors: Aimee
* @LastEditTime: 2022-05-31 13:52:22
* @FilePath: /gl_dao/lib/pages/store/index/components/offline_bussiness.dart
* @Description: 线
*/
import 'package:flutter/material.dart';
import '../../../main_color.dart';
import '../../../../main_color.dart';
class OfflineBussinessWidget extends StatefulWidget {
const OfflineBussinessWidget({Key? key}) : super(key: key);
@@ -97,7 +97,7 @@ class _OfflineBussinessWidgetState extends State<OfflineBussinessWidget> {
SizedBox(
child: ClipOval(
child: Image.network(
'http://img5.mtime.cn/mg/2021/08/24/141454.81651527_285X160X4.jpg',
'https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b',
width: 54,
height: 54,
fit: BoxFit.cover,

View File

@@ -1,14 +1,14 @@
/*
* @Author: zhangdongxue zhangdongxue@uz.cn
* @Date: 2022-05-27 15:24:22
* @LastEditors: zhangdongxue zhangdongxue@uz.cn
* @LastEditTime: 2022-05-27 15:29:11
* @FilePath: /gl_dao/lib/pages/store/widget/offline_title.dart
* @LastEditors: Aimee
* @LastEditTime: 2022-05-31 13:51:19
* @FilePath: /gl_dao/lib/pages/store/index/components/offline_title.dart
* @Description: ,`customMade`, koroFileHeader查看配置 : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import 'package:flutter/material.dart';
import '../../../main_color.dart';
import '../../../../main_color.dart';
class OfflineTitleWidget extends StatelessWidget {
final String title;

View File

@@ -1,20 +1,20 @@
/*
* @Author: zhangdongxue zhangdongxue@uz.cn
* @Author: Aimee
* @Date: 2022-05-26 13:16:03
* @LastEditors: zhangdongxue zhangdongxue@uz.cn
* @LastEditTime: 2022-05-30 16:20:26
* @FilePath: /gl_dao/lib/pages/store/store.dart
* @LastEditors: Aimee
* @LastEditTime: 2022-05-31 14:49:55
* @FilePath: /gl_dao/lib/pages/store/index/index_page.dart
* @Description:
* // width: MediaQuery.of(context).size.width,
* // height: MediaQuery.of(context).size.height,
*/
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:gl_dao/main_color.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:gl_dao/pages/store/widget/offline_title.dart';
import '../details/details_page.dart';
import 'widget/offline_bussiness.dart';
import './components/offline_bussiness.dart';
import './components/offline_title.dart';
class StorePages extends StatefulWidget {
const StorePages({Key? key}) : super(key: key);
@@ -209,97 +209,105 @@ class _StorePagesState extends State<StorePages> with TickerProviderStateMixin {
//
List<Widget> _goodWidget() {
return categoryList.map((val) {
return Card(
// margin: const EdgeInsets.all(10.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
shadowColor: Colors.black12,
child: SizedBox(
width: MediaQuery.of(context).size.width / 2 - 25,
child: Column(
children: [
AspectRatio(
aspectRatio: 9.0 / 9.2,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
child: Image.network(
'https://www.itying.com/images/flutter/2.png',
fit: BoxFit.cover,
),
),
),
Container(
padding: const EdgeInsets.only(
left: 10,
right: 6,
top: 6,
bottom: 6,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 38,
width: double.infinity,
child: Text(
val["id"] == 1
? '雄风 - 人呀年瞎猜书迷功能与成语人呀年瞎猜书迷功能与成语人呀年瞎猜书迷功能与成语人呀年瞎猜书迷功能与成语'
: '富贵花开',
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 14,
color: tTextColor333,
fontWeight: FontWeight.w600,
),
strutStyle: const StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3, //0.5
),
maxLines: 2,
),
return GestureDetector(
onTap: () {
// ignore: avoid_print
print(val["id"]);
Get.to(const StoreDetailsPages());
},
child: Card(
// margin: const EdgeInsets.all(10.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
shadowColor: Colors.black12,
child: SizedBox(
width: MediaQuery.of(context).size.width / 2 - 25,
child: Column(
children: [
AspectRatio(
aspectRatio: 9.0 / 9.2,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: const [
Text(
'1999',
style: TextStyle(
fontSize: 18,
color: tMainRedColor,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 2),
Text(
'DT积分',
style: TextStyle(
fontSize: 12,
color: tMainRedColor,
),
),
],
),
const Text(
'月销量10',
style: TextStyle(
fontSize: 12,
color: tTextColor666,
),
)
],
)
],
child: Image.network(
'https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b',
fit: BoxFit.cover,
),
),
),
)
],
const SizedBox(height: 4),
Container(
padding: const EdgeInsets.only(
left: 10,
right: 6,
top: 6,
bottom: 6,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 38,
width: double.infinity,
child: Text(
val["id"] == 1 || val["id"] == 2 || val["id"] == 4
? '雄风 - 人呀年瞎猜书迷功能与成语人呀年瞎猜书迷功能与成语人呀年瞎猜书迷功能与成语人呀年瞎猜书迷功能与成语'
: '富贵花开',
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 14,
color: tTextColor333,
fontWeight: FontWeight.w600,
),
strutStyle: const StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3, //0.5
),
maxLines: 2,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: const [
Text(
'1999',
style: TextStyle(
fontSize: 18,
color: tMainRedColor,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 2),
Text(
'DT积分',
style: TextStyle(
fontSize: 12,
color: tMainRedColor,
),
),
],
),
const Text(
'月销量10',
style: TextStyle(
fontSize: 12,
color: tTextColor666,
),
)
],
)
],
),
),
],
),
),
),
);
@@ -359,44 +367,44 @@ class _StorePagesState extends State<StorePages> with TickerProviderStateMixin {
{
"title": '1名创优品',
"url":
"http://img5.mtime.cn/mg/2021/08/24/141454.81651527_285X160X4.jpg",
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b",
},
{
"title": '1耐克',
"url":
"http://img5.mtime.cn/mg/2021/08/24/134535.67957178_285X160X4.jpg"
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b"
},
{
"title": '1百草味',
"url":
"http://img5.mtime.cn/mg/2021/08/24/112722.60735295_285X160X4.jpg"
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b"
},
{
"title": '1MLB',
"url":
"http://img5.mtime.cn/mg/2021/08/24/110937.63038065_285X160X4.jpg"
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b"
},
],
[
{
"title": '名创优品',
"url":
"http://img5.mtime.cn/mg/2021/08/24/141454.81651527_285X160X4.jpg",
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b",
},
{
"title": '耐克',
"url":
"http://img5.mtime.cn/mg/2021/08/24/134535.67957178_285X160X4.jpg"
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b"
},
{
"title": '百草味',
"url":
"http://img5.mtime.cn/mg/2021/08/24/112722.60735295_285X160X4.jpg"
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b"
},
{
"title": 'MLB',
"url":
"http://img5.mtime.cn/mg/2021/08/24/110937.63038065_285X160X4.jpg"
"https://pics4.baidu.com/feed/a686c9177f3e6709d8176cf9c0a30a3af8dc5508.jpeg?token=b8f66e0570589dabfd098cd47d88927b"
},
]
];

View File

@@ -0,0 +1,157 @@
import 'package:flutter/material.dart';
class StorePages1 extends StatefulWidget {
const StorePages1({Key? key}) : super(key: key);
@override
_StorePages1State createState() => _StorePages1State();
}
class _StorePages1State extends State<StorePages1>
with TickerProviderStateMixin {
late TabController _tabController;
@override
void initState() {
_tabController = TabController(
length: 3,
vsync: this,
);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverToBoxAdapter(
child: Column(
children: [
Image.network(
"https://images.pexels.com/photos/396547/pexels-photo-396547.jpeg?auto=compress&cs=tinysrgb&h=350",
fit: BoxFit.cover,
)
],
),
),
SliverPersistentHeader(
delegate: _SliverAppBarDelegate(
TabBar(
controller: _tabController,
tabs: const [
Tab(text: "Tab 1"),
Tab(text: "Tab 2"),
Tab(text: "Tab 3"),
],
),
),
pinned: true,
),
];
},
body: TabBarView(
controller: _tabController,
children: [
ListView(
children: const [
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
Text('asdfasjkdfahsdjkl'),
],
),
const Center(
child: Text('Tab 2'),
),
const Center(
child: Text('Tab 3'),
),
],
),
),
),
);
}
}
class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
_SliverAppBarDelegate(this._tabBar);
final TabBar _tabBar;
@override
double get minExtent => _tabBar.preferredSize.height;
@override
double get maxExtent => _tabBar.preferredSize.height;
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return Container(
color: Colors.red,
child: _tabBar,
);
}
@override
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
return false;
}
}

View File

@@ -1,15 +0,0 @@
import 'package:flutter/material.dart';
class StoreListPages extends StatefulWidget {
const StoreListPages({Key? key}) : super(key: key);
@override
State<StoreListPages> createState() => _StoreListPagesState();
}
class _StoreListPagesState extends State<StoreListPages> {
@override
Widget build(BuildContext context) {
return const Text('商品列表');
}
}

View File

@@ -1,135 +0,0 @@
/*
* @Author: zhangdongxue zhangdongxue@uz.cn
* @Date: 2022-05-26 13:16:03
* @LastEditors: zhangdongxue zhangdongxue@uz.cn
* @LastEditTime: 2022-05-26 17:06:33
* @FilePath: /gl_dao/lib/pages/store/store.dart
* @Description: 商城首页
*/
import 'package:flutter/material.dart';
// import '../auth/auth.dart';
import '../../https/auth_api.dart';
class StorePages extends StatefulWidget {
const StorePages({Key? key}) : super(key: key);
@override
State<StorePages> createState() => _StorePagesState();
}
class _StorePagesState extends State<StorePages> {
@override
// void initState() {
// HttpApi().apiPost(
// 'user/auth/sms',
// body: {
// 'mobileNo': '18245180131',
// 'code': '0000',
// },
// );
// super.initState();
// }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
shadowColor: Colors.white.withOpacity(0),
backgroundColor: Colors.red.withOpacity(.9),
leadingWidth: 0,
leading: IconButton(
tooltip: 'hello',
icon: const Icon(
Icons.location_on_outlined,
size: 20,
),
onPressed: () {
print('menu Pressed');
},
),
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: selectCity,
child: const Text(
'全国',
style: TextStyle(
color: Colors.white,
fontSize: 15,
),
),
),
const SizedBox(width: 14),
Expanded(
flex: 1,
child: GestureDetector(
onTap: search,
child: Container(
padding: const EdgeInsets.only(left: 16),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(36.0),
),
color: Colors.white,
),
height: 34,
child: Row(
children: [
Image.asset(
'assets/images/search.png',
width: 16.0,
),
const SizedBox(width: 6),
const Text(
'请搜索商家或商品',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
],
),
),
),
),
],
),
centerTitle: true, // 是否居中显示
actions: <Widget>[
IconButton(
icon: const Icon(Icons.add),
tooltip: "more_horiz",
onPressed: () {
print('点击了加号');
},
)
],
),
body: Column(
children: [
Row(
children: [
// 按钮前面加上icon
ElevatedButton.icon(
onPressed: () {},
icon: Icon(Icons.search),
label: Text('图标按钮'),
),
],
)
],
),
);
}
selectCity() {
print('selectCity');
}
search() {
print('search');
}
}