import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class TaobaoImageView extends StatefulWidget {
  @override
  _TaobaoImageViewState createState() => _TaobaoImageViewState();
}

class _TaobaoImageViewState extends State<TaobaoImageView> {
  List<String> _images = List();

  @override
  void initState() {
    TaobaoLoader.loadImages('553848677009').then((images) {
      _images = images;
      setState(() {});
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('淘宝图片加载'),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: _images.map((imageUrl) {
            return CachedNetworkImage(
              imageUrl: imageUrl ?? '',
              fit: BoxFit.fitWidth,
            );
          }).toList(),
        ),
      ),
    );
  }
}
