Browse Source

Merge branch 'master' into dev

master
w-R 3 years ago
parent
commit
b669b50cff
  1. 13
      assets/svg/liulanliang.svg
  2. 15
      assets/svg/pinglun.svg
  3. 16
      assets/svg/shequ_fabu.svg
  4. 14
      assets/svg/xihuan.svg
  5. 181
      lib/community/community_child_page.dart
  6. 89
      lib/community/community_page.dart
  7. 1
      lib/home/home_view/featured_acticvity.dart
  8. 2
      lib/home/home_view/quick_order.dart
  9. 90
      lib/home/huixiang_brand_page.dart
  10. 12
      lib/store/store_order.dart
  11. 96
      lib/view_widget/icon_text.dart

13
assets/svg/liulanliang.svg

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icon-27-liulan</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="推荐" transform="translate(-16.000000, -668.000000)" fill-rule="nonzero">
<g id="编组" transform="translate(16.000000, 668.000000)">
<rect id="矩形" fill="#1A1A1A" opacity="0" x="0" y="0" width="16" height="16"></rect>
<path d="M8,13.565625 C4.784375,13.565625 1.9859375,11.28125 1.346875,8.1328125 C1.32968735,8.04510495 1.32968735,7.95489505 1.346875,7.8671875 C1.9859375,4.71875 4.784375,2.434375 8,2.434375 C11.2171875,2.434375 14.015625,4.71875 14.653125,7.8671875 C14.6703127,7.95489505 14.6703127,8.04510495 14.653125,8.1328125 C14.015625,11.28125 11.2171875,13.565625 8,13.565625 Z" id="路径" stroke="#1A1A1A" stroke-width="1.2"></path>
<path d="M8,10.6671875 C6.5296875,10.6671875 5.3328125,9.471875 5.3328125,8 C5.3328125,6.5296875 6.5296875,5.3328125 8,5.3328125 C9.4703125,5.3328125 10.6671875,6.5296875 10.6671875,8 C10.6671875,9.4703125 9.4703125,10.6671875 8,10.6671875 Z" id="路径" stroke="#1A1A1A" stroke-width="1.2"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

15
assets/svg/pinglun.svg

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>编组 8</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="推荐" transform="translate(-169.000000, -668.000000)">
<g id="编组-8" transform="translate(169.000000, 668.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<g id="Icon-pinglun" transform="translate(2.000000, 2.000000)">
<path d="M10.4571429,0 L1.54285714,0 C0.691071429,0 0.00133928564,0.70620438 0,1.57664234 L0,7.8024635 C0,8.67153285 0.692410714,9.37910584 1.54285714,9.37910584 L6.25714286,9.37910584 L8.671875,11.8467153 C8.77232143,11.9493613 8.90357143,12 9.03616071,12 C9.16741071,12 9.3,11.9493613 9.40044643,11.8467153 C9.60133929,11.6414234 9.60133929,11.3088504 9.40044643,11.1035584 L6.93616071,8.58531022 C6.77544643,8.41970803 6.55714286,8.32801095 6.32946429,8.32801095 L1.54285714,8.32801095 C1.25892857,8.32801095 1.02857143,8.09260949 1.02857143,7.8024635 L1.02857143,1.57664234 C1.02857143,1.28649635 1.25892857,1.05109489 1.54285714,1.05109489 L10.4571429,1.05109489 C10.7410714,1.05109489 10.9714286,1.28649635 10.9714286,1.57664234 L10.9714286,7.8024635 C10.9714286,8.09260949 10.7410714,8.32801095 10.4571429,8.32801095 L9.29196429,8.32801095 C9.00803571,8.32801095 8.77767857,8.56341241 8.77767857,8.85355839 C8.77767857,9.14370438 9.00803571,9.37910584 9.29196429,9.37910584 L10.4571429,9.37910584 C11.3075893,9.37910584 12,8.67153285 12,7.8024635 L12,1.57664234 C12,0.707572993 11.3075893,0 10.4571429,0 Z" id="路径" fill="#1A1A1A" fill-rule="nonzero"></path>
<polyline id="路径-2" stroke="#1A1A1A" stroke-linecap="round" stroke-linejoin="round" points="9.76420825 8.82738134 8.56605076 8.82738134 9.12695649 11.5829973"></polyline>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

