diff --git a/assets/svg/liulanliang.svg b/assets/svg/liulanliang.svg new file mode 100644 index 00000000..e8366b7f --- /dev/null +++ b/assets/svg/liulanliang.svg @@ -0,0 +1,13 @@ + + + Icon-27-liulan + + + + + + + + + + \ No newline at end of file diff --git a/assets/svg/pinglun.svg b/assets/svg/pinglun.svg new file mode 100644 index 00000000..3b08a6a4 --- /dev/null +++ b/assets/svg/pinglun.svg @@ -0,0 +1,15 @@ + + + 编组 8 + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/svg/shequ_fabu.svg b/assets/svg/shequ_fabu.svg new file mode 100644 index 00000000..1377e32b --- /dev/null +++ b/assets/svg/shequ_fabu.svg @@ -0,0 +1,16 @@ + + + 扫一扫icon + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/svg/xihuan.svg b/assets/svg/xihuan.svg new file mode 100644 index 00000000..c3ecfdbb --- /dev/null +++ b/assets/svg/xihuan.svg @@ -0,0 +1,14 @@ + + + 编组 6备份 2 + + + + + + + + + + + \ No newline at end of file diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart new file mode 100644 index 00000000..16ba0576 --- /dev/null +++ b/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 createState() { + return _CommunityChildPage(); + } +} + +class _CommunityChildPage extends State { + @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, + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 281b7023..05b3dda4 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -1,23 +1,90 @@ - - - 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 { - - - @override State createState() { return _CommunityPage(); } - } -class _CommunityPage extends State { +class _CommunityPage extends State with SingleTickerProviderStateMixin { + TabController tabcontroller; + + List lables = [ + "关注", + "推荐", + "头条", + "关于我们", + // "课程", + // "直播", + ]; + @override - Widget build(BuildContext context) { - return Scaffold(); + void initState() { + super.initState(); + + if (tabcontroller == null) + tabcontroller = TabController(length: lables.length, vsync: this); } -} \ No newline at end of file + @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, + ), + ), + ); + } +} diff --git a/lib/home/home_view/featured_acticvity.dart b/lib/home/home_view/featured_acticvity.dart index 8d90ff3f..057a0056 100644 --- a/lib/home/home_view/featured_acticvity.dart +++ b/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/view_widget/item_title.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:huixiang/view_widget/round_button.dart'; class FeaturedActivity extends StatefulWidget { @override diff --git a/lib/home/home_view/quick_order.dart b/lib/home/home_view/quick_order.dart index 5895d099..258fb70f 100644 --- a/lib/home/home_view/quick_order.dart +++ b/lib/home/home_view/quick_order.dart @@ -18,7 +18,7 @@ class _QuickOrder extends State { return Column( children: [ ItemTitle( - text: S.of(context).jifenshangcheng, + text: "快捷下单", imgPath: "assets/image/icon_points_mall.png", ), Container( diff --git a/lib/home/huixiang_brand_page.dart b/lib/home/huixiang_brand_page.dart index 4d2fc7a3..f8e7d829 100644 --- a/lib/home/huixiang_brand_page.dart +++ b/lib/home/huixiang_brand_page.dart @@ -107,63 +107,53 @@ class _BrandPage extends State @override Widget build(BuildContext context) { super.build(context); - return Scaffold( - appBar: AppBar( - toolbarHeight: 40.h - MediaQuery.of(context).padding.top, - backgroundColor: Colors.transparent, - elevation: 0, - ), - body: Container( - padding: EdgeInsets.only(bottom: 76.h), - child: Stack( - children: [ - Positioned( + return Stack( + children: [ + Positioned( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: ClampingScrollPhysics(), + onRefresh: queryHome, + scrollController: scrollController, child: Container( - child: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: false, - header: MyHeader(), - physics: ClampingScrollPhysics(), - onRefresh: queryHome, - scrollController: scrollController, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), child: Container( - child: SingleChildScrollView( - physics: NeverScrollableScrollPhysics(), - child: Container( - color: Color(0xFFF7F7F7), - margin: EdgeInsets.only(top: 16.h), - child: Column( - children: homeChildItem(), - ), - ), + color: Color(0xFFF7F7F7), + 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( - child: Container( - color: Colors.white, - child: StoreTitleTab( - brands, - globaKeys, - scrollController, - isScroll: true, - ), - ), - top: 0, - left: 0, - right: 0, - ), - ], + ), + bottom: 0, + 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 globaKeys, scrollController, isScroll: false, - ) + ), ]; if (brands == null) return widgets; brands.forEach((value) { diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 0bd28e56..a4c0931e 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -39,8 +39,7 @@ class StoreOrderPage extends StatefulWidget { } } -class _StoreOrderPage extends State - with TickerProviderStateMixin/*, AutomaticKeepAliveClientMixin*/ { +class _StoreOrderPage extends State with TickerProviderStateMixin/*, AutomaticKeepAliveClientMixin*/ { TabController tabcontroller; ApiService apiService; MinApiService minService; @@ -172,7 +171,7 @@ class _StoreOrderPage extends State sliver: SliverAppBar( expandedHeight: (storeInfo != null && storeInfo.couponVOList != null) - ? 425.h + ? 470.h : 365.h, floating: false, snap: false, @@ -240,12 +239,17 @@ class _StoreOrderPage extends State coupon: true, ), + if (storeInfo == null || storeInfo.couponVOList == null) + SizedBox( + height: 8, + ), + ///门店对应VIP信息 Vip(storeInfo, () {}, false), ], ), ), - top: 100.h, + top: 110.h, bottom: 0, left: 0, right: 0, diff --git a/lib/view_widget/icon_text.dart b/lib/view_widget/icon_text.dart index d7159535..5e90ce53 100644 --- a/lib/view_widget/icon_text.dart +++ b/lib/view_widget/icon_text.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; class IconText extends StatelessWidget { final String leftImage; @@ -46,38 +47,52 @@ class IconText extends StatelessWidget { } else if (leftImage != null && leftImage != "") { widgets.add(Padding( padding: EdgeInsets.only(left: 2), - child: leftImage.startsWith("http") ? Image.network( - leftImage, - width: iconSize, - height: iconSize, - ) : Image.asset( - leftImage, - width: iconSize, - height: iconSize, - ), + child: leftImage.startsWith("http") + ? Image.network( + leftImage, + width: iconSize, + height: iconSize, + ) + : (leftImage.endsWith(".svg") + ? SvgPicture.asset( + leftImage, + width: iconSize, + height: iconSize, + ) + : Image.asset( + leftImage, + width: iconSize, + height: iconSize, + )), )); } } - 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(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) { @@ -95,22 +110,31 @@ class IconText extends StatelessWidget { widgets.add( Padding( padding: EdgeInsets.only(left: 2), - child: rightImage.startsWith("http") ? Image.network( - rightImage, - width: iconSize, - height: iconSize, - ) : Image.asset( - rightImage, - width: iconSize, - height: iconSize, - ), + child: rightImage.startsWith("http") + ? Image.network( + rightImage, + width: iconSize, + height: iconSize, + ) + : (rightImage.endsWith(".svg") + ? SvgPicture.asset( + rightImage, + width: iconSize, + height: iconSize, + ) + : Image.asset( + rightImage, + width: iconSize, + height: iconSize, + )), ), ); } } return Container( child: Row( - mainAxisAlignment: isMax ? MainAxisAlignment.center : MainAxisAlignment.start, + mainAxisAlignment: + isMax ? MainAxisAlignment.center : MainAxisAlignment.start, crossAxisAlignment: textAxisAlignment, mainAxisSize: MainAxisSize.min, children: widgets,