好久没有发帖,Futter(颤振)入门

legs+之专栏 legs+之专栏 1143 人阅读 | 11 人回复 | 2023-06-28

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. import 'package:flutter/material.dart';

  2. void main(){
  3.   runApp(new Center(
  4.     child:new Text(
  5.       '你好Flutter',
  6.       textDirection: TextDirection.ltr,
  7.     )
  8.   ));
  9. }
复制代码


回答|共 11 个

legs+ 发表于 2023-6-28 15:52:58| 字数 341 | 显示全部楼层

  1. import 'package:flutter/material.dart';

  2. void main(){
  3.   runApp(MyApp());
  4. }

  5. //自定义组件
  6. class MyApp extends StatelessWidget{
  7.   @override
  8.   Widget build(BuildContext context) {
  9.     // TODO: implement build
  10.     return Center(
  11.       child:Text(
  12.         '你好Flutter 111',
  13.         textDirection: TextDirection.ltr,

  14.         style: TextStyle(
  15.             fontSize: 40.0,
  16.             color: Colors.yellow,
  17.             // color: Color.fromRGBO(244, 233, 121, 0.5),
  18.         ),
  19.       )
  20.     );
  21.   }

  22. }
复制代码


legs+ 发表于 2023-6-28 15:53:43| 字数 588 | 显示全部楼层

  1. import 'package:flutter/material.dart';

  2. void main(){
  3.   runApp(MyApp());
  4. }

  5. //自定义组件
  6. class MyApp extends StatelessWidget{
  7.   @override
  8.   Widget build(BuildContext context) {
  9.     // TODO: implement build
  10.     return MaterialApp(
  11.       home:Scaffold(
  12.         appBar:AppBar(
  13.             title:Text('Flutter Demo')
  14.         ),
  15.         body:HomeContent(),
  16.       ),
  17.       theme: ThemeData(
  18.         primarySwatch: Colors.yellow
  19.       ),
  20.     );
  21.   }

  22. }

  23. //
  24. class HomeContent extends StatelessWidget{

  25.   @override
  26.   Widget build(BuildContext context) {
  27.     // TODO: implement build
  28.     return Center(
  29.       child:Text(
  30.         '你好Flutter 111',
  31.         textDirection: TextDirection.ltr,

  32.         style: TextStyle(
  33.             fontSize: 40.0,
  34.             color: Colors.yellow,
  35.             // color: Color.fromRGBO(244, 233, 121, 0.5),
  36.         ),
  37.       )
  38.     );
  39.   }
  40. }
复制代码


legs+ 发表于 2023-6-28 15:54:31| 字数 18 | 显示全部楼层

看整个代码结构,是不是有点像HTML

legs+ 发表于 2023-6-28 16:01:11| 字数 0 | 显示全部楼层

360截图20230628160044680.jpg

legs+ 发表于 2023-6-28 20:34:35| 字数 1,297 | 显示全部楼层

  1. import 'package:flutter/material.dart';

  2. void main(){
  3.   runApp(MyApp());
  4. }

  5. class MyApp extends StatelessWidget{
  6.   @override
  7.   Widget build(BuildContext context) {
  8.     // TODO: implement build
  9.     return MaterialApp(
  10.         home:Scaffold(
  11.             appBar: AppBar(
  12.                 title:Text("flutter demo")
  13.             ),
  14.             body:HomeContent()
  15.         )
  16.     );
  17.   }
  18. }

  19. class HomeContent extends StatelessWidget{
  20.   @override
  21.   Widget build(BuildContext context) {
  22.     // TODO: implement build
  23.     return Center(
  24.       child: Container(
  25.         child: Text(
  26.             '各位同学大家好我是主讲老师legs+,各位同学大家好我是主讲老师legs+',
  27.             textAlign:TextAlign.left,
  28.             overflow:TextOverflow.ellipsis ,
  29.             // overflow:TextOverflow.fade ,
  30.             maxLines: 2,
  31.             textScaleFactor: 1.8,
  32.             style:TextStyle(
  33.                 fontSize: 16.0,
  34.                 color:Colors.red,
  35.                 // color:Color.fromARGB(a, r, g, b)
  36.                 fontWeight: FontWeight.w800,
  37.                 fontStyle: FontStyle.italic,
  38.                 decoration:TextDecoration.lineThrough,
  39.                 decorationColor:Colors.white,
  40.                 decorationStyle: TextDecorationStyle.dashed,
  41.                 letterSpacing: 5.0

  42.             )

  43.         ),
  44.         height: 300.0,
  45.         width: 300.0,
  46.         decoration: BoxDecoration(
  47.             color: Colors.yellow,
  48.             border: Border.all(
  49.                 color: Colors.blue,
  50.                 width: 2.0
  51.             ),
  52.             borderRadius: BorderRadius.all(
  53.               //  Radius.circular(150),    //圆形
  54.               Radius.circular(10),
  55.             )
  56.         ),
  57.         // padding:EdgeInsets.all(20),

  58.         // padding:EdgeInsets.fromLTRB(10, 30, 5, 0)

  59.         margin: EdgeInsets.fromLTRB(10, 30, 5, 0),

  60.         // transform:Matrix4.translationValues(100,0,0)

  61.         // transform:Matrix4.rotationZ(0.3)

  62.         // transform:Matrix4.diagonal3Values(1.2, 1, 1)

  63.         alignment: Alignment.bottomLeft,



  64.       ),
  65.     );
  66.   }

  67. }
