import 'package:flutter/material.dart';

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

  @override
  _fourthDemoState createState() {
    return _fourthDemoState();
  }
}

class _fourthDemoState extends State<fourthDemo> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
        appBar: AppBar(
          title: Text("jss测试第四个页面"),
        ),
        body: someDemo());
  }
}

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

  @override
  _someDemoState createState() {
    return _someDemoState();
  }
}

class _someDemoState extends State<someDemo> {
  List<int> listArrData = List();

  @override
  void initState() {
    super.initState();
    for (var i = 0; i < 100; i++) {
      listArrData.add(i);
    }
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scrollbar(
        child: RefreshIndicator(
      child: ListView(
        //y轴
        scrollDirection: Axis.vertical,
        children: listArrData
            .map((e) => Container(
                  width: 200,
                  height: 100,
                  child: Flex(
                    direction: Axis.vertical,
                    children: [
                      Text(e.toString()),
                      ElevatedButton(
                          onPressed: () {

                          },
                          child: Text("点击进入第5个页面"))
                    ],
                  ),
                  decoration: BoxDecoration(
                    color: Colors.red,
                  ),
                  //旋转跳跃我闭着眼
                  // transform: Matrix4.rotationZ(0.5),
                ))
            .toList(),
      ),
      onRefresh: _onRefresh,
    ));
  }

  Future _onRefresh() async {
    await Future.delayed(
      Duration(seconds: 2),
      () {
        print("object");
      },
    );
    return "";
  }
}
