123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- import 'package:flustars/flustars.dart' as flustars;
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:liftmanager/common/common.dart';
- import 'package:liftmanager/internal/bbs/model/mix_model.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/wode/wode_router.dart';
- import 'package:liftmanager/mvp/base_page_state.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/fast_notification.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:liftmanager/widgets/my_refresh_list.dart';
- import 'package:liftmanager/widgets/state_layout.dart';
- import 'package:provider/provider.dart';
- class MyVideo extends StatefulWidget {
- // QuestionList(this.index);
- // final String index;
- @override
- MyVideoState createState() => MyVideoState();
- }
- class MyVideoState extends BasePageState<MyVideo, MyVideoListPresenter>
- with AutomaticKeepAliveClientMixin {
- // NewsDetailItem item = NewsDetailItem();
- BaseListProvider<Records> provider = BaseListProvider<Records>();
- ScrollController _scrollController = new ScrollController();
- int _page = 1;
- String searchWord;
- @override
- void initState() {
- provider.setStateTypeNotNotify(StateType.loading);
- super.initState();
- _onRefresh();
- print(66666);
- FastNotification.addListener("initMyVideo", (initThisMyVideo) {
- if (mounted) {
- _onRefresh();
- }
- });
- }
- getCheckFlag(checkFlag) {
- String str;
- if (checkFlag == 0) {
- str = "已驳回";
- } else if (checkFlag == 1) {
- str = "审核通过";
- } else if (checkFlag == 2) {
- str = "待审核";
- }
- return str;
- }
- @override
- void dispose() {
- _scrollController.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return ChangeNotifierProvider<BaseListProvider<Records>>(
- create: (_) => provider,
- child: Scaffold(
- appBar: MyAppBar(
- centerTitle: '我的视频',
- // searchWidth: width * 0.7,
- // onPressed: (text) {
- // searchWord = text;
- // _onRefresh();
- // },
- actions: <Widget>[
- FlatButton(
- child: Text(
- "上传",
- style: TextStyle(color: Colours.text, fontSize: 14),
- ),
- // textColor: Colours.text,
- // highlightColor: Colors.transparent,
- onPressed: () {
- // NavigatorUtils.push(context, BbsRouter.videoUpload);
- NavigatorUtils.push(
- context, "${WodeRouter.videoUpload}?id=");
- },
- )
- ],
- ),
- body: Container(
- child: Stack(
- children: <Widget>[
- Column(
- children: <Widget>[
- 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: 15,
- // right: ScreenUtil().setWidth(15),
- top: 10,
- bottom: 10),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 0.5, color: Colours.line),
- ),
- ),
- child: Row(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // mainAxisAlignment:
- // MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Expanded(
- // color: Colors.red,
- // 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.w400,
- color:
- Color(0xff222222),
- fontSize: 15),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow:
- TextOverflow.ellipsis,
- ),
- ),
- Container(
- // width: width * 0.5,
- child: Text(
- "${provider.list[index].descr ?? ""}",
- style: TextStyle(
- fontWeight:
- FontWeight.w600,
- color:
- Color(0xff999999),
- fontSize: 12),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow:
- TextOverflow.ellipsis,
- ),
- ),
- SizedBox(
- height: 30,
- ),
- // Expanded(child: Container()),
- Row(
- // crossAxisAlignment: CrossAxisAlignment.baseline,
- mainAxisAlignment:
- MainAxisAlignment
- .spaceBetween,
- children: <Widget>[
- Container(
- alignment:
- Alignment.center,
- padding:
- EdgeInsets.fromLTRB(
- 5, 0, 5, 2),
- // width: width * 0.35,
- decoration:
- new BoxDecoration(
- //背景
- color:
- Color(0x215887FF),
- //设置四周圆角 角度
- borderRadius:
- BorderRadius.all(
- Radius.circular(
- 4.0)),
- //设置四周边框
- ),
- child: Text(
- "${provider.list[index].brandName ?? ""}",
- style: TextStyle(
- color: Color(
- 0xff999999),
- fontSize: 11),
- textAlign:
- TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow
- .ellipsis,
- ),
- ),
- // SizedBox(width: 5),
- // Expanded(child: Container()),
- Row(
- // mainAxisAlignment:
- // MainAxisAlignment
- // .spaceBetween,
- children: <Widget>[
- Container(
- // width: width * 0.15,
- child: Text(
- "${provider.list[index].browseNum ?? "0"}浏览·${provider.list[index].likeNum ?? "0"}赞",
- style: TextStyle(
- color: Color(
- 0xffCCCCCC),
- fontSize: 11),
- textAlign:
- TextAlign.right,
- maxLines: 1,
- overflow:
- TextOverflow
- .ellipsis,
- ),
- ),
- SizedBox(
- width: 10,
- )
- ],
- ),
- ],
- )
- ]),
- ),
- // Expanded(child: Container()),
- Container(
- padding: EdgeInsets.only(right: 10),
- child: Stack(
- children: <Widget>[
- ClipRRect(
- borderRadius:
- BorderRadius.circular(7),
- child: Container(
- child: LoadNetworkImage(
- // imgFontUrl +
- // provider.list[index].cover,
- provider
- .list[index].cover,
- width: 140,
- height: 85,
- isWater: false,
- ),
- ),
- ),
- Positioned(
- left: width * 0.17,
- top: width * 0.08,
- child: Icon(
- const IconData(0xe8e0,
- fontFamily: "Iconfont"),
- size: 26.0,
- color: Colors.white,
- ),
- ),
- Positioned(
- right: 0,
- top: 0,
- child: Container(
- padding:
- EdgeInsets.fromLTRB(
- 5, 2, 5, 2),
- decoration:
- new BoxDecoration(
- //背景
- color:
- Color(0x4c000000),
- //设置四周圆角 角度
- borderRadius:
- BorderRadius.all(
- Radius.circular(
- 4.0)),
- //设置四周边框
- // border: new Border.all(width: 1, color: Colors.red),
- ),
- child: Text(
- provider.list[index]
- .checkFlag !=
- null
- ? getCheckFlag(
- provider
- .list[index]
- .checkFlag)
- : "",
- style: TextStyle(
- color: Colors.white,
- fontSize: 10),
- textAlign:
- TextAlign.start,
- ),
- ))
- ],
- )),
- ],
- )),
- onTap: () {
- NavigatorUtils.push(context,
- "${WodeRouter.videoDetail}?id=${provider.list[index].id.toString()}");
- },
- );
- },
- );
- }))
- ],
- ),
- ],
- ))));
- }
- Future _onRefresh() async {
- _page = 1;
- await presenter.getVideoList(_page,
- int.parse(flustars.SpUtil.getString(Constant.userId)), searchWord);
- }
- Future _loadMore() async {
- _page++;
- await presenter.getVideoList(_page,
- int.parse(flustars.SpUtil.getString(Constant.userId)), searchWord);
- }
- @override
- MyVideoListPresenter createPresenter() {
- return MyVideoListPresenter();
- }
- bool get wantKeepAlive => true;
- }
|