import 'package:flutter/material.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:liftmanager/widgets/load_image.dart'; import 'package:liftmanager/res/resources.dart'; import 'package:liftmanager/routers/fluro_navigator.dart'; import 'package:liftmanager/internal/bbs/bbs_router.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'dart:convert'; import 'package:liftmanager/utils/time_format.dart'; import 'package:liftmanager/utils/url.dart'; import 'package:liftmanager/utils/utils.dart'; import 'package:flutter_picker/flutter_picker.dart'; import 'package:liftmanager/internal/work/work_router.dart'; import 'package:liftmanager/internal/bbs/model/banner_model.dart' as banner; import 'package:liftmanager/internal/means/page/means_pdf.dart'; import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:path_provider/path_provider.dart'; import 'package:flustars/flustars.dart' as FlutterStars; import 'package:liftmanager/common/common.dart'; import 'package:liftmanager/internal/account/account_router.dart'; import 'package:liftmanager/utils/toast.dart'; import 'package:liftmanager/utils/theme_utils.dart'; import 'package:liftmanager/internal/news/news_router.dart'; class SwipeWidget extends StatelessWidget { const SwipeWidget({Key key, this.banners}) : super(key: key); final List banners; // List bannersLL = [ // 'tab_first/banner', // 'tab_first/banner', // 'tab_first/banner', // ]; Future createFileOfPdfUrl(url) async { final filename = url.substring(url.lastIndexOf("/") + 1); var request = await HttpClient().getUrl(Uri.parse(url)); var response = await request.close(); var bytes = await consolidateHttpClientResponseBytes(response); String dir = (await getApplicationDocumentsDirectory()).path; File file = new File('$dir/$filename'); await file.writeAsBytes(bytes); return file; } @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; double height = ScreenUtil().setWidth(200); // double height = width * 540.0 / 1080.0; return Container( width: width, height: height, child: Swiper( index: 0, itemBuilder: (BuildContext context, index) { return GestureDetector( onTap: (){ if(banners[index].jumpType == 2){ NavigatorUtils.push(context, "${WorkRouter.webview}?title="+Uri.encodeComponent("详情")+"&url="+Uri.encodeComponent(banners[index].url)); }else if (banners[index].jumpType == 1){ createFileOfPdfUrl(banners[index].url).then((f) { // setState(() { // pathPDF = f.path; Navigator.push( context, MaterialPageRoute( builder: (context) => PDFScreen(f.path,"null","null") )); // }); }); } }, child: Container( width: width, height: height, key: UniqueKey(), // margin:EdgeInsets.only(left:15,right:15), child: // Image.asset( // bannersLL[index], // width:width, // height:height, // fit:BoxFit.cover, // ), LoadNetworkImage( // imgFontUrl + bannerPic[index], banners[index].image, width: width, height: height, fit: BoxFit.fill, ), ), ); }, pagination: SwiperPagination( builder: DotSwiperPaginationBuilder( color: Colors.grey, activeColor: Colors.white, size: 6, activeSize: 6)), itemCount: banners.length, scrollDirection: Axis.horizontal, autoplay: true, onTap: (index) { // print(index); }, ), ); } } class Diagnosis extends StatelessWidget { Diagnosis({Key key, this.fun}) : super(key: key); List diagnosisObj = [ { "title": "快速问诊", "img": "tab_first/Diagnosis_first", "desc": "搜电梯品牌 找专家咨询电梯疑问", }, { "title": "出诊", "img": "tab_first/Diagnosis_second", "desc": "在线预约专家上门维修服务", }, ]; Function fun; List listWidget(context) => diagnosisObj.asMap().keys.map((i) { return GestureDetector( child: Container( color: ThemeUtils.getTabsBg(context), padding: EdgeInsets.only( left: ScreenUtil().setWidth(25), right: ScreenUtil().setWidth(25), top: ScreenUtil().setHeight(25)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ LoadAssetImage( // image: AssetImage(i['img']), diagnosisObj[i]["img"], width: ScreenUtil().setWidth(50), height: ScreenUtil().setWidth(50), // alignment: Alignment.centerLeft, ), Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( diagnosisObj[i]["title"], style: TextStyle( fontSize: ScreenUtil().setSp(22)), textAlign: TextAlign.start, ), Text( diagnosisObj[i]["desc"], style: TextStyle( color: Color(0xff999999), fontSize: ScreenUtil().setSp(14)), textAlign: TextAlign.start, ), ], ), ), ], ), Container( child: Icon( Icons.keyboard_arrow_right, color: Color(0xffcccccc), ), ) ]), ), onTap: () { if (i == 0 && !Utils.getAuthByRouter('quick_consultation')) { return false; } if (i == 1 && !Utils.getAuthByRouter('quich_visit')) { return false; } String index = i.toString(); NavigatorUtils.push(context, "${BbsRouter.brandPage}?index=$index"); }, ); }).toList(); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(20)), color: ThemeUtils.getTabsBg(context), child: Column(children: listWidget(context))); } } class HotQuestion extends StatelessWidget { const HotQuestion({Key key, this.initList}) : super(key: key); final List initList; List listWidget(context) => initList.map((item) { double width = MediaQuery.of(context).size.width; // print(JsonEncoder().convert(initList)); // print(initList); // print(11111); return GestureDetector( child: Container( padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(10), top: ScreenUtil().setHeight(10), bottom: ScreenUtil().setHeight(10)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: 0.5, color: Colours.line), ), color: ThemeUtils.getTabsBg(context) ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "[${item.brandName??''}]${item.title??''}", textAlign: TextAlign.left, style: TextStyle(fontSize: ScreenUtil().setSp(15)), maxLines: 1, overflow: TextOverflow.ellipsis, ), Container( padding: EdgeInsets.only( top: ScreenUtil().setHeight(10), bottom: ScreenUtil().setHeight(10)), child: Row( children: [ ClipRRect( borderRadius: BorderRadius.circular( ScreenUtil().setWidth(18)), child: Container( child: LoadNetworkImage( item.avatarUrl, // fit: BoxFit.fitWidth, width: ScreenUtil().setWidth(34), height: ScreenUtil().setWidth(34), ), )), Container( padding: EdgeInsets.only(left: ScreenUtil().setWidth(10)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( item.userName ?? null, style: TextStyle( fontSize: ScreenUtil().setSp(14), ), ), Text( DateUtils.instance.getFormartData( timeSamp: item.createTime, format: "yyyy-MM-dd"), style: TextStyle( fontSize: ScreenUtil().setSp(12), color: Color(0xffaaaaaa)), ), ], ), ) ], ), ), Text( item.expression, textAlign: TextAlign.left, style: TextStyle( color: Color(0xff666666), fontSize: ScreenUtil().setSp(14), ), maxLines: 2, overflow: TextOverflow.ellipsis, ), Container( padding: EdgeInsets.only( top: ScreenUtil().setHeight(5), bottom: ScreenUtil().setHeight(5)), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: item.imgs != null && item.imgs.isNotEmpty ? List.from( item.imgs.split(",").asMap().keys.map((index) { // print(item); return index<3?Container( padding: index < item.imgs.split(",").length - 1 ? EdgeInsets.only(right: 6) : EdgeInsets.only(right: 0), // color:Colors.red, // decoration: BoxDecoration( // borderRadius: BorderRadius.circular(20.0), // ), child: ClipRRect( borderRadius: BorderRadius.circular(10), child: LoadNetworkImage( item.imgs.split(",")[index], fit: BoxFit.fill, height: ScreenUtil().setWidth(80), width: ScreenUtil().setWidth(110), isWater: true, ), ), ):Container(child:null); }).toList()) : []), ), Text( "${item.likeNum}人赞", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff999999), fontSize: ScreenUtil().setSp(14), ), ) ]), ), onTap: () { // print(item); NavigatorUtils.push(context, "${BbsRouter.questionDetail}?id=${item.id.toString()}"); // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){ // toasts("请登录"); // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true); // }else { // NavigatorUtils.push(context, // "${BbsRouter.questionDetail}?id=${item.id.toString()}"); // } }, ); }).toList(); @override Widget build(BuildContext context) { return Container( color: Colors.white, child: Column( // children:null children: listWidget(context)), ); } } class HotClass extends StatelessWidget { const HotClass({Key key, this.initList}) : super(key: key); final List initList; List listWidget(context) => initList.asMap().keys.map((i) { double width = MediaQuery.of(context).size.width; return GestureDetector( child: Container( color: ThemeUtils.getTabsBg(context), child: Row(children: [ // i == 0? SizedBox( // width:ScreenUtil().setWidth(10) // ):Container(child:null), SizedBox(width: ScreenUtil().setWidth(10)), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ Container( child: Container( padding: EdgeInsets.only( top: ScreenUtil().setHeight(10), bottom: ScreenUtil().setHeight(10)), // padding: EdgeInsets.only(right:15), child: ClipRRect( borderRadius: BorderRadius.circular(10), child: LoadNetworkImage( initList[i].cover, // fit: BoxFit.cover, width: ScreenUtil().setWidth(140), height: ScreenUtil().setWidth(95), isWater: true, ), ), ), ), Positioned( left: ScreenUtil().setWidth(55), top: ScreenUtil().setWidth(43), child: Container( width: ScreenUtil().setWidth(20), height: ScreenUtil().setWidth(20), // color:Colors.red, child: Icon( IconData(0xe607, fontFamily: "myfont"), size: 30, color: Color(0xffdddddd), ), )) ], ), Container( width: ScreenUtil().setWidth(140), child:Text( initList[i].title??"", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(15), ), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), Text( initList[i].brandName!=null?initList[i].brandName.toString():"", textAlign: TextAlign.left, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff999999), ), ), Text( "${initList[i].likeNum ?? '0'}人点赞", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff999999), ), ), // SizedBox( // height:10 // ) ]), i == initList.length - 1 ? SizedBox(width: 10) : Container(child: null) ])), onTap: () { print(i); NavigatorUtils.push(context, "${BbsRouter.videoDetail}?id=${initList[i].id.toString()}"); // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){ // toasts("请登录"); // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true); // }else { // NavigatorUtils.push(context, // "${BbsRouter.videoDetail}?id=${initList[i].id.toString()}"); // } }, ); }).toList(); @override Widget build(BuildContext context) { return ListView( scrollDirection: Axis.horizontal, padding: EdgeInsets.all(0), children: listWidget(context), ); } } class HotProduct extends StatelessWidget { HotProduct({Key key, this.productList}) : super(key: key); List productList; List listWidget(context) => productList.map((i) { double width = MediaQuery.of(context).size.width; return InkWell( child: Container( padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15), top: ScreenUtil().setHeight(10), bottom: ScreenUtil().setHeight(10)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: 0.5, color: Colours.line), ), color: ThemeUtils.getTabsBg(context) ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ ClipRRect( borderRadius: BorderRadius.circular(5), child: Container( padding: EdgeInsets.only(right: ScreenUtil().setWidth(10)), child: LoadNetworkImage( i.imgs.split(",")[0], // fit: BoxFit.cover, width: ScreenUtil().setWidth(90), height: ScreenUtil().setWidth(90), isWater: true, ), ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: width*0.62, child: Text( i.name ?? "", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(15), ), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), Container( width: width*0.62, child: Text( i.brandName ?? "", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff666666), ), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), Container( width: width*0.62, child: Text( "供应商:${i.manufacturer}", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff666666), ), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), Container( width: width*0.62, child: Text( "Tel:${i.telephone}", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff666666), ), maxLines: 1, overflow: TextOverflow.ellipsis, ), ) ], ), ]), ), onTap: () { print(i); NavigatorUtils.push( context, "${BbsRouter.productDetail}?id=${i.id.toString()}"); // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){ // toasts("请登录"); // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true); // }else { // NavigatorUtils.push( // context, "${BbsRouter.productDetail}?id=${i.id.toString()}"); // } }, ); }).toList(); @override Widget build(BuildContext context) { return Container( color: Colors.white, child: Column(children: listWidget(context)), ); } } class HotNews extends StatelessWidget{ HotNews({Key key, this.newsList}) : super(key: key); List newsList; List listWidget(context) => newsList.map((i) { double width = MediaQuery.of(context).size.width; return InkWell( onTap: () { print("点击了"); NavigatorUtils.push(context, "${NewsRouter.newsDetail}?id=${i.id}"); // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){ // toasts("请登录"); // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true); // }else { // NavigatorUtils.push(context, // "${BbsRouter.newsDetail}?id=${i.id}"); // } }, child: Container( width:width, padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15), top: ScreenUtil().setHeight(10), bottom: ScreenUtil().setHeight(10)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: 0.5, color: Colours.line), ), color: ThemeUtils.getTabsBg(context) ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( i.title, style: TextStyle(fontSize: 15), // overflow: TextOverflow.ellipsis, ), Gaps.vGap12, Text( "${i.releaseUser}·阅读${i.lookNum}次·点赞${i.likeNum}", style: TextStyle( fontSize: 11, color: Colours.text_gray), ) ], ), ), ); }).toList(); @override Widget build(BuildContext context) { return Container( color: Colors.white, child: Column(children: listWidget(context)), ); } } class HotPosition extends StatelessWidget { HotPosition({Key key, this.positionList}) : super(key: key); List positionList; List listWidget(context) => positionList.map((i) { double width = MediaQuery.of(context).size.width; return InkWell( child: Container( padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15), top: ScreenUtil().setHeight(10), bottom: ScreenUtil().setHeight(10)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: 0.5, color: Colours.line), ), color: ThemeUtils.getTabsBg(context) ), child: Column( // crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: width, padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(5)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( width: width*0.4, child: Text( i.job ?? "", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(17), ), overflow: TextOverflow.ellipsis, ), ), Container( width: width*0.4, child:Text( "¥" + i.lowerSalary.toString() + "-" + i.upperSalary.toString(), textAlign: TextAlign.right, style: TextStyle( fontSize: ScreenUtil().setSp(17), color: Color(0xffff0000), ), overflow: TextOverflow.ellipsis, ), ) ], ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( width: width * 0.45, child: Text( i.company.name ?? "", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff999999), ), overflow: TextOverflow.ellipsis, ), ), Expanded( child:i.provinceName != null?Container( // width: width * 0.4, child: Text( (i.provinceName != null ? i.provinceName : '') + "-" + (i.cityName != null ? i.cityName : ''), textAlign: TextAlign.right, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff999999), ), overflow: TextOverflow.ellipsis, ), ):Container(child:null), ) ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( width: width * 0.65, child: Text( i.info ?? "", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff999999), ), overflow: TextOverflow.ellipsis, ), ), Text( DateUtils.instance.getFormartData( timeSamp: i.createTime, format: "yyyy-MM-dd"), textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(14), color: Color(0xff999999), ), ), ], ), ]), ), onTap: () { print(i); NavigatorUtils.push( context, "${BbsRouter.positionDetail}?id=${i.id}"); // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){ // toasts("请登录"); // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true); // }else { // NavigatorUtils.push( // context, "${BbsRouter.positionDetail}?id=${i.id}"); // } }, ); }).toList(); @override Widget build(BuildContext context) { return Container( color: Colors.white, child: Column(children: listWidget(context)), ); } } class LableTitle extends StatelessWidget { LableTitle( {Key key, this.title, this.userTap, this.isMore = true, this.hasArrow = false}) : super(key: key); String title; Function userTap; bool isMore; bool hasArrow; @override Widget build(BuildContext context) { return GestureDetector( onTap: () { userTap(); }, child: Container( height: ScreenUtil().setHeight(45), padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15)), alignment: Alignment.centerLeft, decoration: BoxDecoration( color: ThemeUtils.getTabsBg(context), border: Border( bottom: BorderSide(width: 0.5, color: ThemeUtils.getDialogTextFieldColor(context)), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( margin: EdgeInsets.only(top: ScreenUtil().setWidth(3)), height: ScreenUtil().setWidth(15), width: ScreenUtil().setWidth(3), decoration: BoxDecoration( gradient: const LinearGradient( colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]), ), ), Container( padding: EdgeInsets.only(left: ScreenUtil().setWidth(10)), decoration: BoxDecoration( border: Border( // left: BorderSide(width: 3, color: Colours.app_main), )), child: Text( title, style: TextStyle( fontSize: ScreenUtil().setSp(15), fontWeight: FontWeight.bold), ), ), ], ), Container( child: Row(children: [ Text( isMore == true ? "更多" : '', style: TextStyle( fontSize: ScreenUtil().setSp(13), color: Color(0xFF666666)), ), hasArrow ? Container( child: Images.arrowRight, ) : Container(child: null) ])) ], ), ), ); } } class ChioseThis extends StatelessWidget { ChioseThis( {Key key, this.list, this.value, this.label, this.isMust: false, this.fun, this.labelText = '请选择'}) : super(key: key); List list; String value; String label; bool isMust; Function fun; String labelText; @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; return InkWell( onTap: () { showModalBottomSheet( context: context, builder: (context) { return Container( height: 80, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: list.asMap().keys.map((index) { return InkWell( onTap: () { fun(index); }, child: Container( width: width, padding: EdgeInsets.only( bottom: ScreenUtil().setWidth(10), top: ScreenUtil().setWidth(5)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: 0.5, color: Colours.line), ), ), child: Text( list[index], style: TextStyle( color: Color(0xff333333), fontSize: ScreenUtil().setSp(16)), textAlign: TextAlign.center, ), ), ); }).toList(), ), ); }); }, child: Container( padding: EdgeInsets.only( top: ScreenUtil().setWidth(15), bottom: ScreenUtil().setWidth(15)), margin: EdgeInsets.only(left: ScreenUtil().setWidth(15)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: 0.5, color: Colours.line), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( label, style: TextStyle( color: Color(0xff222222), // fontSize: ScreenUtil().setSp(14) ), textAlign: TextAlign.start, ), Offstage( offstage: !this.isMust, child: Text( "*", style: TextStyle(color: Colors.red), ), ), Expanded(flex: 1, child: Container()), value.isEmpty ? Container( child: Row(children: [ Text( labelText, style: TextStyle( color: Color(0xffcccccc), // fontSize: ScreenUtil().setSp(14) ), textAlign: TextAlign.start, ), Container( padding: EdgeInsets.only(top: 3), child: Icon( Icons.keyboard_arrow_right, size: 20.0, color: Color(0xffcccccc), ), ), SizedBox(width: 10) ]), ) : Container( padding: EdgeInsets.only(right: ScreenUtil().setWidth(15)), child: Row(children: [ Text( value, style: TextStyle( color: Color(0xff222222), fontSize: ScreenUtil().setSp(14)), textAlign: TextAlign.start, ), ]), ), ]), ), ); } } class IsvideoList extends StatelessWidget { IsvideoList({Key key, this.list, this.fun}) : super(key: key); List list; Function fun; List listWidget(context) => list.asMap().keys.map((i) { double width = MediaQuery.of(context).size.width; return GestureDetector( onTap: () { fun(); }, child: Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 5), width: width / 2, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( child: Stack( children: [ ClipRRect( borderRadius: BorderRadius.circular(5), child: Container( child: LoadAssetImage( list[i]["image"], width: 190, height: 140, ), ), ), Positioned( left: 77, top: 57, child: Icon( IconData(0xe607, fontFamily: "myfont"), size: 26.0, color: Colors.white, ), ) ], )), Text( list[i]["title"], style: TextStyle( color: Color(0xff222222), fontSize: ScreenUtil().setSp(16)), textAlign: TextAlign.start, ), Text( list[i]["brand"], style: TextStyle( color: Color(0xff999999), fontSize: ScreenUtil().setSp(14)), textAlign: TextAlign.start, ), Text( "${list[i]["num"]}人点赞", style: TextStyle( color: Color(0xff999999), fontSize: ScreenUtil().setSp(14)), textAlign: TextAlign.start, ), ])), ); }).toList(); @override Widget build(BuildContext context) { return Container( color: Colors.white, child: Wrap( // children:null children: listWidget(context)), ); } } class Heng extends StatelessWidget { Heng({Key key, this.left, this.right, this.leftColor, this.rightColor}) : super(key: key); String left; String right; int leftColor; int rightColor; @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15), top: ScreenUtil().setWidth(10), bottom: ScreenUtil().setWidth(10)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: .5, color: Color(0xfff5f5f5)), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( left, style: TextStyle( color: Color(leftColor), // fontSize:ScreenUtil().setSp(14) ), textAlign: TextAlign.start, ), Text( right, style: TextStyle( color: Color(rightColor), // fontSize:ScreenUtil().setSp(14) ), textAlign: TextAlign.start, ), ]), ); } } // 选择下拉 class ChiosePicker extends StatefulWidget { ChiosePicker({ Key key, this.range, this.value, this.label, this.isMust: false, this.onConfirm, this.placeholder = '请选择', }) : super(key: key); final List range; final String value; final String label; final bool isMust; final String placeholder; final Function(String, int) onConfirm; @override _ChiosePickerState createState() => _ChiosePickerState(); } class _ChiosePickerState extends State { @override initState() { _vlaue = widget.value; super.initState(); } String _vlaue = ''; showPickerModal(BuildContext context) { new Picker( cancelText:"取消", confirmText:"确认", adapter: PickerDataAdapter( pickerdata: widget.range, ), changeToFirst: true, hideHeader: false, onConfirm: (Picker picker, List value) { _vlaue = picker.getSelectedValues()[0]; widget.onConfirm(picker.getSelectedValues()[0], value[0]); setState(() {}); }, ).showModal(this.context); } @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; return InkWell( onTap: () { FocusScope.of(context).requestFocus(FocusNode()); showPickerModal(context); }, child: Container( padding: EdgeInsets.only( top: ScreenUtil().setWidth(15), bottom: ScreenUtil().setWidth(15), ), margin: EdgeInsets.only(left: ScreenUtil().setWidth(15)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: 0.5, color: Colours.line), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( widget.label, style: TextStyle( // fontSize: ScreenUtil().setSp(14) ), textAlign: TextAlign.start, ), Offstage( offstage: !widget.isMust, child: Text( "*", style: TextStyle(color: Colors.red), ), ), Expanded(flex: 1, child: Container()), _vlaue==null || _vlaue.isEmpty ? Container( child: Row( children: [ Text( widget.placeholder, style: TextStyle( color: Color(0xffcccccc), // fontSize: ScreenUtil().setSp(14) ), textAlign: TextAlign.start, ), Container( padding: EdgeInsets.only(top: 3), child: Icon( Icons.keyboard_arrow_right, size: 20.0, color: Color(0xffcccccc), ), ), SizedBox(width: 10) ], ), ) : Container( padding: EdgeInsets.only(right: ScreenUtil().setWidth(15)), child: Row( children: [ Text( _vlaue, style: TextStyle( color: Color(0xff222222), fontSize: ScreenUtil().setSp(14)), textAlign: TextAlign.start, ), ], ), ), ], ), ), ); } }