123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:liftmanager/internal/bbs/model/coupon_model_page.dart';
- import 'package:liftmanager/internal/search/presenter/base_list_provider.dart';
- import 'package:liftmanager/internal/wode/presenter/red_list_presenter.dart';
- import 'package:liftmanager/mvp/base_page_state.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 RedbaoPage extends StatefulWidget {
- // QuestionList(this.index);
- // final String index;
- @override
- RedbaoPageState createState() => RedbaoPageState();
- }
- class RedbaoPageState extends BasePageState<RedbaoPage, RedtListPresenter>
- with AutomaticKeepAliveClientMixin {
- // NewsDetailItem item = NewsDetailItem();
- BaseListProvider<Records> provider = BaseListProvider<Records>();
- ScrollController _scrollController = new ScrollController();
- int _page = 1;
- @override
- void initState() {
- provider.setStateTypeNotNotify(StateType.loading);
- super.initState();
- _onRefresh();
- print(66666);
- }
- @override
- void dispose() {
- _scrollController.dispose();
- super.dispose();
- }
- getScenario(int type) {
- String str;
- if (type == 0) {
- str = "全场通用";
- } else if (type == 1) {
- str = "仅限出诊问诊服务";
- } else if (type == 2) {
- str = "仅限题库";
- } else if (type == 3) {
- str = "仅限视频";
- }
- return str;
- }
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return ChangeNotifierProvider<BaseListProvider<Records>>(
- create: (_) => provider,
- child: Scaffold(
- resizeToAvoidBottomPadding: true,
- appBar: MyAppBar(centerTitle: "我的红包"),
- body: Container(
- // color: Color(0xFFF1F4FC),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Expanded(
- flex: 1,
- child: Consumer<BaseListProvider<Records>>(
- builder: (_, provider, __) {
- return MyListView(
- key: Key('red_list'),
- itemCount: provider.list.length,
- stateType: provider.stateType,
- onRefresh: _onRefresh,
- loadMore: _loadMore,
- pageSize: 8,
- hasMore: provider.hasMore,
- itemBuilder: (_, index) {
- return Container(
- child: Column(
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(
- // left: ScreenUtil().setWidth(10),
- // right: ScreenUtil().setWidth(10),
- // top: ScreenUtil().setWidth(15)),
- child: InkWell(
- child: Container(
- // padding:
- // EdgeInsets.only(
- // left: ScreenUtil().setWidth(15),
- // right: ScreenUtil().setWidth(15),
- // top: ScreenUtil().setWidth(10),
- // bottom: ScreenUtil().setWidth(10)),
- child: Stack(
- children: [
- LoadAssetImage(
- // image: AssetImage(i['img']),
- 'img_hongbao_bg',
- width: width - 5,
- height: 140,
- fit: BoxFit.fill,
- // alignment: Alignment.centerLeft,
- ),
- Positioned(
- top: 20,
- left: 20,
- right: 20,
- child: Row(
- children: [
- LoadAssetImage(
- // image: AssetImage(i['img']),
- 'icon_hongbao',
- width: 30,
- height: 40,
- fit: BoxFit.cover,
- // ScreenUtil().setHeight(141),
- // // alignment: Alignment.centerLeft,
- ),
- SizedBox(
- width: 20,
- ),
- Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: [
- Text(
- '会员专用红包',
- style: TextStyle(
- color:
- Color(0xff282828),
- fontWeight:
- FontWeight.bold,
- fontSize: 17),
- ),
- SizedBox(
- height: 6,
- ),
- Text('全场通用,支付立减',
- style: TextStyle(
- color:
- Color(0xff909090),
- fontSize: 13)),
- ],
- ),
- Expanded(child: Container()),
- RichText(
- text: TextSpan(
- text: '¥',
- style: TextStyle(
- color:
- Color(0xffF95046),
- fontSize: 18,
- fontWeight:
- FontWeight.bold),
- children: <TextSpan>[
- TextSpan(
- text: provider
- .list[index]
- .coupon
- .price
- .toString(),
- style: TextStyle(
- color: Color(
- 0xffF95046),
- fontSize: 40,
- fontWeight:
- FontWeight
- .bold)),
- ]))
- // Container(
- // alignment: Alignment.bottomLeft,
- // child: Row(
- // children: [
- // Container(
- // alignment: Alignment.bottomLeft,
- // height: 30,
- // child:
- // Text('¥',style: TextStyle(color: Color(0xffF95046)),),),
- // Text('10',style: TextStyle(color: Color(0xffF95046),fontSize: 40,fontWeight: FontWeight.bold)),
- // ],
- // ),
- // )
- ],
- )),
- // Positioned(
- // bottom: 25,
- // left: 30,
- // right: 30,
- // child: Row(
- // children: [
- // Text(
- // '4天后过期',
- // style: TextStyle(
- // color: Color(0xffF95046),
- // fontSize: 12),
- // ),
- // Expanded(child: Container()),
- // Text(
- // '有效时间:2020.10.30 11:59',
- // style: TextStyle(
- // color: Color(0xff909090),
- // fontSize: 12),
- // ),
- // ],
- // ))
- ],
- )
- // Row(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // Container(
- // padding: EdgeInsets.only(
- // right:
- // ScreenUtil().setWidth(25),
- // left:
- // ScreenUtil().setWidth(10),
- // top: ScreenUtil()
- // .setWidth(15)),
- // child: Icon(
- // const IconData(0xe630,
- // fontFamily: "myfont"),
- // size: 60.0,
- // color: Color(0xffFE524C),
- // ),
- // ),
- // Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // Text(
- // provider
- // .list[index].coupon.price
- // .toString(),
- // textAlign: TextAlign.left,
- // style: TextStyle(
- // fontSize:
- // ScreenUtil().setSp(26),
- // color: Color(0xff333333),
- // ),
- // ),
- // // Row(
- // // children: <Widget>[
- // // Text(
- // // DateUtils.instance
- // // .getFormartData(
- // // timeSamp: provider.list[index].coupon.createTime,
- // // format: "yyyy-MM-dd"),
- // // textAlign: TextAlign.left,
- // // style: TextStyle(
- // // fontSize:ScreenUtil().setSp(14),
- // // color:Color(0xff999999),
- // // ),
- // // ),
- // // Text(
- // // "至",
- // // textAlign: TextAlign.left,
- // // style: TextStyle(
- // // fontSize:ScreenUtil().setSp(14),
- // // color:Color(0xff999999),
- // // ),
- // // ),
- // // Text(
- // // DateUtils.instance
- // // .getFormartData(
- // // timeSamp: provider.list[index].coupon.updateTime,
- // // format: "yyyy-MM-dd"),
- // // textAlign: TextAlign.left,
- // // style: TextStyle(
- // // fontSize:ScreenUtil().setSp(14),
- // // color:Color(0xff999999),
- // // ),
- // // ),
- // // ],
- // // ),
- // SizedBox(height: 8),
- // Container(
- // width: ScreenUtil()
- // .setWidth(200),
- // height: 0.5,
- // color: Color(0xffeeeeee),
- // child: null,
- // ),
- // SizedBox(height: 5),
- // Text(
- // getScenario(provider
- // .list[index]
- // .coupon
- // .scenario),
- // textAlign: TextAlign.left,
- // style: TextStyle(
- // fontSize:
- // ScreenUtil().setSp(14),
- // color: Color(0xff999999),
- // ),
- // ),
- // ],
- // ),
- // ]),
- ),
- onTap: () {},
- )
- // MyCard(
- // child:
- // ),
- )
- ],
- ),
- );
- },
- );
- }))
- ],
- ),
- ),
- ));
- }
- Future _onRefresh() async {
- _page = 1;
- await presenter.getRedList(_page);
- }
- Future _loadMore() async {
- _page++;
- await presenter.getRedList(_page);
- }
- @override
- RedtListPresenter createPresenter() {
- return RedtListPresenter();
- }
- bool get wantKeepAlive => true;
- }
|