Browse Source

Merge branches 'dev' and 'master' of https://git.lotus-wallet.com/fmk/huixiang_app

 Conflicts:
	lib/store/store_view/settlement.dart
master
fmk 3 years ago
parent
commit
134a258dc6
  1. 16
      lib/article/hot_article_item.dart
  2. 4
      lib/community/community_page.dart
  3. 1339
      lib/store/store_view/settlement.dart
  4. 373
      lib/view_widget/hot_item.dart
  5. 14
      pubspec.lock

16
lib/article/hot_article_item.dart

@ -1,14 +1,12 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/hot_item.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:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -83,13 +81,13 @@ class _HotArticlePage extends State<HotArticlePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: MyAppBar( // appBar: MyAppBar(
background: Color(0xFFF7F7F7), // background: Color(0xFFF7F7F7),
leadingColor: Colors.black, // leadingColor: Colors.black,
title: S.of(context).huixiangtoutiao, // title: S.of(context).huixiangtoutiao,
titleColor: Colors.black, // titleColor: Colors.black,
titleSize: 18.sp, // titleSize: 18.sp,
), // ),
body: Container( body: Container(
child: SmartRefresher( child: SmartRefresher(
controller: refreshController, controller: refreshController,

4
lib/community/community_page.dart

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.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/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/home/huixiang_brand_page.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -89,6 +91,8 @@ class _CommunityPage extends State<CommunityPage>
children: lables.map((e) { children: lables.map((e) {
if (e == "关于我们") { if (e == "关于我们") {
return BrandPage(); return BrandPage();
}else if(e == "头条"){
return HotArticlePage();
} else { } else {
return CommunityChildPage(); return CommunityChildPage();
} }

1339
lib/store/store_view/settlement.dart

File diff suppressed because it is too large Load Diff

373
lib/view_widget/hot_item.dart

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
@ -22,6 +21,8 @@ class HotArticleItem extends StatefulWidget {
} }
class _HotArticleItem extends State<HotArticleItem> { class _HotArticleItem extends State<HotArticleItem> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
@ -41,7 +42,7 @@ class _HotArticleItem extends State<HotArticleItem> {
Widget hotItem(BuildContext context) { Widget hotItem(BuildContext context) {
return Container( return Container(
padding: EdgeInsets.all((widget.isHot == null || !widget.isHot) ? 8 : 0), padding: EdgeInsets.all((widget.isHot == null || !widget.isHot) ? 4 : 0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -55,44 +56,122 @@ class _HotArticleItem extends State<HotArticleItem> {
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
child: (widget.isHot == null || !widget.isHot) child: (widget.isHot == null || !widget.isHot)
? Row( ? Column(
children: [ children: [
Visibility( Row(
visible: widget.article != null && mainAxisAlignment: MainAxisAlignment.spaceBetween,
widget.article.coverImg != null && crossAxisAlignment: CrossAxisAlignment.center,
widget.article.coverImg != "", children: [
child: Stack( Container(
alignment: Alignment.center, height: 44,
children: [ child: Row(
MImage( children: [
widget.article != null ? widget.article.coverImg : "", MImage(
fit: BoxFit.cover, (widget.article != null &&
radius: BorderRadius.circular(2), widget.article.author != null)
aspectRatio: 1, ? widget.article.author.avatar
errorSrc: "assets/image/default_1.png", : "",
fadeSrc: "assets/image/default_1.png", width: 44,
), height: 44,
Visibility( isCircle: true,
visible: (widget.article != null && fit: BoxFit.cover,
widget.article.coverImg != "" && errorSrc: "assets/image/default_1.png",
widget.article.coverImg.endsWith(".mp4")), fadeSrc: "assets/image/default_1.png",
child: Icon( ),
Icons.play_circle_outline, SizedBox(
size: 24, width: 8,
color: Colors.white, ),
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( GestureDetector(
margin: EdgeInsets.only(left: 8.w), onTap: (){
child: articleText(context), },
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( : Column(
children: articleContent(context), children: articleContent(context),
), ),
@ -113,7 +192,7 @@ class _HotArticleItem extends State<HotArticleItem> {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: MyFontWeight.medium,
fontSize: 14.sp, fontSize: 14.sp,
color: Colors.black, color: Colors.black,
), ),
@ -140,7 +219,7 @@ class _HotArticleItem extends State<HotArticleItem> {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: MyFontWeight.medium,
fontSize: 14.sp, fontSize: 14.sp,
color: Colors.black, color: Colors.black,
), ),
@ -158,7 +237,7 @@ class _HotArticleItem extends State<HotArticleItem> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: MyFontWeight.regular,
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
), ),
@ -174,49 +253,50 @@ class _HotArticleItem extends State<HotArticleItem> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
S.of(context).zuozhe((widget.article != null && // S.of(context).zuozhe(),
widget.article.author != null) (widget.article != null &&
? widget.article.author.name widget.article.author != null)
: ""), ? widget.article.author.name
: "",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: MyFontWeight.medium,
color: Color(0xFFB2B2B2), color: Color(0xFF1A1A1A),
), ),
), ),
SizedBox( SizedBox(
width: 12.w, width: 14.w,
), ),
Container( Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(
"assets/image/icon_likes.png", "assets/image/browse.png",
width: 16.w, width: 16.w,
height: 16.h, height: 16.h,
), ),
Text( Text(
(widget.article != null) (widget.article != null)
? "${widget.article.likes}" ? "${widget.article.viewers}"
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 12.sp,
color: Color(0xFFB2B2B2), color: Color(0xFF1A1A1A),
), ),
), ),
], ],
), ),
), ),
SizedBox( SizedBox(
width: 12.w, width: 14.w,
), ),
Container( Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(
"assets/image/icon_views.png", "assets/image/leaving_message.png",
width: 16.w, width: 16.w,
height: 16.h, height: 16.h,
), ),
@ -225,8 +305,32 @@ class _HotArticleItem extends State<HotArticleItem> {
? "${widget.article.viewers}" ? "${widget.article.viewers}"
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 12.sp,
color: Color(0xFFB2B2B2), 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<HotArticleItem> {
? (widget.article.createTime.split(" ")[0]) ? (widget.article.createTime.split(" ")[0])
: "", : "",
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 10.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: MyFontWeight.regular,
color: Color(0xFFB2B2B2), color: Color(0xFFB2B2B2),
), ),
leftIcon: Icons.access_time_rounded, // leftIcon: Icons.access_time_rounded,
iconSize: 10, iconSize: 10,
iconColor: Color(0xFFB2B2B2), iconColor: Color(0xFFB2B2B2),
), ),
@ -256,6 +360,159 @@ class _HotArticleItem extends State<HotArticleItem> {
); );
} }
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<Widget> articleContent(context) { List<Widget> articleContent(context) {
return [ return [
Expanded( Expanded(

14
pubspec.lock

@ -175,7 +175,7 @@ packages:
name: cli_util name: cli_util
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.4" version: "0.3.5"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -395,7 +395,7 @@ packages:
name: flutter_smart_dialog name: flutter_smart_dialog
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.3.6" version: "2.3.8"
flutter_spinkit: flutter_spinkit:
dependency: "direct main" dependency: "direct main"
description: description:
@ -409,7 +409,7 @@ packages:
name: flutter_staggered_grid_view name: flutter_staggered_grid_view
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.4.0" version: "0.4.1"
flutter_svg: flutter_svg:
dependency: "direct main" dependency: "direct main"
description: description:
@ -440,7 +440,7 @@ packages:
name: fluwx name: fluwx
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.6.1+2" version: "3.6.1+3"
font_awesome_flutter: font_awesome_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
@ -545,7 +545,7 @@ packages:
name: keframe name: keframe
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "2.0.3"
like_button: like_button:
dependency: "direct main" dependency: "direct main"
description: description:
@ -587,7 +587,7 @@ packages:
name: mime name: mime
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.1"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
@ -615,7 +615,7 @@ packages:
name: path_drawing name: path_drawing
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.5.1" version: "0.5.1+1"
path_parsing: path_parsing:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save