美文网首页
文本与按钮

文本与按钮

作者: 乐狐 | 来源:发表于2022-07-02 09:08 被阅读0次
文本与按钮
//导入Material UI 组件库
import 'package:flutter/material.dart';

//程序入口
void main() {
  runApp(const MaterialApp(home: TxtBtn()));
}

//文本与按钮
class TxtBtn extends StatelessWidget {
  const TxtBtn({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("TxtBtn"),
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          const Text(
            "常规文本",
            maxLines: 1,
            style: TextStyle(color: Colors.deepOrange, fontFamily: "Schyler"),
          ),
          const Text.rich(TextSpan(children: [
            TextSpan(
              text: "AA",
              style: TextStyle(color: Colors.cyan),
            ),
            TextSpan(
              text: "BB",
              style: TextStyle(color: Colors.brown),
            ),
          ])),
          //间隔填充
          const SizedBox(
            height: 10,
          ),
          //漂浮按钮阴影背景
          ElevatedButton(
            child: const Text("ElevatedButton"),
            onPressed: () {},
          ),
          //文本按钮透明
          TextButton(
            child: const Text("TextButton"),
            onPressed: () {},
          ),
          //边框按钮
          OutlinedButton(
            child: const Text("OutlinedButton"),
            onPressed: () {},
          ),
          FloatingActionButton(
              backgroundColor: Colors.deepOrange,
              child: const Icon(Icons.add),
              onPressed: () {}),
          IconButton(
            icon: const Icon(Icons.thumb_up),
            onPressed: () {},
          ),
          //图标按钮
          ElevatedButton.icon(
            icon: const Icon(Icons.send),
            label: const Text("ElevatedButton"),
            onPressed: () {},
          ),
          OutlinedButton.icon(
            icon: const Icon(Icons.add),
            label: const Text("OutlinedButton"),
            onPressed: () {},
          ),
          TextButton.icon(
            icon: const Icon(Icons.info),
            label: const Text("TextButton"),
            onPressed: () {},
          ),
        ],
      ),
    );
  }
}

相关文章

  • Widget

    父类像子类传递数据 checkbox 计步器 Text文本 富文本 ` 图文混合 按钮 图标按钮: 按钮默认适配4...

  • EditText设置 drawableRight 、left、t

    记录 代码动态设置 有文本的时候显示删除按钮 没有文本的时候 隐藏删除按钮 删除按钮的监听

  • 【Flutter】按钮与文本(三)

    一、按钮 此控件比较简单,按钮的功能可划分为UI样式与事件回调 Material widget库中提供了多种按钮W...

  • RACObserve 和 rac_textSignal 的搭配使

    项目中有个小需求,文本框与按钮绑定.当文本框内容符合规则的时候,按钮才会可用.把判定条件修改一下,代码如下: 但是...

  • View 1

    View与ViewGroup View是按钮(button),文本框(text field)等部件(widget)...

  • 第四天

    1、Form:包裹标签,action:# Input:文本框,单选按钮,多选按钮。提交的按钮,按钮,重置的按钮。 ...

  • 表单

    文本框: 密码框: 单选框: 复选框: 作为按钮: 不可点击的按钮: 可提交按钮: 多行文本域: (cols="3...

  • Bootstrap 手册 03 - 表单篇

    HTML 表单中常见的元素主要包括:文本输入框、下拉选择框、单选按钮、复选按钮、文本域和按钮等。 0. 表单控件 ...

  • Flutter之常用组件

    基础组件 文本组件 Text 用于显示简单样式文本,包含一些控制样式属性 按钮与手势组件 IconButton I...

  • 关于mui底部选项卡按钮和文本的两种方式

    1.文本 2 .按钮

网友评论

      本文标题:文本与按钮

      本文链接:https://www.haomeiwen.com/subject/wmbcbrtx.html