加入收藏 | 设为首页 | 会员中心 | 我要投稿 温州站长网 (https://www.0577zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > 建站资源 > 优化 > 正文

为前端工程师准备的Flutter入门指南

发布时间:2019-01-27 08:57:41 所属栏目:优化 来源:佚名
导读:副标题#e# 如果你恰好是一名前端工程师,且对 Flutter 抱有兴趣,那么真的是太好了,这篇文章完全就是为你准备的。写惯了 HTML、CSS 与 JavaScript,要不要来是试试 Dart?如果你不熟悉 Flutter 但仍对其感兴趣,可以先看看「让我们在2019年重新认识 Flutter

Dart

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red box 
  4.       child: Text( 
  5.         "Lorem ipsum", 
  6.         style: bold24Roboto, 
  7.       ), 
  8.       decoration: BoxDecoration( 
  9.         gradient: LinearGradient( 
  10.           begin: const Alignment(0.0, -1.0), 
  11.           end: const Alignment(0.0, 0.6), 
  12.           colors: <Color>[ 
  13.             const Color(0xffef5350), 
  14.             const Color(0x00ef5350) 
  15.           ], 
  16.         ), 
  17.       ),  
  18.       padding: EdgeInsets.all(16.0), 
  19.     ), 
  20.   ), 
  21.   width: 320.0, 
  22.   height: 240.0, 
  23.   color: Colors.grey[300], 
  24. ); 

三、图形/形状

以下示例将展示如何新建和自定义图形。

3.1 圆角

在矩形上实现圆角,可以用 BoxDecoration 对象的 borderRadius 属性。新建一个 BorderRadius 对象来指定每个圆角的半径大小。

Web

  1. <div class="greybox"> 
  2.   <div class="redbox"> 
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* gray 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   border-radius: 8px;  

Dart

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red circle 
  4.       child: Text( 
  5.         "Lorem ipsum", 
  6.         style: bold24Roboto, 
  7.       ), 
  8.       decoration: BoxDecoration( 
  9.         color: Colors.red[400], 
  10.         borderRadius: BorderRadius.all( 
  11.           const Radius.circular(8.0), 
  12.         ),  
  13.       ), 
  14.       padding: EdgeInsets.all(16.0), 
  15.     ), 
  16.   ), 
  17.   width: 320.0, 
  18.   height: 240.0, 
  19.   color: Colors.grey[300], 
  20. ); 

3.2 阴影

(编辑:温州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读