123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551 |
- 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:flutter_screenutil/flutter_screenutil.dart';
- import 'package:liftmanager/widgets/bbs_content.dart';
- import 'package:liftmanager/mvp/base_page_state.dart';
- import 'package:liftmanager/internal/bbs/presenter/video_list_presenter.dart';
- import 'package:liftmanager/internal/search/presenter/base_list_provider.dart';
- import 'package:liftmanager/internal/bbs/model/mix_model.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 'package:provider/provider.dart';
- import 'package:liftmanager/utils/utils.dart';
- import 'package:liftmanager/utils/theme_utils.dart';
- class VideoList extends StatefulWidget {
- // QuestionList(this.index);
- // final String index;
- @override
- VideoListState createState() => VideoListState();
- // State<StatefulWidget> createState() {
- // return VideoListState();
- // }
- }
- class VideoListState
- extends BasePageState<VideoList, VideoListPresenterSeconds> {
- // class VideoListState extends State<VideoList> {
- // NewsDetailItem item = NewsDetailItem();
- BaseListProvider<Records> provider = BaseListProvider<Records>();
- int _page = 1;
- int brandIdss;
- int exprtyIdss;
- bool sortBool = true;
- String checkTypeName;
- String checkType;
- String brandName = "品牌";
- String masterName = "专家";
- ScrollController _scrollController = new ScrollController();
- String searchWord;
- List<dynamic> typeList;
- List<dynamic> brandList;
- Future getBrandList() async {
- await NewApiService().getBrandListNoPage(
- onSuccess: (res) {
- if (res != null) {
- brandList = res;
- typeList = brandList;
- setState(() {});
- }
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- List<dynamic> expertList;
- Future getExpertList() async {
- await NewApiService().getExpertListNoPage(
- onSuccess: (res) {
- if (res != null) {
- expertList = res;
- typeList = expertList;
- setState(() {});
- }
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- @override
- void initState() {
- provider.setStateTypeNotNotify(StateType.loading);
- super.initState();
- _onRefresh();
- }
- @override
- void dispose() {
- _scrollController.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- double height = MediaQuery.of(context).size.height;
- return ChangeNotifierProvider<BaseListProvider<Records>>(
- create: (_) => provider,
- child: Scaffold(
- appBar: SearchAppBar2(
- searchWidth:width*0.7,
- onPressed: (text) {
- searchWord = text;
- _onRefresh();
- },
- actions: <Widget>[
- FlatButton(
- child: Text(
- "上传",
- style: TextStyle(
- color: Colors.white, fontSize: ScreenUtil().setSp(15)),
- ),
- textColor: Colours.dark_text,
- highlightColor: Colors.transparent,
- onPressed: () {
- NavigatorUtils.push(context, BbsRouter.videoUpload);
- },
- )
- // Utils.getAuthByRouter('upload_video', false) ?
- // FlatButton(
- // child: Text(
- // "上传",
- // style: TextStyle(
- // color: Colors.white, fontSize: ScreenUtil().setSp(15)),
- // ),
- // textColor: Colours.dark_text,
- // highlightColor: Colors.transparent,
- // onPressed: () {
- // NavigatorUtils.push(context, BbsRouter.videoUpload);
- // },
- // )
- // : Container()
- ],
- ),
- body: Container(
- child:Stack(
- children: <Widget>[
- Column(
- children: <Widget>[
- Container(
- width: width,
- height: ScreenUtil().setWidth(50),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(width: 0.5, color: Colours.line),
- ),
- ),
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15)),
- // color: Color(0xFFF1F4FC),
- child: Row(
- children: <Widget>[
- GestureDetector(
- onTap: (){
- typeList = [];
- getBrandList();
- setState(() {
- sortBool = false;
- checkTypeName = "品牌";
- checkType = "brand";
- });
-
- },
- child: Row(
- children: <Widget>[
- Text(
- brandName,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(16)),
- textAlign: TextAlign.start,
- ),
- Container(
- padding: EdgeInsets.only(top: 3),
- child: Icon(
- Icons.keyboard_arrow_down,
- size: 26.0,
- ),
- )
- ],
- ),
- ),
- SizedBox(width: ScreenUtil().setWidth(30)),
- // GestureDetector(
- // onTap: (){
- // typeList = [];
- // getExpertList();
- // setState(() {
- // sortBool = false;
- // checkTypeName = "专家";
- // checkType = "master";
- // });
- // },
- // child: Row(
- // children: <Widget>[
- // Text(
- // masterName,
- // style: TextStyle(
- // color: Color(0xff333333),
- // fontSize: ScreenUtil().setSp(16)),
- // textAlign: TextAlign.start,
- // ),
- // Container(
- // padding: EdgeInsets.only(top: 3),
- // child: Icon(
- // Icons.keyboard_arrow_down,
- // size: 26.0,
- // color: Color(0xff333333),
- // ),
- // )
- // ],
- // ),
- // ),
- ],
- )),
- Expanded(
- flex: 1,
- child: Consumer<BaseListProvider<Records>>(
- builder: (_, provider, __) {
- return MyListView(
- key: Key('video_list'),
- itemCount: provider.list.length,
- stateType: provider.stateType,
- onRefresh: _onRefresh,
- pageSize:10,
- loadMore: _loadMore,
- hasMore: provider.hasMore,
- itemBuilder: (_, index) {
- return GestureDetector(
- 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),
- ),
- ),
- 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,
- ),
- )
- ],
- )),
- ],
- )
-
- ),
- onTap: () {
- NavigatorUtils.push(context,
- "${BbsRouter.videoDetail}?id=${provider.list[index].id.toString()}");
- },
- );
- },
- );
- }))
- ],
- ),
- !sortBool?
- Positioned(
- top:0,
- left:0,
- child: GestureDetector(
- onTap: (){
- setState(() {
- sortBool = true;
- });
- },
- child: Container(
- width:width,
- height:height,
- color: Color.fromRGBO(0, 0, 0, 0.5)
- ),
- )
- )
- :Container(
- child:null
- ),
- !sortBool?
- Positioned(
- top:0,
- left:0,
- child:Container(
- width: width,
- height:height/2,
- color: ThemeUtils.getDialogTextFieldColor(context),
- padding: EdgeInsets.all(10),
- child:ListView(
- children:<Widget>[
- GestureDetector(
- onTap: (){
- if(checkType=="brand"){
-
- setState(() {
- brandIdss = null;
- brandName = '品牌';
- sortBool = true;
- _onRefresh();
- });
- }else if (checkType=="master"){
-
- setState(() {
- exprtyIdss = null;
- masterName = '专家';
- sortBool = true;
- _onRefresh();
- });
- }
-
-
- },
- child:Container(
- padding: EdgeInsets.only(left:5,top:5,bottom:10),
- child:Text(
- checkTypeName,
- style: TextStyle(
- color:Color(0xff666666),
- fontSize:ScreenUtil().setSp(16)
- ),
- textAlign:TextAlign.start,
- ),
- )
- ),
- typeList!=null&&typeList!=[]?Container(
- child: Wrap(
- alignment: WrapAlignment.start,
- crossAxisAlignment: WrapCrossAlignment.center,
- children: typeList.asMap().keys.map((index){
- return InkWell(
- onTap: (){
- print("666");
-
- setState(() {
- sortBool = true;
- if(checkType=="brand"){
- brandName = typeList[index].name??"";
- brandIdss = typeList[index].id;
- provider.setStateTypeNotNotify(StateType.loading);
- _onRefresh();
- }else if(checkType=="master"){
- masterName= typeList[index].name??'';
- exprtyIdss= typeList[index].userId;
- provider.setStateTypeNotNotify(StateType.loading);
- _onRefresh();
- }
- });
-
- },
- child: Container(
- width: width/4-15,
- padding: EdgeInsets.only(bottom:ScreenUtil().setWidth(10),top:ScreenUtil().setWidth(10)),
- margin: EdgeInsets.only(left:5,right:5,bottom:5,top:5),
- decoration: BoxDecoration(
- // border: Border(
- // bottom: BorderSide(width: 0.5, color: Colours.line),
- // ),
- color: Color(0xfff5f5f5)
- ),
- child:Text(
- typeList[index].name??"",
- style: TextStyle(
- color: typeList[index].id == brandIdss?Color(0xffff0000):Color(0xff666666),
- fontSize:ScreenUtil().setSp(15)
- ),
- textAlign:TextAlign.center,
- ),
- ),
- );
-
- }).toList(),
- )
- ):loadCircle()
- ],
-
- )
- )
- ):
- Container(
- child:null
- ),
- ],
- )
- )
- )
- );
- }
- Widget loadCircle() {
- return Container(
- padding: EdgeInsets.only(top: 10, bottom: 10),
- color: ThemeUtils.getTabsBg(context),
- child: Center(
- child: SpinKitFadingCircle(
- color: Colors.blueAccent,
- size: 30.0,
- ),
- ),
- );
- }
- Future _onRefresh() async {
- _page = 1;
- await presenter.getVideoList(_page,brandIdss,searchWord);
- }
- Future _loadMore() async {
- _page++;
- await presenter.getVideoList(_page,brandIdss,searchWord);
- }
- @override
- VideoListPresenterSeconds createPresenter() {
- return VideoListPresenterSeconds();
- }
- }
|