123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807 |
- import 'package:flutter/material.dart';
- import 'package:liftmanager/res/gaps.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/internal/search/search_router.dart';
- import 'package:liftmanager/widgets/app_search_bar.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:liftmanager/internal/bbs/bbs_router.dart';
- import 'package:liftmanager/internal/means/means_router.dart';
- import 'package:liftmanager/widgets/bbs_content.dart';
- import 'package:liftmanager/internal/wode/page/video/my_video.dart';
- // import 'package:amap_all_fluttify/amap_all_fluttify.dart';
- import 'package:provider/provider.dart';
- import 'package:permission_handler/permission_handler.dart';
- import 'dart:async';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:liftmanager/mvp/base_page_state.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/internal/search/presenter/base_list_provider.dart';
- import 'package:liftmanager/widgets/state_layout.dart';
- import 'package:liftmanager/widgets/my_refresh_list.dart';
- import 'package:liftmanager/utils/url.dart';
- import 'package:flutter_spinkit/flutter_spinkit.dart';
- import 'dart:convert';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/utils/fast_notification.dart';
- import 'package:liftmanager/internal/bbs/model/mix_model.dart';
- import 'package:liftmanager/internal/bbs/presenter/mix_list_presenter.dart';
- import 'package:liftmanager/common/common.dart';
- import 'package:flustars/flustars.dart' as flustars;
- class CollectPage extends StatefulWidget {
-
- String index = "1";
-
- @override
- CollectPageState createState() => CollectPageState();
- }
- class CollectPageState extends BasePageState<CollectPage,MixListPresenter> {
- // NewsDetailItem item = NewsDetailItem();
- BaseListProvider<Records> provider = BaseListProvider<Records>();
- int checkIndex = 0;
-
- int _page = 1;
- List<String> titleList = [
- // "全部",
- "问答",
- "视频",
- "职位",
- "商品",
- ];
- @override
- void initState() {
- provider.setStateTypeNotNotify(StateType.loading);
- super.initState();
- _onRefresh();
- FastNotification.addListener("collectAction",(collectInit){
- if(mounted){
- setState(() {
-
-
- });
- _onRefresh();
- }
-
- });
- }
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- print(12366);
- }
- @override
- void deactivate() {
- super.deactivate();
- print(123667);
- }
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return Scaffold(
- appBar: MyAppBar(
- centerTitle: "我的收藏",
- ),
- body:Container(
- child: Stack(
- children: <Widget>[
- Positioned(
- child: Container(
- padding: EdgeInsets.only(bottom:5),
- // color:Color(0xffFAF7FA),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(width: 0.5, color: Color(0xffeeeeee)),
- ),
- // color: Color(0xffffffff),
- ),
- child:Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children:titleList.asMap().keys.map((i){
- return TabThis(item:titleList[i],tabIndex:i,checkIndex: checkIndex,fun:(){
- provider.list.clear();
- setState(() {
- checkIndex = i;
- });
- provider.setStateTypeNotNotify(StateType.loading);
- _onRefresh();
- print(checkIndex);
- });
- }).toList()
- )
- ),
- ),
-
- Container(
- child: ChangeNotifierProvider<BaseListProvider<Records>>(
- create: (_) => provider,
- child: Column(
- children: <Widget>[
- SizedBox(
- height:ScreenUtil().setWidth(50)
- ),
- Expanded(
- flex: 1,
- child: Consumer<BaseListProvider<Records>>(
- builder: (_, provider, __) {
- return MyListView(
- key: Key('mix_list'),
- itemCount: provider.list.length,
- stateType: provider.stateType,
- onRefresh: _onRefresh,
- loadMore: _loadMore,
- hasMore: provider.hasMore,
- itemBuilder: (_, index) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- checkIndex == 0?
- GestureDetector(
- child: provider.list[index]!=null?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),
- ),
- ),
- child:
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- "[${provider.list[index].brandName??""}]${provider.list[index].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: <Widget>[
- ClipRRect(
- borderRadius:
- BorderRadius.circular(
- ScreenUtil()
- .setWidth(18)),
- child: Container(
- child: LoadNetworkImage(
- provider.list[index].avatarUrl,
- width:
- ScreenUtil().setWidth(34),
- height:
- ScreenUtil().setWidth(34),
- ),
- )),
- Container(
- padding: EdgeInsets.only(
- left:
- ScreenUtil().setWidth(10)),
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- provider.list[index].userName??"",
- style: TextStyle(
- fontSize: ScreenUtil()
- .setSp(14),
- color: Color(0xff333333)),
- ),
- Text(
- provider
- .list[index]
- .createTime!=null?DateUtils.instance
- .getFormartData(
- timeSamp: provider
- .list[index]
- .createTime,
- format: "yyyy-MM-dd"):"",
- style: TextStyle(
- fontSize: ScreenUtil()
- .setSp(12),
- color: Color(0xffaaaaaa)),
- ),
- ],
- ),
- )
- ],
- ),
- ),
- Text(
- provider.list[index].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: provider.list[index].imgs !=
- null &&
- provider.list[index].imgs
- .isNotEmpty
- ? List<Widget>.from(provider
- .list[index].imgs
- .split(",")
- .asMap().keys.map((subindex) {
- // print(item);
- return Container(
- padding:subindex<provider
- .list[index].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(
- provider
- .list[index].imgs.split(",")[subindex],
- // height: width/375*75,
- height: ScreenUtil()
- .setWidth(80),
- width: ScreenUtil()
- .setWidth(110),
- isWater: true,
- ),
- ),
- );
- }).toList())
- : <Widget>[]),
- ),
- Text(
- "${provider.list[index].likeNum.toString()}人赞",
- textAlign: TextAlign.right,
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(14),
- ),
- )
- ]),
- ):Center(child: Text("加载中..."),),
- onTap: () {
- // print(item);
- if(provider.list[index].statuz == 1){
- NavigatorUtils.push(context,
- "${BbsRouter.questionDetail}?id=${provider.list[index].id.toString()}");
- }else {
- toasts("已下架");
- }
-
- },
- ):Container(child:null),
- checkIndex == 1?
- GestureDetector(
- child: provider.list[index]!=null?
- 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),
- ),
- ),
- child:
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(top:ScreenUtil().setWidth(8),bottom:ScreenUtil().setWidth(8)),
- height: width*0.24,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Container(
- width:width*0.5,
- child: Text(
- "${provider.list[index].title??""}",
- style: TextStyle(
- fontWeight: FontWeight.w600,
- fontSize: ScreenUtil().setSp(17)),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- Container(
- width:width*0.5,
- child: Text(
- "${provider.list[index].descr??""}",
- style: TextStyle(
- fontSize: ScreenUtil().setSp(15)),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- Container(
- width: width*0.5,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Container(
- width:width*0.18,
- child: Text(
- "${provider.list[index].brandName??""}",
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(14)),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- SizedBox(
- width:5
- ),
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- "${provider.list[index].likeNum??"0"}",
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(14)),
- textAlign: TextAlign.start,
- ),
- SizedBox(
- width:3
- ),
- Icon(
- IconData(0xe7cd,
- fontFamily: "myfont"),
- size: 14.0,
- color: Color(0xff999999),
- ),
- ],
- ),
-
- SizedBox(
- width:5
- ),
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- "${provider.list[index].browseNum??"0"}",
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(14)),
- textAlign: TextAlign.start,
- ),
- SizedBox(
- width:3
- ),
- Icon(
- IconData(0xe610,
- fontFamily: "myfont"),
- size: 14.0,
- color: Color(0xff999999),
- ),
- ],
- ),
-
-
- ],
- ),
- )
- ]),
- ),
- Container(
- padding: EdgeInsets.only(right:10),
- child: Stack(
- children: <Widget>[
- ClipRRect(
- borderRadius:
- BorderRadius.circular(1),
- child: Container(
- child: LoadNetworkImage(
- // imgFontUrl +
- // provider.list[index].cover,
- provider.list[index].cover,
- width: width*0.38,
- height: width*0.24,
- isWater: true,
- ),
- ),
- ),
- Positioned(
- left: width*0.17,
- top: width*0.08,
- child: Icon(
- IconData(0xe607,
- fontFamily: "myfont"),
- size: 26.0,
- color: Colors.white,
- ),
- )
- ],
- )),
- ],
- )
-
- )
- :Center(child:Text("加载中...")),
- onTap: () {
- if(provider.list[index].statuz == 1){
- NavigatorUtils.push(context,
- "${BbsRouter.videoDetail}?id=${provider.list[index].id.toString()}");
- }else {
- toasts("已下架");
- }
-
- },
- )
- :Container(child:null),
- checkIndex == 2?
- GestureDetector(
- child: provider.list[index]!=null?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),
- ),
- ),
- child: Column(
- // crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(
- bottom: ScreenUtil().setHeight(5)),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Container(
- width: width*0.4,
- child: Text(
- provider.list[index].job ?? '',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(17),
- color: Color(0xff333333),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- ),
- Container(
- width:width*0.4,
- child:Text(
- // 'jiage',
- "¥" +
- provider
- .list[index].lowerSalary
- .toString() +
- "-" +
- provider
- .list[index].upperSalary
- .toString(),
- textAlign: TextAlign.right,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(17),
- color: Color(0xffff0000),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- )
- ],
- ),
- ),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Container(
- width: width*0.5,
- child: Text(
- provider.list[index].companyName!=null ?provider.list[index].companyName:'',
- textAlign: TextAlign.left,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(14),
- color: Color(0xff999999),
- ),
- ),
- ),
- provider.list[index]
- .provinceName !=
- null?Container(
- width: width*0.35,
- child: Text(
- (provider.list[index]
- .provinceName !=
- null
- ? provider
- .list[index].provinceName
- : '') +
- "-" +
- (provider.list[index]
- .cityName !=
- null
- ? provider
- .list[index].cityName
- : ''),
- textAlign: TextAlign.right,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(14),
- color: Color(0xff999999),
- ),
- ),
- ):Container(child:null),
- ],
- ),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Container(
- width: width * 0.65,
- child: Text(
- provider.list[index].info ?? '',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(14),
- color: Color(0xff999999),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- ),
- Text(
- provider
- .list[index].createTime!=null?DateUtils.instance.getFormartData(
- timeSamp: provider
- .list[index].createTime,
- format: "yyyy-MM-dd"):"",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff999999),
- ),
- ),
- ],
- ),
- ]),
- ):Center(child: Text("加载中..."),),
- onTap: () {
-
- if(provider.list[index].statuz == 1){
- NavigatorUtils.push(context,
- "${BbsRouter.positionDetail}?id=${provider.list[index].id.toString()}");
- }else {
- toasts("已下架");
- }
- },
- )
- :Container(child:null),
- checkIndex == 3?
- InkWell(
- child: provider.list[index]!=null?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),
- ),
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- ClipRRect(
- borderRadius: BorderRadius.circular(5),
- child: Container(
- padding: EdgeInsets.only(
- right: ScreenUtil().setWidth(10)),
- child: LoadNetworkImage(
- provider.list[index].imgs.split(",")[0],
- width: ScreenUtil().setWidth(90),
- height: ScreenUtil().setWidth(90),
- isWater: true,
- ),
- ),
- ),
- Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- provider.list[index].sname??"",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(15),
- color: Color(0xff333333),
- ),
- ),
- Text(
- provider.list[index].bname??""
- .toString(),
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff666666),
- ),
- ),
- Text(
- "供应商:${provider.list[index].manufacturer}",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff666666),
- ),
- ),
- Text(
- "Tel:${provider.list[index].telephone}",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff666666),
- ),
- ),
- ],
- ),
- ]),
- ):Center(child: Text("加载中..."),),
- onTap: () {
- print(index);
- if(provider.list[index].statuz == 1){
- NavigatorUtils.push(context,
- "${BbsRouter.productDetail}?id=${provider.list[index].id.toString()}");
- }else {
- toasts("已下架");
- }
-
- },
- )
- :Container(child:null),
- ],
- );
-
- },
- );
- }))
- ],
- )
-
- ))
- ],
- )
- )
- );
- }
- Future _onRefresh() async {
- _page = 1;
- if(checkIndex==0){
- await presenter.getQuestionList(_page);
- }
- else if(checkIndex==1){
- await presenter.getVideoList(_page);
- }
- else if(checkIndex==2){
- await presenter.getPositionList(_page);
- }
- else if(checkIndex==3){
- await presenter.getShopList(_page);
- }
-
- }
- Future _loadMore() async {
- _page++;
- if(checkIndex==0){
- await presenter.getQuestionList(_page);
- }else if(checkIndex==1){
- await presenter.getVideoList(_page);
- }
- else if(checkIndex==2){
- await presenter.getPositionList(_page);
- }
- else if(checkIndex==3){
- await presenter.getShopList(_page);
- }
-
- }
- @override
- MixListPresenter createPresenter() {
- return MixListPresenter();
- }
- }
- class TabThis extends StatelessWidget {
- TabThis({Key key,this.item,this.tabIndex,this.fun,this.checkIndex}) : super(key: key);
- String item;
- int tabIndex;
- int checkIndex;
- Function fun;
- @override
- Widget build(BuildContext context) {
- return Container(
- padding: EdgeInsets.only(top:ScreenUtil().setWidth(10)),
- child: Container(
- child:Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children:<Widget>[
- GestureDetector(
- onTap: (){
- fun();
- },
- child: Container(
- padding: EdgeInsets.only(bottom:6),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(width: 2, color: checkIndex==tabIndex? Color(0xff02A0FD):Colors.transparent),
- ),
- // color: Color(0xff9FD1FE),
- ),
- child:Text(
- item,
- style: TextStyle(
- color:checkIndex==tabIndex? Color(0xff02A0FD):Color(0xff666666),
- fontSize:ScreenUtil().setSp(14)
- ),
- textAlign:TextAlign.center,
- ),
- )
- )
- ]
- )
- ),
- );
- }
- }
|