import 'package:flutter/material.dart';
import 'package:flutter_wallet/base/YSBase.dart';
import 'package:flutter_wallet/tools/YSRefrehLoad.dart';
import 'package:flutter_wallet/tools/YSTools.dart';
import 'package:flutter_wallet/wallet/view/YSWalletListItemView.dart';

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

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

class YSWalletTokenChooseState extends State<YSWalletTokenChoose> {
  List _dataArray = [];
  @override
  Widget build(BuildContext context) {
    return YSBase(
      ysTitle: '资产',
      ysChild: Container(
        height: ysHeight(context),
        width: ysWidth(context),
        child: YSRefreshLoad(
          url: 'tokens',
          request: {'chain_id':YSData().typeId},
          postData: (value) {
            _dataArray = value;
            setState(() {});
          },
          isLoading: true,
          child: ListView.builder(
            itemBuilder: (context, index) {
              Map item = _dataArray[index];
              return YSWalletListChooseItemView(item: item,);
            },
            itemCount: _dataArray.length,
            padding: const EdgeInsets.all(0),
            shrinkWrap: true,
            physics: const NeverScrollableScrollPhysics(),
          ),
        ),
      ),
    );
  }
}
