zoukankan      html  css  js  c++  java
  • flutter文本简单实现

     1 import 'package:flutter/material.dart';
     2 import 'package:flustars/flustars.dart';
     3 import 'package:fl_chart/fl_chart.dart';
     4 
     5 void main()=>MyApp();//所有的写在一起就客园直接用=>来替代
     6 
     7 
     8 class MyApp extends StatelessWidget{
     9   @override
    10   Widget build(BuildContext context) {
    11     // TODO: implement build
    12     return MaterialApp(
    13       home: Scaffold(
    14         appBar: AppBar(
    15           title: Row(
    16             children: <Widget>[
    17               GestureDetector(
    18                 onTap: (){
    19                   print("我是一个人1");
    20                 },
    21                 child: Icon(Icons.arrow_back_ios),
    22               ),
    23               Container(//通过容器来添加标题
    24                  250,//高度来控制
    25                 child: Center(
    26                     child: Text('统计报表',style: TextStyle(
    27                       // color: Colors.black,
    28                     ),
    29                     )
    30                 ),
    31               ),
    32             ],
    33           ),
    34         ),
    35         body: click(),
    36       ),
    37     );
    38   }
    39 }
    40 
    41 class click extends StatelessWidget{
    42   @override
    43   Widget build(BuildContext context) {
    44     // TODO: implement build
    45     return Text.rich(
    46       TextSpan(
    47         children: [
    48           TextSpan(text: "静夜思",style: TextStyle(
    49             fontSize: 30,
    50           ),
    51           ),
    52           TextSpan(text: "[唐] 李白",style: TextStyle(
    53             fontSize: 10,
    54             color: Colors.orange,
    55           ),
    56           ),
    57           TextSpan(text: "
    床前明月光,疑是地上霜。
    举头望明月,低头思故乡。",style: TextStyle(
    58             fontSize: 20,
    59           ),
    60           ),
    61         ]
    62       ),
    63       textAlign: TextAlign.center,//盒子内部居中
    64     );
    65   }
    66 }
    67 class text extends StatelessWidget{
    68   @override
    69   Widget build(BuildContext context) {
    70     // TODO: implement build
    71     return Text('静夜思
    [唐] 李白
    床前明月光,疑是地上霜。
    举头望明月,低头思故乡。',
    72         style:TextStyle(
    73           fontSize: 20,
    74         ) ,
    75     );
    76   }
    77 }

    flutter简单文本实现  效果如下

  • 相关阅读:
    修改服务器时间以后 cookie无法保存
    SqlServer 2017 下载地址及密钥
    ASP.NET CORE 开发路线
    在ASP.NET CORE下生成PDF文档
    Redis 学习笔记2
    Redis 学习笔记1
    notepad++文件对比
    Notepad++主题设置与推荐
    Vivado HLx 2019.1下载、安装与激活
    Tensorflow机器学习入门——cifar10数据集的读取、展示与保存
  • 原文地址:https://www.cnblogs.com/liugangjiayou/p/12002259.html
Copyright © 2011-2022 走看看