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.
aku_new_community/lib/widget/circle_trend.dart

114 lines
2.9 KiB

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:akuCommunity/widget/cached_image_wrapper.dart';
class CircleTrend extends StatefulWidget {
final String title;
final List<Map<String, dynamic>> contentList;
final Function fun;
CircleTrend({Key key, this.title, this.contentList, this.fun})
: super(key: key);
@override
_CircleTrendState createState() => _CircleTrendState();
}
class _CircleTrendState extends State<CircleTrend> {
TextStyle _textStyleTitle() {
return TextStyle(
fontWeight: FontWeight.w600,
4 years ago
fontSize: 52.sp,
color: Color(0xff333333));
}
TextStyle _textStyleSubtitle() {
4 years ago
return TextStyle(fontSize: 32.sp, color: Color(0xff333333));
}
TextStyle _textStyleTag() {
4 years ago
return TextStyle(fontSize: 30.sp, color: Color(0xff444444));
}
InkWell _contentDetails(String subtitle, imagePath, Function fun) {
return InkWell(
onTap: () {
fun(subtitle, imagePath);
},
child: Container(
4 years ago
margin: EdgeInsets.only(bottom: 8.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CachedImageWrapper(
url: imagePath,
4 years ago
width: 152.w,
height: 152.w,
),
4 years ago
SizedBox(width: 10.w),
Container(
4 years ago
width: 384.w,
child: Text(
subtitle,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: _textStyleSubtitle(),
),
),
],
),
),
);
}
Container _statusCard(
String title, List<Map<String, dynamic>> contentList, Function fun) {
return Container(
margin: EdgeInsets.only(
4 years ago
left: 32.w,
right: 32.w,
bottom: 40.w,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title.substring(0, 2),
style: _textStyleTitle(),
),
title.substring(2) != null
? Text(
title.substring(2),
style: _textStyleTag(),
)
: SizedBox(),
Container(
4 years ago
margin: EdgeInsets.only(left: 30.w),
child: Column(
children: contentList
.map((item) => _contentDetails(
item['subtitle'],
item['imagePath'],
fun,
))
.toList(),
),
),
],
),
);
}
@override
Widget build(BuildContext context) {
return Container(
child: _statusCard(
widget.title,
widget.contentList,
widget.fun,
),
);
}
}