diff --git a/lib/article/hot_article_item.dart b/lib/article/hot_article_item.dart index eb3a502d..bf9a17e8 100644 --- a/lib/article/hot_article_item.dart +++ b/lib/article/hot_article_item.dart @@ -1,14 +1,12 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/hot_item.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -83,13 +81,13 @@ class _HotArticlePage extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: MyAppBar( - background: Color(0xFFF7F7F7), - leadingColor: Colors.black, - title: S.of(context).huixiangtoutiao, - titleColor: Colors.black, - titleSize: 18.sp, - ), + // appBar: MyAppBar( + // background: Color(0xFFF7F7F7), + // leadingColor: Colors.black, + // title: S.of(context).huixiangtoutiao, + // titleColor: Colors.black, + // titleSize: 18.sp, + // ), body: Container( child: SmartRefresher( controller: refreshController, diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 03a696d9..0afd229b 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:huixiang/article/hot_article_item.dart'; import 'package:huixiang/community/community_child_page.dart'; +import 'package:huixiang/home/home_view/hot_article.dart'; import 'package:huixiang/home/huixiang_brand_page.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -89,6 +91,8 @@ class _CommunityPage extends State children: lables.map((e) { if (e == "关于我们") { return BrandPage(); + }else if(e == "头条"){ + return HotArticlePage(); } else { return CommunityChildPage(); } diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index 564a42d2..e967fa71 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -18,8 +18,6 @@ import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/store/store_view/settlement_order_commodity.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:huixiang/view_widget/rename_dialog.dart'; -import 'package:huixiang/view_widget/rename_dialog_content.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/separator.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -833,6 +831,7 @@ class _Settlement extends State { ); } + ///支付方式 Widget payMethod() { return Container( width: double.infinity, diff --git a/lib/view_widget/hot_item.dart b/lib/view_widget/hot_item.dart index 82bcbc64..3f8db488 100644 --- a/lib/view_widget/hot_item.dart +++ b/lib/view_widget/hot_item.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; @@ -22,6 +21,8 @@ class HotArticleItem extends StatefulWidget { } class _HotArticleItem extends State { + + @override Widget build(BuildContext context) { return GestureDetector( @@ -41,7 +42,7 @@ class _HotArticleItem extends State { Widget hotItem(BuildContext context) { return Container( - padding: EdgeInsets.all((widget.isHot == null || !widget.isHot) ? 8 : 0), + padding: EdgeInsets.all((widget.isHot == null || !widget.isHot) ? 4 : 0), decoration: BoxDecoration( color: Colors.white, boxShadow: [ @@ -55,44 +56,122 @@ class _HotArticleItem extends State { borderRadius: BorderRadius.circular(4), ), child: (widget.isHot == null || !widget.isHot) - ? Row( - children: [ - Visibility( - visible: widget.article != null && - widget.article.coverImg != null && - widget.article.coverImg != "", - child: Stack( - alignment: Alignment.center, - children: [ - MImage( - widget.article != null ? widget.article.coverImg : "", - fit: BoxFit.cover, - radius: BorderRadius.circular(2), - aspectRatio: 1, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - Visibility( - visible: (widget.article != null && - widget.article.coverImg != "" && - widget.article.coverImg.endsWith(".mp4")), - child: Icon( - Icons.play_circle_outline, - size: 24, - color: Colors.white, + ? Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 44, + child: Row( + children: [ + MImage( + (widget.article != null && + widget.article.author != null) + ? widget.article.author.avatar + : "", + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox( + width: 8, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + (widget.article != null && + widget.article.author != null) + ? widget.article.author.name + : "", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF1A1A1A), + ), ), - ), - ], - ), + Text( + widget.article != null + ? (widget.article.createTime.split(" ")[0]) + : "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + ), + ], + ), + ], ), - Expanded( - child: Container( - margin: EdgeInsets.only(left: 8.w), - child: articleText(context), + ), + GestureDetector( + onTap: (){ + }, + child: RoundButton( + padding: EdgeInsets.symmetric( + horizontal: 8, + vertical: 3, + ), + backgroup: Color(0xFF32A060), + textColor: Colors.white , + text: "关注", + radius: 20, + icons: Icon( + Icons.check, + color: Color(0xFF808080), + size: 14, ), ), - ], - ) + ), + ], + ), + Expanded(child:Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(left: 12.w), + child: articleTextTow(context), + ), + ), + Visibility( + visible: widget.article != null && + widget.article.coverImg != null && + widget.article.coverImg != "", + child:Stack( + alignment: Alignment.center, + children: [ + MImage( + widget.article != null ? widget.article.coverImg : "", + fit: BoxFit.cover, + radius: BorderRadius.circular(2), + aspectRatio: 1, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + Visibility( + visible: (widget.article != null && + widget.article.coverImg != "" && + widget.article.coverImg.endsWith(".mp4")), + child: Icon( + Icons.play_circle_outline, + size: 24, + color: Colors.white, + ), + ), + ], + ), + ), + ], + )), + ], + ) : Column( children: articleContent(context), ), @@ -113,7 +192,7 @@ class _HotArticleItem extends State { maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( - fontWeight: FontWeight.w600, + fontWeight: MyFontWeight.medium, fontSize: 14.sp, color: Colors.black, ), @@ -140,7 +219,7 @@ class _HotArticleItem extends State { maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( - fontWeight: FontWeight.w600, + fontWeight: MyFontWeight.medium, fontSize: 14.sp, color: Colors.black, ), @@ -158,7 +237,7 @@ class _HotArticleItem extends State { overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 12.sp, - fontWeight: FontWeight.w400, + fontWeight: MyFontWeight.regular, color: Color(0xFF353535), ), ), @@ -174,49 +253,50 @@ class _HotArticleItem extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - S.of(context).zuozhe((widget.article != null && - widget.article.author != null) - ? widget.article.author.name - : ""), + // S.of(context).zuozhe(), + (widget.article != null && + widget.article.author != null) + ? widget.article.author.name + : "", style: TextStyle( - fontSize: 10.sp, - fontWeight: FontWeight.w400, - color: Color(0xFFB2B2B2), + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF1A1A1A), ), ), SizedBox( - width: 12.w, + width: 14.w, ), Container( alignment: Alignment.topRight, child: Row( children: [ Image.asset( - "assets/image/icon_likes.png", + "assets/image/browse.png", width: 16.w, height: 16.h, ), Text( (widget.article != null) - ? "${widget.article.likes}" + ? "${widget.article.viewers}" : "", style: TextStyle( - fontSize: 10.sp, - color: Color(0xFFB2B2B2), + fontSize: 12.sp, + color: Color(0xFF1A1A1A), ), ), ], ), ), SizedBox( - width: 12.w, + width: 14.w, ), Container( alignment: Alignment.topRight, child: Row( children: [ Image.asset( - "assets/image/icon_views.png", + "assets/image/leaving_message.png", width: 16.w, height: 16.h, ), @@ -225,8 +305,32 @@ class _HotArticleItem extends State { ? "${widget.article.viewers}" : "", style: TextStyle( - fontSize: 10.sp, - color: Color(0xFFB2B2B2), + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + ), + ), + ], + ), + ), + SizedBox( + width: 14.w, + ), + Container( + alignment: Alignment.topRight, + child: Row( + children: [ + Image.asset( + "assets/image/follow.png", + width: 16.w, + height: 16.h, + ), + Text( + (widget.article != null) + ? "${widget.article.likes}" + : "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), ), ), ], @@ -242,11 +346,11 @@ class _HotArticleItem extends State { ? (widget.article.createTime.split(" ")[0]) : "", textStyle: TextStyle( - fontSize: 10.sp, - fontWeight: FontWeight.w400, + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, color: Color(0xFFB2B2B2), ), - leftIcon: Icons.access_time_rounded, + // leftIcon: Icons.access_time_rounded, iconSize: 10, iconColor: Color(0xFFB2B2B2), ), @@ -256,6 +360,159 @@ class _HotArticleItem extends State { ); } + Widget articleTextTow(context) { + return Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (widget.isHot == null || !widget.isHot) + ? Text( + widget.article != null ? widget.article.mainTitle : "", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Colors.black, + ), + ) + : Row( + children: [ + RoundButton( + text: "HOT", + textColor: Colors.white, + backgroup: Color(0xFFFF441A), + radius: 2, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + padding: EdgeInsets.all(2), + ), + SizedBox( + width: 6.w, + ), + Expanded( + child: Text( + widget.article != null + ? widget.article.mainTitle + : "", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Colors.black, + ), + ), + flex: 1, + ), + ], + ), + SizedBox( + height: 4.h, + ), + Text( + widget.article != null ? (widget.article.viceTitle ?? "") : "", + maxLines: AppUtils.textScale(context) > 1.05 ? 1 : 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + alignment: Alignment.topRight, + child: Row( + children: [ + Image.asset( + "assets/image/browse.png", + width: 16.w, + height: 16.h, + ), + Text( + (widget.article != null) + ? "${widget.article.viewers}" + : "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + ), + ), + ], + ), + ), + SizedBox( + width: 32.w, + ), + Container( + alignment: Alignment.topRight, + child: Row( + children: [ + Image.asset( + "assets/image/leaving_message.png", + width: 16.w, + height: 16.h, + ), + Text( + (widget.article != null) + ? "${widget.article.viewers}" + : "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + ), + ), + ], + ), + ), + SizedBox( + width: 32.w, + ), + Container( + alignment: Alignment.topRight, + child: Row( + children: [ + Image.asset( + "assets/image/follow.png", + width: 16.w, + height: 16.h, + ), + Text( + (widget.article != null) + ? "${widget.article.likes}" + : "", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF1A1A1A), + ), + ), + ], + ), + ), + ], + ), + flex: 1, + ), + ], + ), + ], + ); + } + List articleContent(context) { return [ Expanded(