From 076383b9b2e084548d7fe20bf17b42ce51f8efce Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 19 Oct 2021 11:59:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/min_api.g.dart | 8 +++----- pubspec.lock | 14 +++++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index dbd499fb..82eacf8b 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -127,7 +127,7 @@ class _MinApiService implements MinApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, ); return value; } @@ -139,8 +139,7 @@ class _MinApiService implements MinApiService { final queryParameters = {}; final _data = {}; _data.addAll(param ?? {}); - final _result = await _dio.request>( - 'order/settlement', + final _result = await _dio.request>('order/settlement', queryParameters: queryParameters, options: RequestOptions( method: 'POST', @@ -150,9 +149,8 @@ class _MinApiService implements MinApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, ); return value; } - } diff --git a/pubspec.lock b/pubspec.lock index 82714253..aee75a6d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -175,7 +175,7 @@ packages: name: cli_util url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.4" + version: "0.3.5" clock: dependency: transitive description: @@ -395,7 +395,7 @@ packages: name: flutter_smart_dialog url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.6" + version: "2.3.8" flutter_spinkit: dependency: "direct main" description: @@ -409,7 +409,7 @@ packages: name: flutter_staggered_grid_view url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.0" + version: "0.4.1" flutter_svg: dependency: "direct main" description: @@ -440,7 +440,7 @@ packages: name: fluwx url: "https://pub.flutter-io.cn" source: hosted - version: "3.6.1+2" + version: "3.6.1+3" font_awesome_flutter: dependency: "direct main" description: @@ -545,7 +545,7 @@ packages: name: keframe url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.2" + version: "2.0.3" like_button: dependency: "direct main" description: @@ -587,7 +587,7 @@ packages: name: mime url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.0" + version: "1.0.1" package_config: dependency: transitive description: @@ -615,7 +615,7 @@ packages: name: path_drawing url: "https://pub.flutter-io.cn" source: hosted - version: "0.5.1" + version: "0.5.1+1" path_parsing: dependency: transitive description: From 39f963dfbc63dea5bcde31912d691f949886bd75 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 19 Oct 2021 18:43:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/article/hot_article_item.dart | 16 +- lib/community/community_page.dart | 4 + lib/store/store_view/settlement.dart | 3 +- lib/view_widget/hot_item.dart | 373 ++++++++++++++++++++++----- 4 files changed, 327 insertions(+), 69 deletions(-) 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(