import 'package:flutter/material.dart';
import 'package:netrain_flutter_app/jishuaishuai/fourthVC.dart';


class nextViewDemo extends StatelessWidget {
  // const nextViewDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black26,
      appBar: AppBar(
        title: Text("jss测试第三界面"),

      ),
      body: Container(
        child:  Flex(
          direction: Axis.vertical,
          children: [

            ElevatedButton(

              onPressed: () {
                Navigator.of(context).pop(
                    "我传过来值了，这是一个对象类型"
                );
              },
              child: Text("点击返回传值"),
            ),
            ElevatedButton(onPressed: () {
              Navigator.of(context).push(MaterialPageRoute(
                builder:(context){
                  return fourthDemo();
                },
               settings: RouteSettings(
                 name: "thirdVC"
               )

              )

              );
            }, child: Container(
              child: Text("点击进入第四个页面"),
            )
            ),
            listViewDemo(),
            WarpDemo(),

          ],
        ),
      )



    );
  }
}

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

  @override
  _listViewDemoState createState() {
    return _listViewDemoState(

    );
  }
}

class _listViewDemoState extends State<listViewDemo> {
  @override
  void initState() {
    super.initState();
    //创建时
  }

  @override
  void dispose() {
    //销毁时
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      width: 600,
      height: 300,
      color: Colors.grey,
      child:Align(
        alignment:Alignment(-0.5,0.5),
        child: Stack(
          alignment: AlignmentDirectional.topStart,
          children: [

            Container(
              width: 100,
              height: 100,
              color: Colors.orange,
            ),
            Positioned(
                left: 20,
                right: 30,
                top: 10,
                bottom: 20,
                child: Container(
                  color: Colors.red,
            )),
          ],
        ),
      )
    );
  }
}

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

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

class _WarpDemoState extends State<WarpDemo> {
  List<int>listArr = List();

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

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

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Wrap(
      // spacing: 10.0,
      runAlignment: WrapAlignment.center,
      // runSpacing: 1,
      children: listArr.map((e) => Container(
        height: 100,
        width: 100,
        child: Text(e.toString()),
        color: Colors.blue,
      )).toList(

      )
    );
  }
}