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: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<HotArticlePage> {
@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,

4
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<CommunityPage>
children: lables.map((e) {
if (e == "关于我们") {
return BrandPage();
}else if(e == "头条"){
return HotArticlePage();
} else {
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/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<HotArticleItem> {
@override
Widget build(BuildContext context) {
return GestureDetector(
@ -41,7 +42,7 @@ class _HotArticleItem extends State<HotArticleItem> {
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<HotArticleItem> {
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<HotArticleItem> {
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<HotArticleItem> {
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<HotArticleItem> {
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<HotArticleItem> {
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<HotArticleItem> {
? "${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<HotArticleItem> {
? (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<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) {
return [
Expanded(

14
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:

Loading…
Cancel
Save