import 'package:flutter/material.dart';
import 'package:flutterappfuyou/code/base/YSBase.dart';
import 'package:flutterappfuyou/code/base/YSTools.dart';

import '../base/YSNetWorking.dart';

class YSCouponHelp extends StatefulWidget {
  const YSCouponHelp({Key key}) : super(key: key);

  @override
  _YSCouponHelpState createState() => _YSCouponHelpState();
}

class _YSCouponHelpState extends State<YSCouponHelp> {
  List _dataArray = [];
  @override
  void initState() {
    Future.delayed(Duration(seconds: 0)).then((value) {
      _getHelpData();
    });
    super.initState();
  }
  _getHelpData() async{
    Map dict = await ysRequestHttp(context, requestType.post, 'transfer/coupon/getPictures', {'idcard':User().idCard,'type':'CONSUMPTION_ASSISTANCE'});
    if(dict!=null){
      _dataArray = dict['data']??[];
      // LogUtil.d(_dataArray);
      setState(() {});
    }
  }
  @override
  Widget build(BuildContext context) {
    return YSBase(
      ystitle: '使用帮助',
      yschild: ListView.builder(
        itemBuilder: (context,index){
          String url = _dataArray[index];
          // LogUtil.d(url);
          return Image.network(url,fit: BoxFit.fill,key: Key('help'),);
        },
        itemCount: _dataArray.length,
        padding: EdgeInsets.all(0),
      ),
    );
  }
}
