12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057 |
- import 'dart:io';
- import 'package:flutter/foundation.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/rendering.dart';
- import 'package:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart';
- import 'package:flutter_picker/flutter_picker.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_spinkit/flutter_spinkit.dart';
- import 'package:flutter_swiper/flutter_swiper.dart';
- import 'package:liftmanager/internal/bbs/bbs_router.dart';
- import 'package:liftmanager/internal/bbs/model/banner_model.dart' as banner;
- import 'package:liftmanager/internal/bbs/model/mix_model.dart';
- import 'package:liftmanager/internal/bbs/model/search_model.dart';
- import 'package:liftmanager/internal/means/page/means_pdf.dart';
- import 'package:liftmanager/internal/news/model/news_comm_entity.dart';
- import 'package:liftmanager/internal/news/news_router.dart';
- import 'package:liftmanager/internal/work/work_router.dart';
- import 'package:liftmanager/res/iconfont.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/image_utils.dart';
- import 'package:liftmanager/utils/theme_utils.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/utils/utils.dart';
- import 'package:liftmanager/widgets/img_viewer.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:path_provider/path_provider.dart';
- class SwipeWidget extends StatelessWidget {
- const SwipeWidget({Key key, this.banners}) : super(key: key);
- final List<banner.Records> banners;
- // List<String> bannersLL = <String> [
- // 'tab_first/banner',
- // 'tab_first/banner',
- // 'tab_first/banner',
- // ];
- Future<File> 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 = 180;
- return Container(
- width: width,
- height: height,
- child: ClipRRect(
- borderRadius: BorderRadius.all(Radius.circular(10)),
- child: Swiper(
- index: 0,
- itemBuilder: (BuildContext swipercontext, index) {
- return GestureDetector(
- onTap: () {
- if (banners[index].jumpType == 2) {
- print('${banners[index].jumpType}');
- NavigatorUtils.push(
- context,
- "${WorkRouter.webview}?title=" +
- Uri.encodeComponent("详情") +
- "&url=" +
- Uri.encodeComponent(banners[index].url));
- } else if (banners[index].jumpType == 1) {
- print('777');
- // showLoading(context);
- createFileOfPdfUrl(banners[index].url).then((f) {
- // setState(() {
- // pathPDF = f.path;
- // pathPDF = f.path;
- // Navigator.push(
- // context,
- // MaterialPageRoute(
- // builder: (context) => PDFScreen(
- // f.path,
- // banners[index].url,
- // banners[index].id.toString()),
- // ));
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) =>
- PDFScreen(f.path, "null", "null")));
- // dismissLoading(context);
- });
- } else if (banners[index].jumpType == 3) {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => Imgviewer(
- url: banners[index].url,
- )));
- }
- },
- child: Container(
- width: width,
- height: height,
- key: UniqueKey(),
- // margin:EdgeInsets.only(left:15,right:15),
- child: LoadNetworkImage(
- banners[index].image,
- width: width,
- height: height,
- fit: BoxFit.fill,
- ),
- ),
- );
- },
- pagination: SwiperPagination(
- builder: RectSwiperPaginationBuilder(
- color: Colors.grey,
- activeColor: Colors.white,
- size: Size(12, 10),
- activeSize: Size(16, 10),
- ),
- ),
- 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<dynamic> diagnosisObj = [
- {
- "title": "快速问诊",
- "img": "tab_first/Diagnosis_first",
- "desc": "搜电梯品牌 找专家咨询",
- },
- {
- "title": "出诊",
- "img": "tab_first/Diagnosis_second",
- "desc": "在线预约 上门服务",
- },
- ];
- Function fun;
- List<Widget> listWidget(context) => diagnosisObj.asMap().keys.map((i) {
- return GestureDetector(
- child: Container(
- color: ThemeUtils.getTabsBg(context),
- padding: EdgeInsets.only(
- left: 15,
- right: 15,
- // top: ScreenUtil().setHeight(15),
- bottom: 20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- children: <Widget>[
- LoadAssetImage(
- // image: AssetImage(i['img']),
- diagnosisObj[i]["img"],
- width: 40,
- height: 40,
- // alignment: Alignment.centerLeft,
- ),
- SizedBox(width: 10),
- Container(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- diagnosisObj[i]["title"],
- style: TextStyle(fontSize: 22),
- textAlign: TextAlign.start,
- ),
- Text(
- diagnosisObj[i]["desc"],
- style: TextStyle(
- color: Color(0xff999999), fontSize: 14),
- textAlign: TextAlign.start,
- ),
- ],
- ),
- ),
- ],
- ),
- Container(
- child: Icon(
- Icons.keyboard_arrow_right,
- color: Color(0xffcccccc),
- ),
- )
- ]),
- ),
- onTap: () {
- if (i == 0 &&
- !Utils.getAuthByRouter(context, 'quick_consultation')) {
- return false;
- }
- if (i == 1 && !Utils.getAuthByRouter(context, 'quich_visit')) {
- return false;
- }
- String index = i.toString();
- NavigatorUtils.push(context, "${BbsRouter.brandPage}?index=$index");
- },
- );
- }).toList();
- @override
- Widget build(BuildContext context) {
- return Card(
- margin: EdgeInsets.all(ScreenUtil().setWidth(10)),
- //设置圆角度,也可以不设置有默认值
- shape: RoundedRectangleBorder(
- //形状
- //修改圆角
- borderRadius: BorderRadius.all(Radius.circular(10)),
- ),
- //阴影颜色
- // color: Colors.orangeAccent,
- //阴影高度
- elevation: 1.0,
- child: ClipRRect(
- borderRadius: BorderRadius.all(Radius.circular(10)),
- child: Container(
- padding: EdgeInsets.only(top: 20),
- child: Column(children: listWidget(context)),
- ),
- ),
- );
- }
- }
- class QuestionCell extends StatelessWidget {
- QuestionCell({this.item});
- final dynamic item;
- @override
- Widget build(BuildContext context) {
- if (item is Records || item is InfoList) {
- } else {
- return Container();
- // data = NewsItems();
- }
- return GestureDetector(
- child: Container(
- padding: EdgeInsets.only(
- top: 10,
- bottom: 10,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- "${item.title ?? ''}",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff333333),
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- SizedBox(
- height: 5,
- ),
- Row(
- children: <Widget>[
- ClipRRect(
- borderRadius: BorderRadius.circular(15),
- child: Container(
- child: LoadNetworkImage(
- item?.avatarUrl,
- // fit: BoxFit.fitWidth,
- width: 31,
- height: 31,
- ),
- )),
- SizedBox(
- width: 5,
- ),
- Text(
- item.userName ?? '',
- style: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.w500,
- color: Color(0xff565A64),
- ),
- ),
- SizedBox(width: 5),
- _clipText(
- title: 'LV1',
- bgcolor: Color(0xffFD5E62),
- textcolor: Colors.white),
- ],
- ),
- SizedBox(
- height: 10,
- ),
- Text(
- item.expression ?? '',
- textAlign: TextAlign.left,
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: 12,
- ),
- 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<Widget>.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())
- : <Widget>[]),
- ),
- Row(
- children: [
- _clipText(
- title: "${item.brandName ?? ''}",
- bgcolor: Color.fromRGBO(67, 141, 250, .16),
- textcolor: Color(0xFF5887FF)),
- Expanded(child: Container()),
- Text(
- "${item.browseNum ?? '0'}浏览·${item.likeNum ?? '0'}赞",
- textAlign: TextAlign.right,
- style: TextStyle(
- color: Color(0xFFCCCCCC),
- fontSize: 11,
- ),
- )
- ],
- ),
- SizedBox(
- height: 10,
- ),
- ]),
- ),
- onTap: () {
- NavigatorUtils.push(
- context, "${BbsRouter.questionDetail}?id=${item.id.toString()}");
- },
- );
- }
- _clipText({title, bgcolor, textcolor}) {
- return ClipRRect(
- borderRadius: BorderRadius.all(Radius.circular(3)),
- child: Container(
- color: bgcolor,
- padding: EdgeInsets.all(3),
- alignment: Alignment.center,
- child: Text(
- title,
- style: TextStyle(fontSize: 11, color: textcolor),
- ),
- ),
- );
- }
- }
- class HotQuestion extends StatelessWidget {
- const HotQuestion({Key key, this.initList}) : super(key: key);
- final List<dynamic> initList;
- @override
- Widget build(BuildContext context) {
- List<Widget> widgetList = [];
- for (int i = 0; i < initList.length; i++) {
- widgetList.add(Column(children: [
- QuestionCell(item: initList[i]),
- if (i != initList.length - 1) Divider(),
- ]));
- }
- return Container(
- color: Colors.white,
- padding: EdgeInsets.symmetric(horizontal: 10),
- child: Column(children: widgetList),
- );
- }
- }
- class HotClass {
- const HotClass({Key key, this.videoList});
- final List<dynamic> videoList;
- List<Widget> listWidget(context) => videoList.asMap().keys.map((i) {
- return GestureDetector(
- child: Container(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Expanded(
- flex: 1,
- child: AspectRatio(
- aspectRatio: 177 / 113,
- child: Stack(
- alignment: Alignment.center,
- children: <Widget>[
- Container(
- // color: Colors.red,
- child: SizedBox.expand(
- child: ClipRRect(
- borderRadius: BorderRadius.circular(10),
- child: LoadNetworkImage(
- videoList[i].cover,
- isWater: true,
- ),
- )),
- ),
- Image.asset(ImageUtils.getImgPath('play_button')),
- ],
- ))),
- Container(
- padding: EdgeInsets.only(top: 5, left: 5),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- videoList[i].title ?? "",
- textAlign: TextAlign.left,
- style:
- TextStyle(fontSize: 14, color: Color(0xff565A64)),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- Text(
- videoList[i].descr ?? "",
- textAlign: TextAlign.left,
- overflow: TextOverflow.ellipsis,
- maxLines: 1,
- style: TextStyle(
- fontSize: 12,
- color: Color(0xff9a9a9a),
- ),
- ),
- SizedBox(height: 10),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- padding: EdgeInsets.all(3),
- decoration: BoxDecoration(
- color: Color(0x33448EFA),
- borderRadius: BorderRadius.circular(4),
- ),
- child: Text(
- videoList[i].brandName != null
- ? videoList[i].brandName.toString()
- : "",
- textAlign: TextAlign.left,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 11,
- color: Color(0xff5888FF),
- ),
- )),
- Text(
- "${videoList[i].browseNum ?? '0'}浏览·${videoList[i].likeNum ?? '0'}赞",
- textAlign: TextAlign.left,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 11,
- color: Color(0xffCCCCCC),
- ),
- ),
- ],
- ),
- ],
- ))
- ])),
- onTap: () {
- print(i);
- NavigatorUtils.push(context,
- "${BbsRouter.videoDetail}?id=${videoList[i].id.toString()}");
- },
- );
- }).toList();
- List<Widget> listVideo(context) => videoList.map((e) {
- return VideoCell(e);
- }).toList();
- }
- class VideoCell extends StatelessWidget {
- dynamic data;
- VideoCell(this.data);
- @override
- Widget build(Object context) {
- if (data is Records || data is InfoList) {
- } else {
- return Container();
- // data = NewsItems();
- }
- return GestureDetector(
- child: Container(
- height: 116,
- padding: EdgeInsets.symmetric(vertical: 10),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(width: 0.5, color: Colours.line),
- ),
- ),
- child: LayoutBuilder(
- builder: (context, constraints) => Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(top: 5, left: 5),
- width: constraints.maxWidth - 167,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- data.title ?? "",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14, color: Color(0xff565A64)),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- Expanded(
- child: Text(
- data.descr ?? "",
- textAlign: TextAlign.left,
- overflow: TextOverflow.ellipsis,
- maxLines: 1,
- style: TextStyle(
- fontSize: 12,
- color: Color(0xff9a9a9a),
- ),
- )),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Container(
- padding: EdgeInsets.all(3),
- decoration: BoxDecoration(
- color: Color(0x33448EFA),
- ),
- child: Text(
- data.brandName != null
- ? data.brandName.toString()
- : "",
- textAlign: TextAlign.left,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 11,
- color: Color(0xff5888FF),
- ),
- )),
- Text(
- "${data.browseNum ?? '0'}浏览·${data.likeNum ?? '0'}赞",
- textAlign: TextAlign.left,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 11,
- color: Color(0xffCCCCCC),
- ),
- ),
- ],
- ),
- ],
- )),
- Stack(
- alignment: Alignment.center,
- children: <Widget>[
- SizedBox(
- width: 147,
- height: 96,
- child: ClipRRect(
- borderRadius: BorderRadius.circular(10),
- child: LoadNetworkImage(
- data.cover,
- isWater: true,
- ),
- )),
- Image.asset(ImageUtils.getImgPath('play_button')),
- ],
- ),
- ]))),
- onTap: () {
- NavigatorUtils.push(
- context, "${BbsRouter.videoDetail}?id=${data.id.toString()}");
- },
- );
- }
- }
- class HotProduct extends StatelessWidget {
- HotProduct({Key key, this.productList}) : super(key: key);
- final List<dynamic> productList;
- List<Widget> listWidget(context) => productList.map((i) {
- return ProductCell(i);
- }).toList();
- @override
- Widget build(BuildContext context) {
- return Container(
- color: Colors.white,
- child: Column(children: listWidget(context)),
- );
- }
- }
- class ProductCell extends StatelessWidget {
- final dynamic data;
- ProductCell(this.data);
- @override
- Widget build(Object context) {
- if (data is Records || data is InfoList) {
- } else {
- return Container();
- // data = NewsItems();
- }
- return InkWell(
- child: Container(
- height: 110,
- padding: EdgeInsets.only(left: 0, right: 0, top: 10, bottom: 10),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(color: Color(0xffF9F9F9)),
- ),
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- ClipRRect(
- borderRadius: BorderRadius.circular(10),
- child: LoadNetworkImage(
- (data?.imgs ?? '').split(",")[0],
- width: ScreenUtil().setWidth(90),
- height: ScreenUtil().setWidth(90),
- isWater: true,
- ),
- ),
- SizedBox(
- width: 10,
- ),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Expanded(
- child: Text(
- data.name ?? "",
- textAlign: TextAlign.left,
- // overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 14,
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- if (data.discountPrice != null)
- Text(
- '¥${data.discountPrice.toInt()}',
- style: TextStyle(
- color: Color(0xffFF5C00),
- fontSize: 16,
- ),
- ),
- if (data.discountPrice == null)
- Text(
- '¥${data.price?.toInt() ?? '暂无'}',
- style: TextStyle(
- color: Color(0xffFF5C00),
- fontSize: 16,
- ),
- ),
- if (data.discountPrice != null)
- Text(
- '¥${data.price.toInt()}',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: 11,
- decoration: TextDecoration.lineThrough,
- ),
- ),
- ],
- )),
- if (data.brandName != null)
- Container(
- padding: EdgeInsets.all(3),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(3),
- color: Color(0x33448EFA),
- ),
- child: Text(
- data.brandName,
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 11,
- color: Color(0xff5887FF),
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- Spacer(),
- Container(
- child: Row(
- children: [
- Icon(Iconfont.shangjia, size: 15, color: Colors.orange),
- SizedBox(width: 5),
- Text(
- "${data.manufacturer}",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 11,
- color: Color(0xff666666),
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- onTap: () {
- NavigatorUtils.push(
- context, "${BbsRouter.productDetail}?id=${data.id.toString()}");
- },
- );
- }
- }
- class HotNews extends StatelessWidget {
- HotNews({Key key, this.newsList}) : super(key: key);
- final List<dynamic> newsList;
- @override
- Widget build(BuildContext context) {
- return Container(
- color: Colors.white,
- child: Column(
- children: newsList.map((i) {
- return NewsCell(i);
- }).toList()),
- );
- }
- }
- class NewsCell extends StatelessWidget {
- final dynamic data;
- NewsCell(this.data);
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- if (data is NewsItems || data is InfoList) {
- } else {
- return Container();
- // data = NewsItems();
- }
- return InkWell(
- onTap: () {
- NavigatorUtils.push(context, "${NewsRouter.newsDetail}?id=${data.id}");
- },
- child: Container(
- width: width,
- padding: EdgeInsets.symmetric(vertical: 10),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(width: 1, color: Colours.line),
- ),
- color: ThemeUtils.getTabsBg(context)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- data.title,
- style: TextStyle(fontSize: 15),
- // overflow: TextOverflow.ellipsis,
- ),
- Gaps.vGap12,
- Text(
- "${data?.releaseUser ?? ''}·阅读${data?.lookNum ?? 0}次·点赞${data?.likeNum ?? 0}",
- style: TextStyle(fontSize: 11, color: Colours.text_gray),
- ),
- ],
- ),
- ),
- );
- }
- }
- class HotPosition extends StatelessWidget {
- HotPosition({Key key, this.positionList}) : super(key: key);
- final List<dynamic> positionList;
- List<Widget> listWidget(context) => positionList.map((i) {
- return PositionCell(i);
- }).toList();
- @override
- Widget build(BuildContext context) {
- return Container(
- color: Colors.white,
- child: Column(children: listWidget(context)),
- );
- }
- }
- class PositionCell extends StatelessWidget {
- final dynamic data;
- PositionCell(this.data);
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- if (data is Records || data is InfoList) {
- } else {
- return Container();
- // data = NewsItems();
- }
- return InkWell(
- child: Container(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- width: width,
- padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(5)),
- child: Row(
- children: <Widget>[
- if (data.hotFlag == 1) ...[
- Container(
- padding: EdgeInsets.all(2),
- decoration: BoxDecoration(
- color: Color(0xffFBC247),
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(5),
- bottomRight: Radius.circular(5),
- ),
- ),
- child: Text(
- '热招',
- style: TextStyle(
- color: Colors.white,
- fontSize: 11,
- ),
- ),
- ),
- SizedBox(
- width: 5,
- ),
- ],
- Container(
- child: Text(
- data.job ?? "",
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff565A64),
- fontWeight: FontWeight.w600,
- ),
- overflow: TextOverflow.ellipsis,
- ),
- ),
- Spacer(),
- Container(
- width: width * 0.4,
- child: Text(
- '${data.lowerSalary?.toInt()}-${data.upperSalary?.toInt()}/月',
- textAlign: TextAlign.right,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xffFF5C00),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- )
- ],
- ),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- "${data.provinceName ?? ''}${data.cityName ?? ''}",
- textAlign: TextAlign.right,
- style: TextStyle(
- fontSize: 13,
- color: Color(0xff9A9A9A),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- Text(
- DateUtils.instance.getFormartData(
- timeSamp: data.createTime, format: "yyyy-MM-dd"),
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 12,
- color: Color(0xff9A9A9A),
- ),
- ),
- ],
- ),
- Text(
- data.company?.name ?? "",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff666666),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- SizedBox(
- height: 10,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- '${data.company?.corporator ?? ""} ${data.company?.telephone ?? ""}',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 13,
- color: Color(0xff565A64),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- Spacer(),
- Container(
- alignment: Alignment.center,
- padding: EdgeInsets.symmetric(horizontal: 15),
- height: 25,
- decoration: BoxDecoration(
- color: Color.fromRGBO(67, 141, 250, .16),
- borderRadius: BorderRadius.circular(12),
- ),
- child: Text(
- '申请',
- style: TextStyle(color: Color(0xff5888FF), fontSize: 13),
- ),
- ),
- ],
- ),
- SizedBox(
- height: 10,
- ),
- Divider(thickness: 0.5, height: 0.5),
- SizedBox(
- height: 10,
- ),
- ]),
- ),
- onTap: () {
- NavigatorUtils.push(
- context, "${BbsRouter.positionDetail}?id=${data.id}");
- },
- );
- }
- }
- class LabelTitle extends StatelessWidget {
- LabelTitle(
- {Key key,
- this.title,
- this.userTap,
- this.isMore = true,
- this.hasArrow = false,
- this.titleStyle})
- : super(key: key);
- final String title;
- final Function userTap;
- final bool isMore;
- final bool hasArrow;
- TextStyle titleStyle;
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- userTap();
- },
- child: Container(
- height: ScreenUtil().setHeight(45),
- padding: EdgeInsets.symmetric(horizontal: 10),
- 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: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Container(
- decoration: BoxDecoration(
- border: Border(
- // left: BorderSide(width: 3, color: Colours.app_main),
- )),
- child: Text(
- title,
- style: titleStyle,
- ),
- ),
- ],
- ),
- Container(
- child: Row(children: <Widget>[
- Text(
- isMore == true ? "更多" : '',
- style: TextStyle(
- fontSize: ScreenUtil().setSp(12), color: Color(0xFF666666)),
- ),
- hasArrow
- ? Container(
- child: Images.arrowRight,
- )
- : Container(child: null)
- ]))
- ],
- ),
- ),
- );
- }
- }
- class CommonSectionHeader extends StatelessWidget {
- final String title;
- final double fontSize;
- bool isMust;
- CommonSectionHeader(
- {this.title = '', this.fontSize = 15, this.isMust = false});
- @override
- Widget build(BuildContext context) {
- return Container(
- child: Row(
- children: [
- Container(
- width: 2,
- height: 15,
- decoration: BoxDecoration(
- border: Border(left: BorderSide(width: 2, color: Colors.blue)),
- ),
- ),
- SizedBox(
- width: 10,
- ),
- Text(
- title,
- style: TextStyle(
- fontSize: fontSize,
- color: Color(0xff333333),
- ),
- ),
- isMust
- ? Text(
- '*',
- style: TextStyle(
- fontSize: fontSize,
- color: Colors.red,
- ),
- )
- : Container(),
- ],
- ));
- }
- }
- class SectionHeader extends StatelessWidget {
- final String title;
- final Function onTap;
- final bool showMore;
- SectionHeader({this.title, this.onTap, this.showMore = false});
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- if (onTap != null) {
- onTap();
- }
- },
- child: Container(
- height: 40,
- child: Row(
- children: [
- Container(
- height: 13,
- width: 0,
- decoration: BoxDecoration(
- border: Border(
- left: BorderSide(
- width: 2,
- color: Color(0xff568AFF),
- ),
- ),
- ),
- ),
- SizedBox(
- width: 10,
- ),
- Expanded(
- child: Text(
- title,
- style: TextStyle(color: Color(0xff343434), fontSize: 15),
- ),
- ),
- if (showMore)
- Text(
- '更多',
- style: TextStyle(color: Color(0xff999999), fontSize: 12),
- ),
- SizedBox(
- width: 10,
- ),
- ],
- )));
- }
- }
- class FilterHeader extends StatelessWidget {
- final List<String> filterNameList;
- final Function(int index) onTap;
- final int activeIndex;
- FilterHeader({
- @required this.filterNameList,
- this.onTap,
- this.activeIndex = 0,
- });
- @override
- Widget build(BuildContext context) {
- var widgetList = [
- GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(
- vertical: 13,
- // horizontal: 10,
- ),
- decoration: BoxDecoration(
- border: activeIndex == 0
- ? Border(
- bottom: BorderSide(
- width: 2,
- color: Color(0xff568AFF),
- ),
- )
- : null,
- ),
- child: Text(
- '全部',
- style: TextStyle(
- color: Color(0xff343434),
- fontSize: 14,
- ),
- ),
- ),
- onTap: () {
- if (onTap != null) onTap(0);
- },
- ),
- ];
- if (filterNameList != null) {
- widgetList.addAll(
- filterNameList.map(
- (e) => GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(
- vertical: 13,
- // horizontal: 10,
- ),
- decoration: BoxDecoration(
- border: activeIndex == (filterNameList.indexOf(e) + 1)
- ? Border(
- bottom: BorderSide(
- width: 2,
- color: Color(0xff568AFF),
- ),
- )
- : null,
- ),
- child: Text(
- e,
- style: TextStyle(
- color: Color(0xff343434),
- fontSize: 14,
- ),
- ),
- ),
- onTap: () {
- var index = filterNameList.indexOf(e) + 1;
- if (onTap != null) onTap(index);
- },
- ),
- ),
- );
- }
- return Container(
- height: 45,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: widgetList,
- ),
- );
- }
- }
- class CustomFilterHeader extends StatelessWidget {
- final List<String> filterNameList;
- final Function(int index) onTap;
- final int activeIndex;
- CustomFilterHeader({
- @required this.filterNameList,
- this.onTap,
- this.activeIndex,
- });
- @override
- Widget build(BuildContext context) {
- var widgetList = [
- LayoutId(
- id: 0,
- child: GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(
- vertical: 13,
- // horizontal: 10,
- ),
- decoration: BoxDecoration(
- border: activeIndex == 0
- ? Border(
- bottom: BorderSide(
- width: 2,
- color: Color(0xff568AFF),
- ),
- )
- : null,
- ),
- child: Text(
- '全部',
- style: TextStyle(
- color: Color(0xff343434),
- fontSize: 14,
- ),
- ),
- ),
- onTap: () {
- if (onTap != null) onTap(0);
- },
- ),
- ),
- ];
- if (filterNameList != null) {
- int loopCount = 0;
- for (var name in filterNameList) {
- var layoutId = ++loopCount;
- widgetList.add(
- LayoutId(
- id: layoutId,
- child: GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(
- vertical: 13,
- // horizontal: 10,
- ),
- decoration: BoxDecoration(
- border: activeIndex == layoutId
- ? Border(
- bottom: BorderSide(
- width: 2,
- color: Color(0xff568AFF),
- ),
- )
- : null,
- ),
- child: Text(
- name,
- style: TextStyle(
- color: Color(0xff343434),
- fontSize: 14,
- ),
- ),
- ),
- onTap: () {
- if (onTap != null) onTap(layoutId);
- },
- ),
- ),
- );
- }
- }
- return Container(
- height: 45,
- child: CustomMultiChildLayout(
- children: widgetList,
- delegate: CustomFilterHeaderLayoutDelegate(
- widgetList.map<int>((e) => e.id).toList(),
- ),
- ),
- );
- }
- }
- class CustomFilterHeaderLayoutDelegate extends MultiChildLayoutDelegate {
- List<int> childIds;
- CustomFilterHeaderLayoutDelegate(this.childIds);
- @override
- void performLayout(Size size) {
- Size leaderSize = Size.zero;
- if (hasChild(0)) {
- leaderSize = layoutChild(0, BoxConstraints.loose(size));
- positionChild(0, Offset.zero);
- }
- var subIds = childIds.sublist(1);
- const spacing = 20;
- const threshold = 0;
- var offset = Offset.zero;
- for (var id in subIds) {
- if (hasChild(id)) {
- offset = Offset(offset.dx + leaderSize.width + spacing, 0);
- leaderSize = layoutChild(
- id,
- BoxConstraints.loose(size),
- );
- if (size.width - offset.dx - leaderSize.width > threshold) {
- positionChild(id, offset);
- } else {
- positionChild(id, Offset.infinite);
- }
- }
- }
- }
- @override
- bool shouldRelayout(covariant MultiChildLayoutDelegate oldDelegate) {
- return false;
- }
- }
- class ChioseThis extends StatelessWidget {
- ChioseThis(
- {Key key,
- this.list,
- this.value,
- this.label,
- this.isMust: false,
- this.fun,
- this.labelText = '请选择'})
- : super(key: key);
- List<dynamic> 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: <Widget>[
- 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: <Widget>[
- 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: <Widget>[
- Text(
- value,
- style: TextStyle(
- color: Color(0xff222222),
- fontSize: ScreenUtil().setSp(14)),
- textAlign: TextAlign.start,
- ),
- ]),
- ),
- ]),
- ),
- );
- }
- }
- class DatePickerInputField extends StatelessWidget {
- DatePickerInputField(
- {Key key,
- this.value = '',
- this.label,
- this.isMust: false,
- this.onSelectionConfirmed,
- this.labelText = '请选择'})
- : super(key: key);
- final String value;
- final String label;
- final bool isMust;
- final Function(String birthday) onSelectionConfirmed;
- final String labelText;
- @override
- Widget build(BuildContext context) {
- return InkWell(
- onTap: () {
- DatePicker.showDatePicker(context,
- // pickerMode: DateTimePickerMode.date,
- dateFormat: 'yyyy-MM',
- locale: DateTimePickerLocale.zh_cn,
- // initialDateTime: DateTime.now(),
- maxDateTime: DateTime.now(),
- // onChange: (datetime, _){
- //
- // },
- onConfirm: (datetime, _) {
- this.onSelectionConfirmed(DateUtils()
- .getFormattedDateTimeStr(datetime: datetime, format: 'yyyy-MM'));
- });
- },
- 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: <Widget>[
- 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: <Widget>[
- 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: <Widget>[
- 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<dynamic> list;
- Function fun;
- List<Widget> 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: <Widget>[
- Container(
- child: Stack(
- children: <Widget>[
- 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: "Iconfont"),
- 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: <Widget>[
- Text(
- left,
- style: TextStyle(color: Color(leftColor), fontSize: 14),
- textAlign: TextAlign.start,
- ),
- Text(
- right,
- style: TextStyle(color: Color(rightColor), fontSize: 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;
- String value;
- final String label;
- final bool isMust;
- final String placeholder;
- final Function(String, int) onConfirm;
- @override
- _ChiosePickerState createState() => _ChiosePickerState();
- }
- class _ChiosePickerState extends State<ChiosePicker> {
- // String _value;
- showPickerModal(BuildContext context) {
- new Picker(
- cancelText: "取消",
- confirmText: "确认",
- adapter: PickerDataAdapter<String>(
- pickerdata: widget.range,
- ),
- changeToFirst: true,
- hideHeader: false,
- onConfirm: (Picker picker, List value) {
- widget.value = picker.getSelectedValues()[0];
- widget.onConfirm(picker.getSelectedValues()[0], value[0]);
- setState(() {});
- },
- ).showModal(this.context);
- }
- @override
- Widget build(BuildContext context) {
- // _value = widget.value;
- 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: <Widget>[
- 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()),
- widget.value == null || widget.value.isEmpty
- ? Container(
- child: Row(
- children: <Widget>[
- 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: <Widget>[
- Text(
- widget.value,
- style: TextStyle(
- color: Color(0xff222222),
- fontSize: ScreenUtil().setSp(14)),
- textAlign: TextAlign.start,
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
- class CommonActionBar extends StatelessWidget {
- final isFavorited;
- final Function onTapSharing;
- final Function onTapFavoriting;
- final Function onTapAction;
- final String actionText;
- final Widget actionWidget;
- CommonActionBar(
- {this.isFavorited = false,
- this.actionText = '',
- this.onTapSharing,
- this.onTapFavoriting,
- this.onTapAction,
- this.actionWidget});
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return Container(
- width: width,
- color: Colors.white,
- padding: EdgeInsets.all(10),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Expanded(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- GestureDetector(
- onTap: () {
- if (this.onTapSharing != null) this.onTapSharing();
- },
- child: Container(
- // padding: EdgeInsets.only(left:25,right:30),
- child: Column(children: <Widget>[
- Icon(
- const IconData(0xe693, fontFamily: "Iconfont"),
- size: 20.0,
- color: Color(0xff333333),
- ),
- Text(
- "分享",
- style: TextStyle(
- color: Color(0xff555A64),
- fontSize: 12,
- ),
- textAlign: TextAlign.start,
- ),
- ])),
- ),
- GestureDetector(
- onTap: () {
- if (this.onTapFavoriting != null) this.onTapFavoriting();
- },
- child: Container(
- child: Column(children: <Widget>[
- Icon(
- isFavorited ? Iconfont.shoucang1 : Iconfont.shoucang,
- size: 20.0,
- color: Color(isFavorited ? 0xff5589FF : 0xff555A64),
- ),
- Text(
- isFavorited ? "已收藏" : "收藏",
- style: TextStyle(
- color: Color(isFavorited ? 0xff5589FF : 0xff555A64),
- fontSize: 12,
- ),
- textAlign: TextAlign.start,
- ),
- ])),
- ),
- ],
- ),
- ),
- Container(
- height: 45,
- width: 240,
- decoration: BoxDecoration(
- color: Color(0xff5589FF),
- borderRadius: BorderRadius.circular(30),
- ),
- child: FlatButton(
- // padding: EdgeInsets.all(15.0),
- child: actionWidget != null
- ? actionWidget
- : Text(
- actionText,
- style: TextStyle(
- fontSize: 16,
- ),
- ),
- textColor: Colors.white,
- onPressed: () {
- if (onTapAction != null) onTapAction();
- },
- ),
- ),
- ],
- ),
- );
- }
- }
- class AlphabeticIndexBar extends StatelessWidget {
- final Map<String, double> positionAnchors;
- final ScrollController controller;
- const AlphabeticIndexBar({Key key, this.positionAnchors, this.controller})
- : super(key: key);
- @override
- Widget build(BuildContext context) {
- var alphabetAnchors = positionAnchors.keys
- .map(
- (e) => GestureDetector(
- child: Text(
- e,
- style: TextStyle(color: Color(0xff5589FF), fontSize: 15),
- ),
- onTap: () => controller.animateTo(positionAnchors[e],
- duration: Duration(milliseconds: 500),
- curve: Curves.decelerate),
- ),
- )
- .toList();
- return Column(
- // mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // crossAxisAlignment: CrossA,
- children: [
- ...alphabetAnchors,
- Text(
- '#',
- style: TextStyle(color: Color(0xff5589FF), fontSize: 15),
- )
- ],
- );
- }
- @override
- void debugFillProperties(DiagnosticPropertiesBuilder properties) {
- super.debugFillProperties(properties);
- properties
- .add(DiagnosticsProperty<ScrollController>('controller', controller));
- }
- }
- class CircularLoading extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Container(
- padding: EdgeInsets.only(top: 10, bottom: 10),
- color: ThemeUtils.getTabsBg(context),
- child: Center(
- child: SpinKitFadingCircle(
- color: Colors.blueAccent,
- size: 30.0,
- ),
- ),
- );
- }
- }
|