You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
5.8 KiB

3 years ago
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<StatefulWidget> createState() {
return _CommunityChildPage();
}
}
class _CommunityChildPage extends State<CommunityChildPage> {
@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,
),
],
),
],
),
);
}
}