static dynamic upImage(File imageFile) async {
  var stream = new http.ByteStream(DelegatingStream.typed(imageFile.openRead()));  var length = await imageFile.length();  final String token = await constants.getToken();  var uri = Uri.parse(apiupload);
  Map<String, String> headers = {
    'se-client': "api",    'se-api-key': "f50949f7a35a3b0d46b08abd20bead1d:hd2OQtdb5Z9SCx5OAF7iKi97G8PsBJbX9YjIbYVHufDo4nVCycsJHvmPoXuRfVgv",    'se-viewer-token': token
  };  Map<String, String> body = {
    'typeId': 'image',    'productId': '@SE/Media',  };  var multipartFile = new http.MultipartFile('file', stream, length,filename: basename( imageFile.path));
  var request = new http.MultipartRequest("POST", uri);  request.headers.addAll(headers);  request.fields.addAll(body);  request.files.add(multipartFile);
  var response = await request.send();  return  await response.stream.bytesToString();}
Thứ Tư, 27 tháng 11, 2019
Upload anh bang POST in flutter
Thứ Ba, 19 tháng 11, 2019
Nhìu định dạng chữ trong cùng 1 dòng in flutter
Text.rich(
  TextSpan(
    text: 'Hello ',
    style: TextStyle(fontSize: 50),
    children: <TextSpan>[
      TextSpan(
          text: 'world',
          style: TextStyle(
            decoration: TextDecoration.underline,
          )),
      // can add more TextSpans here...
    ],
  ),
)Container full man hinh in flutter
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Container as a layout')),
body: Container(
height: double.infinity,
width: double.infinity,
color: Colors.yellowAccent,
child: Text("Hi"),
),
);
}
return Scaffold(
appBar: AppBar(title: Text('Container as a layout')),
body: Container(
height: double.infinity,
width: double.infinity,
color: Colors.yellowAccent,
child: Text("Hi"),
),
);
}
Thứ Sáu, 15 tháng 11, 2019
Cập nhật ImageIcon trong flutter
ImageIcon(
     AssetImage("images/icon_more.png"),
     color: Color(0xFF3A5A98),
),Thứ Năm, 14 tháng 11, 2019
Load data before Widget build in flutter
 @override
  initState() {
    super.initState();
    loadData().then((result) {
      print(result);
      setState(() {
       asyncWidget = result;
      });
    });
  }
  loadData() async {
    var widget = new AsyncWidget();
    return widget.build();
  }
  @override
  Widget build(BuildContext context) {
    if(asyncWidget == null) {
      return new Scaffold(
        appBar: new AppBar(
          title: new Text("Loading..."),
        ),
      );
    } else {
      return new Scaffold(
        appBar: new AppBar(
          title: new Text(widget.title),
        ),
        body: new Center(
          child: this.asyncWidget,
        ),
      );
    }
  }
}Thứ Tư, 13 tháng 11, 2019
Bo viền flutter
Container(
            margin: EdgeInsets.all(32),
            decoration: BoxDecoration(border: Border.all(color: Colors.red)),
            child: ListView(
              shrinkWrap: false,
              children: <Widget>[
                ListTile(title: Text('Item 1')),
                ListTile(title: Text('Item 2')),
                ListTile(title: Text('Item 3')),
              ],
            ),
Đăng ký:
Nhận xét (Atom)
How to reload app in flutter
Phoenix . rebirth (context);
- 
Wrap( children: [ MyWidget(), MyWidget(), MyWidget(), MyWidget(), MyWidget(), ], ),
- 
try { final request = await client . get (...); final response = await request . close () . timeout ( const Duration ( se...
- 
DateTime. parse (json[ 'modified_gmt' ]+ 'Z' as String)
