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.

319 lines
10 KiB

3 years ago
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/brand_data.dart';
3 years ago
import 'package:huixiang/retrofit/data/founder.dart';
3 years ago
import 'package:huixiang/utils/MyPainter.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class OriginInfo extends StatefulWidget {
3 years ago
final Founder founder;
3 years ago
3 years ago
OriginInfo(this.founder);
3 years ago
@override
State<StatefulWidget> createState() {
return _OriginInfo();
}
}
class _OriginInfo extends State<OriginInfo> {
var isShowMore = false;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 20.h, top: 16.h),
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 2),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/founder_story_page');
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipOval(
child: MImage(
3 years ago
widget.founder == null
3 years ago
? ""
3 years ago
: widget.founder.imgUrl,
3 years ago
fit: BoxFit.cover,
width: 60,
height: 60,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
3 years ago
),
clipBehavior: Clip.hardEdge,
),
SizedBox(
width: 16.w,
),
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text.rich(
3 years ago
TextSpan(
children: [
TextSpan(
3 years ago
text: widget.founder == null
3 years ago
? ""
3 years ago
: widget.founder.name,
3 years ago
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
color: Colors.black,
),
3 years ago
),
3 years ago
TextSpan(
text: " ${S.of(context).jituanchuangbanren}",
style: TextStyle(
fontSize: 10.sp,
color: Colors.black,
),
3 years ago
),
3 years ago
],
),
3 years ago
textDirection: TextDirection.ltr,
),
Text(
3 years ago
widget.founder == null
3 years ago
? ""
3 years ago
: widget.founder.description,
3 years ago
overflow: isShowMore
? TextOverflow.visible
: TextOverflow.ellipsis,
maxLines: isShowMore ? 10 : 2,
style: TextStyle(
fontSize: 12.sp,
color: Colors.black,
),
),
SizedBox(height: 3.h),
if((widget?.founder?.description ?? "").length > 35)
3 years ago
GestureDetector(
onTap: () {
setState(() {
isShowMore = !isShowMore;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Text(
S.of(context).gengduo,
style: TextStyle(
fontSize: 12.sp,
color: Colors.black,
),
),
Icon(
(isShowMore != null && !isShowMore)
? Icons.chevron_right
: Icons.keyboard_arrow_up,
color: Colors.black,
size: 18,
),
],
),
),
],
),
),
flex: 1,
),
],
),
),
3 years ago
// InkWell(
// onTap: () {
// Navigator.of(context).pushNamed('/router/founder_story_page');
// },
// child: Text(
// // widget.founder == null ? "" : widget.founder.company,
// "",
// style: TextStyle(
// fontSize: 16.sp,
// fontWeight: FontWeight.bold,
// color: Colors.black,
// ),
// ),
// ),
// SizedBox(
// height: 20.h,
// ),
// InkWell(
// onTap: () {
// Navigator.of(context).pushNamed('/router/founder_story_page');
// },
// child: Text(
// // widget.brandData == null ? "" : widget.brandData.companyDesc,
// "",
// textAlign: TextAlign.justify,
// style: TextStyle(
// fontSize: 12.sp,
// color: Color(0xFF353535),
// ),
// ),
// ),
// SizedBox(
// height: 40.h,
// ),
// Text(
// S.of(context).linian,
// style: TextStyle(
// fontSize: 16.sp,
// fontWeight: FontWeight.bold,
// color: Colors.black,
// ),
// ),
// SizedBox(
// height: 20.h,
// ),
Container(
margin: EdgeInsets.only(top:30),
child:InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/founder_story_page');
},
child: Column(
children: [
Row(
children: [
_ideaWidget("友爱", "assets/image/icon_idea_ya.webp"),
_ideaWidget("纯净", "assets/image/icon_idea_cj.webp"),
_ideaWidget("健康", "assets/image/icon_idea_jk.webp"),
3 years ago
],
),
SizedBox(
height: 18.h,
),
Row(
children: [
_ideaWidget("有机", "assets/image/icon_idea_yj.webp"),
_ideaWidget("环保", "assets/image/icon_idea_hb.webp"),
_ideaWidget("智慧", "assets/image/icon_idea_zh.webp"),
3 years ago
],
),
],
3 years ago
),
),
),
],
),
);
}
Widget _ideaWidget(var text, String img) {
return Expanded(
flex: 1,
child: Stack(
alignment: Alignment.center,
children: [
Container(
3 years ago
width: 63.h,
3 years ago
height: 63.h,
child: Stack(
alignment: Alignment.center,
children: [
Align(
child: CircleAvatar(
3 years ago
backgroundColor: Colors.white,
child: Image.asset(
img,
width: 63.h,
height: 63.h,
fit: BoxFit.fill,
),
radius: 32.h,
3 years ago
),
),
Text(
text,
style: TextStyle(
3 years ago
fontSize: 18.sp,
3 years ago
fontWeight: MyFontWeight.light,
color: Colors.white,
),
)
],
),
),
Container(
3 years ago
width: 73.w,
3 years ago
height: 73.h,
child: CustomPaint(
painter: MyPainter(
lineColor: Color(0xff32A060),
width: 2,
isDividerRound: true,
),
),
)
],
),
);
}
Widget idea(key, value) {
return Expanded(
flex: 1,
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: 63.w,
height: 63.h,
child: CircleAvatar(
radius: 100,
backgroundImage: NetworkImage(value),
child: Container(
alignment: Alignment.center,
child: Text(
key,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.light,
color: Colors.white,
),
),
),
),
),
Container(
width: 73.w,
height: 73.h,
child: CustomPaint(
painter: MyPainter(
lineColor: Color(0xff32A060),
width: 2.w,
isDividerRound: true,
),
),
),
],
),
);
}
}