复制代码



360截图20230628203417107.jpg


legs+ 发表于 2023-6-30 05:09:22| 字数 34 | 显示全部楼层

前端三剑客:flutter、react和vue
flutter有点特别

legs+ 发表于 2023-7-1 17:37:41| 字数 1,398 | 显示全部楼层

  1. import 'package:flutter/material.dart';

  2. void main() => runApp(MyApp());

  3. class MyApp extends StatelessWidget {
  4.   @override
  5.   Widget build(BuildContext context) {
  6.     // TODO: implement build
  7.     return MaterialApp(
  8.         home: Scaffold(
  9.           appBar: AppBar(title: Text('FlutterDemo')),
  10.           body: HomeContent(),
  11.      ));
  12.   }
  13. }
  14. class HomeContent extends StatelessWidget {
  15.   @override
  16.   Widget build(BuildContext context) {
  17.     // TODO: implement build
  18.     return ListView(
  19.       padding: EdgeInsets.all(10),
  20.       children: <Widget>[

  21.           ListTile(
  22.               title: Text(
  23.                 '华北黄淮高温持续 南方强降雨今起强势登场',
  24.                 style: TextStyle(
  25.                   fontSize: 24
  26.                 ),
  27.               ),
  28.               subtitle: Text("中国天气网讯 21日开始,北方今年首轮大范围高温拉开序幕,昨天是高温发展的最鼎盛阶段"),
  29.           ),
  30.            ListTile(
  31.               title: Text('中国13家运营波音737MAX航空公司均已提出索赔场',
  32.                 style: TextStyle(
  33.                   fontSize: 24
  34.                 ),),
  35.               subtitle: Text("中国天气网讯 21日开始,北方今年首轮大范围高温拉开序幕,昨天是高温发展的最鼎盛阶段"),
  36.           ),
  37.            ListTile(
  38.               title: Text('华中国13家运营波音737MAX航空公司均已提出索赔登场'),
  39.               subtitle: Text("中国天气网讯 21日开始,北方今年首轮大范围高温拉开序幕,昨天是高温发展的最鼎盛阶段"),
  40.           ),
  41.            ListTile(
  42.               title: Text('华北黄淮高温雨今起强势登场'),
  43.               subtitle: Text("中国天气网讯 21日开始,北方今年首轮大范围高温拉开序幕,昨天是高温发展的最鼎盛阶段"),
  44.           ),
  45.            ListTile(
  46.               title: Text('华北黄淮高温持续 势登场'),
  47.               subtitle: Text("中国天气网讯 21日开始,北方今年首轮大范围高温拉开序幕,昨天是高温发展的最鼎盛阶段"),
  48.           ),
  49.            ListTile(
  50.               title: Text('华北黄淮高温起强势登场'),
  51.               subtitle: Text("中国天气网讯 21日开始,北方今年首轮大范围高温拉开序幕,昨天是高温发展的最鼎盛阶段"),
  52.           ),
  53.            ListTile(
  54.               title: Text('华北黄淮高雨今起强势登场'),
  55.               subtitle: Text("中国天气网讯 21日开始,北方今年首轮大范围高温拉开序幕,昨天是高温发展的最鼎盛阶段"),
  56.           ),
  57.            ListTile(
  58.               title: Text('华北黄淮高温持续 南方强降雨今起强势登场'),
  59.               subtitle: Text("中国天气网讯 21日开始,北方今年首轮大范围高温拉开序幕,昨天是高温发展的最鼎盛阶段"),
  60.           )

  61.       ],
  62.     );
  63.   }
  64. }
复制代码


legs+ 发表于 2023-7-1 17:38:03| 字数 0 | 显示全部楼层

360截图20230701173727325.jpg

legs+ 发表于 2023-7-2 08:39:12| 字数 16 | 显示全部楼层

闲来无事,写了一个简单的DEMO



360截图20230702083735877.jpg

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

热门推荐