• 浅尝flutter中的http请求


    import 'package:flutter/material.dart';
    
    class News extends StatefulWidget {
      final String title,imglink; 
      News(this.title,this.imglink);
      @override
      createState() => new NewsState();  
    }
    class NewsState extends State<News> {
      @override
      Widget  build(BuildContext context){   
        return new Center(
         child:new Container(
           height: 120.0,
           padding:new EdgeInsets.only(left:20.0,right:20.0),
           decoration: new BoxDecoration(
             border:new Border(
               bottom: new BorderSide( 1.0,color:const Color(0xff999999))
             )
           ),
           child: new Row(
             mainAxisAlignment: MainAxisAlignment.spaceEvenly,
             children: <Widget>[
               new Expanded(
                 flex:2,
                 child: new Column(
                   crossAxisAlignment: CrossAxisAlignment.start,
                   mainAxisAlignment:MainAxisAlignment.spaceBetween ,
                   children: <Widget>[
                     new Container(
                       padding:new EdgeInsets.only(top:15.0),
                       decoration: new BoxDecoration(
                       ),
                       child:new Text(
                         widget.title,
                         style: new TextStyle(
                           fontSize: 18.0
                         ),
                       ),
                     ),
                      new Container(
                       padding:const EdgeInsets.only(right:13.0,bottom:15.0),
                       decoration: new BoxDecoration(
                       ),
                       child:new Row(
                         mainAxisAlignment: MainAxisAlignment.spaceBetween,
                         children: <Widget>[
                           new Text(
                             '本地新闻',
                           ),
                            new Text(
                             '2018-03-11',
                           ),
                         ],
                       )
                     
                     ),
                   ],
                 ),
               ),
               new Expanded(
                 flex:1,
                 child: new Image.network(
                   widget.imglink,
                   scale: 1.0,
                   fit: BoxFit.cover,
                 ),
               ),
             ],
           ),
         ),
        );
      }
    }
    

      

  • 相关阅读:
    Zookeeper安装-单机版
    Centos 7 安装 Redis 5
    java利用dom4j将xml字符串转换为json
    计算机科学导论笔记-计算机组成
    计算机科学导论笔记-数据运算
    计算机科学导论笔记-数据存储
    计算机科学导论笔记-数字系统
    计算机科学导论笔记
    springmvc03
    springmvc02
  • 原文地址:https://www.cnblogs.com/xiongwei/p/10431813.html
Copyright © 2020-2023  润新知