16
assets/svg/shequ_fabu.svg

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>扫一扫icon</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="推荐" transform="translate(-334.000000, -57.000000)">
<g id="扫一扫icon" transform="translate(334.000000, 57.000000)">
<rect id="矩形" x="0" y="0" width="24" height="24"></rect>
<rect id="矩形" x="3.6" y="3.6" width="16.8" height="16.8"></rect>
<g id="编组-23" transform="translate(5.000000, 5.000000)" fill="#000000">
<rect id="矩形" x="0" y="6.4" width="14" height="1.2" rx="0.5"></rect>
<rect id="矩形" transform="translate(7.000000, 7.000000) rotate(-270.000000) translate(-7.000000, -7.000000) " x="0" y="6.4" width="14" height="1.2" rx="0.5"></rect>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

14
assets/svg/xihuan.svg

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>编组 6备份 2</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="推荐" transform="translate(-322.000000, -668.000000)">
<g id="编组-7" transform="translate(322.000000, 668.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<g id="Icon-xinaixin-fubenbeifen" transform="translate(2.000000, 2.716412)" fill-rule="nonzero" stroke="#1A1A1A">
<path d="M10.9531954,1.03028095 C9.59982166,-0.299970564 7.4205503,-0.346215052 5.99853238,0.915753589 C4.57615318,-0.345853771 2.3972431,-0.299970564 1.04386934,1.03028095 C-0.332626663,2.40677695 -0.355387621,4.65433119 1.0207471,6.05358815 L1.0666303,6.09947135 L5.19539573,10.2285981 C5.63569467,10.6710355 6.34864665,10.6811403 6.80130774,10.251359 L6.8240687,10.2285981 L10.9531954,6.09947135 C12.3296914,4.72297535 12.3524524,2.47542111 10.9990786,1.0992864 C10.9763177,1.05304191 10.9763177,1.05304191 10.9531954,1.03028095 Z" id="路径"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

181
lib/community/community_child_page.dart

@ -0,0 +1,181 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/round_button.dart';
class CommunityChildPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _CommunityChildPage();
}
}
class _CommunityChildPage extends State<CommunityChildPage> {
@override
Widget build(BuildContext context) {
return ListView.builder(
itemBuilder: (context, position) {
return dynamicItem();
},
itemCount: 13,
);
}
int imageCount = 9;
Widget dynamicItem() {
return Container(
margin: EdgeInsets.only(bottom: 16.h),
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x08000000),
offset: Offset(0, 1),
blurRadius: 8,
spreadRadius: 0,
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 44,
child: Row(
children: [
ClipRRect(
child: Image.asset(
"assets/image/default_user.png",
width: 44,
height: 44,
),
borderRadius: BorderRadius.circular(22),
),
SizedBox(
width: 8,
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"百花谷",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF1A1A1A),
),
),
Text(
"2021.04.12",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF808080),
),
),
],
),
],
),
),
RoundButton(
padding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
backgroup: Color(0xFF32A060),
textColor: Colors.white,
text: "关注",
radius: 20,
icons: SvgPicture.asset(
"assets/svg/shequ_fabu.svg",
fit: BoxFit.contain,
color: Colors.white,
width: 14,
height: 14,
),
),
],
),
SizedBox(
height: 12.h,
),
Text(
"文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Message)的一个句子或多个句子的组说,通常是具有完整、系统含义(Message)的一个句子或多个句子的组或多个句子的组说。",
maxLines: 5,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF1A1A1A),
fontWeight: MyFontWeight.regular,
fontSize: 14.sp,
),
),
SizedBox(
height: 16.h,
),
if (imageCount == 1)
Container(
width: MediaQuery.of(context).size.width / 2,
height: MediaQuery.of(context).size.width,
color: Colors.blue.withAlpha(123),
)
else
GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: (imageCount == 2 || imageCount == 4) ? 2 : 3,
crossAxisSpacing: 12.w,
mainAxisSpacing: 12.w,
childAspectRatio: 1,
),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return Container(
color: Colors.blue.withAlpha(123),
);
},
itemCount: imageCount,
),
SizedBox(
height: 12.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconText(
"58",
space: 4.w,
leftImage: "assets/svg/liulanliang.svg",
iconSize: 16,
),
IconText(
"58",
space: 4.w,
leftImage: "assets/svg/pinglun.svg",
iconSize: 16,
),
IconText(
"58",
space: 4.w,
leftImage: "assets/svg/xihuan.svg",
iconSize: 16,
),
],
),
],
),
);
}
}

89
lib/community/community_page.dart

