import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/brand_data.dart'; 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 { final BrandData brandData; OriginInfo(this.brandData); @override State createState() { return _OriginInfo(); } } class _OriginInfo extends State { 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( widget.brandData == null ? "" : widget.brandData.originAvatar, fit: BoxFit.cover, width: 60, height: 60, errorSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png", ), clipBehavior: Clip.hardEdge, ), SizedBox( width: 16.w, ), Expanded( child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text.rich( TextSpan( children: [ TextSpan( text: widget.brandData == null ? "" : widget.brandData.originator, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 14.sp, color: Colors.black, ), ), TextSpan( text: " ${S.of(context).jituanchuangbanren}", style: TextStyle( fontSize: 10.sp, color: Colors.black, ), ), ], ), textDirection: TextDirection.ltr, ), Text( widget.brandData == null ? "" : widget.brandData.originDesc, overflow: isShowMore ? TextOverflow.visible : TextOverflow.ellipsis, maxLines: isShowMore ? 10 : 2, style: TextStyle( fontSize: 12.sp, color: Colors.black, ), ), SizedBox(height: 3.h), 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, ), ], ), ), SizedBox( height: 40.h, ), InkWell( onTap: () { Navigator.of(context).pushNamed('/router/founder_story_page'); }, child: Text( widget.brandData == null ? "" : widget.brandData.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, ), InkWell( onTap: () { Navigator.of(context).pushNamed('/router/founder_story_page'); }, child: Column( children: [ Row( children: [ _ideaWidget("友爱", "assets/image/icon_idea_ya.png"), _ideaWidget("纯净", "assets/image/icon_idea_cj.png"), _ideaWidget("健康", "assets/image/icon_idea_jk.png"), ], ), SizedBox( height: 18.h, ), Row( children: [ _ideaWidget("有机", "assets/image/icon_idea_yj.png"), _ideaWidget("环保", "assets/image/icon_idea_hb.png"), _ideaWidget("智慧", "assets/image/icon_idea_zh.png"), ], ), ], ), ), ], ), ); } Widget _ideaWidget(var text, String img) { return Expanded( flex: 1, child: Stack( alignment: Alignment.center, children: [ Container( width: 63.h, height: 63.h, child: Stack( alignment: Alignment.center, children: [ Align( child: CircleAvatar( backgroundColor: Colors.white, child: Image.asset( img, width: 63.h, height: 63.h, fit: BoxFit.fill, ), radius: 32.h, ), ), Text( text, style: TextStyle( fontSize: 18.sp, fontWeight: MyFontWeight.light, color: Colors.white, ), ) ], ), ), Container( width: 73.w, 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, ), ), ), ], ), ); } }