FlutterDart乱写笔记(个人笔记)

Posted AirZilong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FlutterDart乱写笔记(个人笔记)相关的知识,希望对你有一定的参考价值。

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:http/http.dart' as http;

// void main() => runApp(MyApp());
void main() 
  // print(1111);
  var a = 1;
  int b = 10;
  String c = "hi";
  dynamic d = 1;
  final FinalValue = 10;
  const Nae = 20;
  dynamic aa = 1;
  aa = 0.1;
  var aac = "13";
  var canP = true;
  var array = [1,2,3,4];
  List<int> array2 = [1,2,3,4];
  List<String> array3 = ["1","2"];
  var dic = new Map();
  dic["name"] = "张三";
  dic["age"] = 20;
  dic["clothe"] = ["1","2"];
  // print("dic = $dic, $dic["name"]");
  dic['name'] = 1;
  // print("dic = $dic, $dic["name"]");
  // print("isMap = $dic is Map");
  // print(add3(101, 20));
  // tall2(drug: "222");
  // type name
  // name: type
  // tall();
  // print(haveValue2(1));

  List<int> earchList = [1,2,3];
  earchList.forEach(foreach);
  var f1 = foreach;
  var f2 = foreach;
  var f3 = foreach;
  num bbbbbbbbbb, ccccccc;
  bbbbbbbbbb = 1;
  ccccccc = 2;
  // var f4 = (int a) => print("a=$a");

  // f1(10);
  // f4(20);
  // test((param) 
  //   print(param);
  // );

  // var me = new Person("123", 20);
  // me..eat()..sleep()..study();
  // me.eat();
  // var he = new Person.create();
  // var m = new GreateMan(10, 20, 30);

  // print(m.lastM);
  // m.lastM = 1;
  // print(m.lastM);
  var stu = new Student(1, 2);
  var stu1 = new Student(1, 2);
  stu = stu1 + stu;
  print(stu.x);
  stu.sleep();

  var ccc = LVColor.red;
  String aaaa = "132312";
  // print(getNetDataz());

Future<String> getNetDataz() async
  http.Response res = await http.get("http://www.jianshu.com/p/06aebcad0543");
  print(res);
  return "res.body";


class GoodStudent = Student with A;

class A 



abstract class Dear 
  void eat();
  void sleep() 
    print("sleep");
  


enum LVColor 
  red, green, blue


class Student extends Dear 

  num x, y;
  Student(this.x, this.y);
  Student operator +(Student v) => new Student(x + v.x, y + v.y);
  Student operator -(Student v) => new Student(x - v.x, y - v.y);


  @override
  void eat() 
    print("eat");
  


class GreateMan 
  num myMoney, width, height;
  GreateMan(this.myMoney, this.width, this.height);
  num get lastM 
    return width + height;
  
  set lastM(num value) => width = value + height;
  num get aaaa 
    print(111111);
    return 1111;
  
  // GreateMan.create() : super.create() 
  //   print("gregeman = $name");
  // 


class Rectangle 
  num myMoney, top, width, height;

  // 构造方法传入left, top, width, height几个参数
  Rectangle(this.myMoney, this.top, this.width, this.height);

  // right, bottom两个成员变量提供getter/setter方法
  num get right => myMoney + width;
  set right(num value) => myMoney = value - width;
  // num get bottom => top + height;
  // set bottom(num value) => top = value - height;




class Person
  String name;
  int age;
  var aaa = 10;

  Person.create() 
    // name = "账务";
    age = 20;
    var aaaaa = name;
  

  // Person(this.name, this.age);
  eat() 
    print("吃饭");
  
  sleep() 
    print("睡觉");
  
  study() 
    print("打豆豆");
  


test(Function callback)
  callback("张三");


foreach(int a) 
  print(a);


haveValue3(int a, int b, String c) 
  return a + b;


int haveValue2(int a, [int b = 10])
  b = 20;
  return a + b;


int haveValue(int a, int b = 10) 
  b = 30;
  return a + b;


tall2(drug: String) 
  print(drug);


tall(String drug) 
  print(drug);


int add(int a, int b ) 
  return a + b;


add2(int a, int c) 
  return a + c;


add3(a, b) => a + b;


class MyApp extends StatelessWidget 
  @override
  Widget build(BuildContext context) 
    return MaterialApp(
      home: Builder(builder: buildScaffold),
    );
  


///创建一个widget
Widget buildScaffold(BuildContext context) 
  return Scaffold(
    appBar: AppBar(title: Text("第一个页面"),),
      body: Center(
        child: FlatButton(
            onPressed: () 
              Navigator.push(context, MaterialPageRoute(builder: (context)=>SecondPage()));
              // print(111);
            ,
            child: Text("跳转")),
      ),
  ); //Scaffo


class SecondPage extends StatelessWidget 
  @override
  Widget build(BuildContext context) 
    return Scaffold(
      appBar: AppBar(title: Text("我是张三")),
    );
  





class MyHomePage extends StatefulWidget 
  MyHomePage(Key key, this.title) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();


class _MyHomePageState extends State<MyHomePage> 
  int _counter = 0;

  void _incrementCounter() 
    setState(() 
      // _counter++;
      Navigator.of(context).push(
          MaterialPageRoute(builder: (context) => NextHomePage(title: "LVDemo")));
    );
  

  @override
  Widget build(BuildContext context) 
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () 
    Navigator.of(context).push(
    MaterialPageRoute(builder: (context) => SecondPage()));
    ,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  



class NextHomePage extends StatefulWidget 
  NextHomePage(Key key, this.title) : super(key: key);
  final String title;
  _NextHomePageState createState() => _NextHomePageState();


class _NextHomePageState extends State<NextHomePage> 
  int _counter = 0;

  void _incrementCounter() 
    setState(() 
      _counter++;
    );
  

  @override
  Widget build(BuildContext context) 
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  

以上是关于FlutterDart乱写笔记(个人笔记)的主要内容,如果未能解决你的问题,请参考以下文章

FlutterDart乱写笔记(个人笔记)

FlutterDart乱写笔记(个人笔记)

Java基础学习笔记二十八 管家婆综合项目

MySql笔记

『个人の笔记』百度ife---task1

算法笔记_184:历届试题 约数倍数选卡片(Java)