@ -1,23 +1,90 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:huixiang/community/community_child_page.dart';
import 'package:huixiang/home/huixiang_brand_page.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_tab.dart';
class CommunityPage extends StatefulWidget { class CommunityPage extends StatefulWidget {
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _CommunityPage(); return _CommunityPage();
} }
} }
class _CommunityPage extends State<CommunityPage> { class _CommunityPage extends State<CommunityPage> with SingleTickerProviderStateMixin {
TabController tabcontroller;
List<String> lables = [
"关注",
"推荐",
"头条",
"关于我们",
// "课程",
// "直播",
];
@override @override
Widget build(BuildContext context) { void initState() {
return Scaffold(); super.initState();
if (tabcontroller == null)
tabcontroller = TabController(length: lables.length, vsync: this);
} }
} @override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
leading: false,
titleChild: PreferredSize(
preferredSize: Size(
MediaQuery.of(context).size.width - 60,
38.h,
),
child: TabBar(
controller: tabcontroller,
automaticIndicatorColorAdjustment: true,
isScrollable: true,
indicatorWeight: 2,
indicatorColor: Color(0xFF39B54A),
labelPadding: EdgeInsets.only(left: 8.w, right: 8.w),
indicatorSize: TabBarIndicatorSize.label,
unselectedLabelStyle: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.w400,
),
labelStyle: TextStyle(
color: Colors.black,
fontSize: 18.sp,
fontWeight: FontWeight.bold,
),
labelColor: Colors.black,
tabs: lables.map((e) => MyTab(text: e)).toList(),
),
),
action: SvgPicture.asset(
"assets/svg/shequ_fabu.svg",
fit: BoxFit.contain,
width: 24,
height: 24,
),
),
body: Container(
padding: EdgeInsets.only(bottom: 76.h),
child: TabBarView(
physics: BouncingScrollPhysics(),
children: lables.map((e) {
if (e == "关于我们") {
return BrandPage();
} else {
return CommunityChildPage();
}
}).toList(),
controller: tabcontroller,
),
),
);
}
}

1
lib/home/home_view/featured_acticvity.dart

@ -3,7 +3,6 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/item_title.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart';
class FeaturedActivity extends StatefulWidget { class FeaturedActivity extends StatefulWidget {
@override @override

2
lib/home/home_view/quick_order.dart

@ -18,7 +18,7 @@ class _QuickOrder extends State<QuickOrder> {
return Column( return Column(
children: [ children: [
ItemTitle( ItemTitle(
text: S.of(context).jifenshangcheng, text: "快捷下单",
imgPath: "assets/image/icon_points_mall.png", imgPath: "assets/image/icon_points_mall.png",
), ),
Container( Container(

90
lib/home/huixiang_brand_page.dart

@ -107,63 +107,53 @@ class _BrandPage extends State<BrandPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Scaffold( return Stack(
appBar: AppBar( children: [
toolbarHeight: 40.h - MediaQuery.of(context).padding.top, Positioned(
backgroundColor: Colors.transparent, child: Container(
elevation: 0, child: SmartRefresher(
), controller: refreshController,
body: Container( enablePullDown: true,
padding: EdgeInsets.only(bottom: 76.h), enablePullUp: false,
child: Stack( header: MyHeader(),
children: [ physics: ClampingScrollPhysics(),
Positioned( onRefresh: queryHome,
scrollController: scrollController,
child: Container( child: Container(
child: SmartRefresher( child: SingleChildScrollView(
controller: refreshController, physics: NeverScrollableScrollPhysics(),
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: ClampingScrollPhysics(),
onRefresh: queryHome,
scrollController: scrollController,
child: Container( child: Container(
child: SingleChildScrollView( color: Color(0xFFF7F7F7),
physics: NeverScrollableScrollPhysics(), margin: EdgeInsets.only(top: 16.h),
child: Container( child: Column(
color: Color(0xFFF7F7F7), children: homeChildItem(),
margin: EdgeInsets.only(top: 16.h),
child: Column(
children: homeChildItem(),
),
),
), ),
), ),
), ),
), ),
bottom: 0,
top: 0,
left: 0,
right: 0,
), ),
if (brands != null && brands.length > 0) ),
Positioned( bottom: 0,
child: Container( top: 0,
color: Colors.white, left: 0,
child: StoreTitleTab( right: 0,
brands,
globaKeys,
scrollController,
isScroll: true,
),
),
top: 0,
left: 0,
right: 0,
),
],
), ),
), if (brands != null && brands.length > 0)
Positioned(
child: Container(
color: Colors.white,
child: StoreTitleTab(
brands,
globaKeys,
scrollController,
isScroll: true,
),
),
top: 0,
left: 0,
right: 0,
),
],
); );
} }
@ -180,7 +170,7 @@ class _BrandPage extends State<BrandPage>
globaKeys, globaKeys,
scrollController, scrollController,
isScroll: false, isScroll: false,
) ),
]; ];
if (brands == null) return widgets; if (brands == null) return widgets;
brands.forEach((value) { brands.forEach((value) {

12
lib/store/store_order.dart

@ -39,8 +39,7 @@ class StoreOrderPage extends StatefulWidget {
} }
} }
class _StoreOrderPage extends State<StoreOrderPage> class _StoreOrderPage extends State<StoreOrderPage> with TickerProviderStateMixin/*, AutomaticKeepAliveClientMixin*/ {
with TickerProviderStateMixin/*, AutomaticKeepAliveClientMixin*/ {
TabController tabcontroller; TabController tabcontroller;
ApiService apiService; ApiService apiService;
MinApiService minService; MinApiService minService;
@ -172,7 +171,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
sliver: SliverAppBar( sliver: SliverAppBar(
expandedHeight: (storeInfo != null && expandedHeight: (storeInfo != null &&
storeInfo.couponVOList != null) storeInfo.couponVOList != null)
? 425.h ? 470.h
: 365.h, : 365.h,
floating: false, floating: false,
snap: false, snap: false,
@ -240,12 +239,17 @@ class _StoreOrderPage extends State<StoreOrderPage>
coupon: true, coupon: true,
), ),
if (storeInfo == null || storeInfo.couponVOList == null)
SizedBox(
height: 8,
),
///VIP信息 ///VIP信息
Vip(storeInfo, () {}, false), Vip(storeInfo, () {}, false),
], ],
), ),
), ),
top: 100.h, top: 110.h,
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,

96
lib/view_widget/icon_text.dart

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class IconText extends StatelessWidget { class IconText extends StatelessWidget {
final String leftImage; final String leftImage;
@ -46,38 +47,52 @@ class IconText extends StatelessWidget {
} else if (leftImage != null && leftImage != "") { } else if (leftImage != null && leftImage != "") {
widgets.add(Padding( widgets.add(Padding(
padding: EdgeInsets.only(left: 2), padding: EdgeInsets.only(left: 2),
child: leftImage.startsWith("http") ? Image.network( child: leftImage.startsWith("http")
leftImage, ? Image.network(
width: iconSize, leftImage,
height: iconSize, width: iconSize,
) : Image.asset( height: iconSize,
leftImage, )
width: iconSize, : (leftImage.endsWith(".svg")
height: iconSize, ? SvgPicture.asset(
), leftImage,
width: iconSize,
height: iconSize,
)
: Image.asset(
leftImage,
width: iconSize,
height: iconSize,
)),
)); ));
} }
} }
widgets.add(SizedBox(width: space,)); widgets.add(SizedBox(
width: space,
widgets.add(isMax ? Expanded(
child: Text(
text,
overflow: overFlow,
maxLines: 2,
textAlign: TextAlign.start,
style: textStyle,
),
flex: 1,
) : Text(
text,
overflow: overFlow,
textAlign: TextAlign.center,
style: textStyle,
)); ));
widgets.add(SizedBox(width: space,)); widgets.add(isMax
? Expanded(
child: Text(
text,
overflow: overFlow,
maxLines: 2,
textAlign: TextAlign.start,
style: textStyle,
),
flex: 1,
)
: Text(
text,
overflow: overFlow,
textAlign: TextAlign.center,
style: textStyle,
));
widgets.add(SizedBox(
width: space,
));
if (rightIcon != null || rightImage != null && rightImage != "") { if (rightIcon != null || rightImage != null && rightImage != "") {
if (rightIcon != null) { if (rightIcon != null) {
@ -95,22 +110,31 @@ class IconText extends StatelessWidget {
widgets.add( widgets.add(
Padding( Padding(
padding: EdgeInsets.only(left: 2), padding: EdgeInsets.only(left: 2),
child: rightImage.startsWith("http") ? Image.network( child: rightImage.startsWith("http")
rightImage, ? Image.network(
width: iconSize, rightImage,
height: iconSize, width: iconSize,
) : Image.asset( height: iconSize,
rightImage, )
width: iconSize, : (rightImage.endsWith(".svg")
height: iconSize, ? SvgPicture.asset(
), rightImage,
width: iconSize,
height: iconSize,
)
: Image.asset(
rightImage,
width: iconSize,
height: iconSize,
)),
), ),
); );
} }
} }
return Container( return Container(
child: Row( child: Row(
mainAxisAlignment: isMax ? MainAxisAlignment.center : MainAxisAlignment.start, mainAxisAlignment:
isMax ? MainAxisAlignment.center : MainAxisAlignment.start,
crossAxisAlignment: textAxisAlignment, crossAxisAlignment: textAxisAlignment,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: widgets, children: widgets,

Loading…
Cancel
Save