flutter 五点一点四:MaterialApp Theme 给你一堆颜色看看

本文介绍了Flutter中MaterialDesign的ColorScheme,包括30种颜色的选择,如primaryColor、secondaryHeaderColor等,并展示了如何应用于appBar组件以及如何调整颜色模式(如dark和light)。
摘要由CSDN通过智能技术生成
  ColorScheme colorScheme, // 拥有30种颜色(这个数可能过几个版本会变化吧),可用于配置大多数组件的颜色。 A set of 30 colors based on the[Material spec] that can be used to configure the color properties of most components.
  Color canvasColor, //  MaterialType.canvas 的默认颜色  The default color of [MaterialType.canvas] [Material].
  Color cardColor, // Card的颜色 The color of [Material] when it is used as a [Card].
  Color dialogBackgroundColor, // Dialog 背景颜色  The background color of [Dialog] elements.
  Color disabledColor, // 禁用状态下部件的颜色,无论其当前状态如何。例如,一个禁用的复选框(可以选中或未选中)。
 Color? dividerColor,  // Divider和PopupMenuDivider的颜色,也用于ListTile之间、DataTable的行之间等。The color of [Divider]s and [PopupMenuDivider]s, also used between [ListTile]s, between rows in [DataTable]s, and so forth.
  Color? focusColor, //The focus color used indicate that a component has the input focus.
    Color? highlightColor,  // 选中在泼墨动画期间使用的突出显示颜色,或用于指示菜单中的项。 The highlight color used during ink splash animations or to indicate an item in a menu is selected.
    Color? hintColor, // 用于提示文本或占位符文本的颜色,例如在TextField中。 The color to use for hint text or placeholder text, e.g. in [TextField] fields.
    Color? hoverColor, // The hover color used to indicate when a pointer is hovering over a component.
    Color? indicatorColor, //  选项卡中选定的选项卡指示器的颜色。The color of the selected tab indicator in a tab bar.
    Color? primaryColor, / 应用程序主要部分的背景颜色(toolbars、tab bars 等) The background color for major parts of the app (toolbars, tab bars, etc)
    Color? primaryColorDark, // A darker version of the [primaryColor].
    Color? primaryColorLight, // A lighter version of the [primaryColor].
    Color? scaffoldBackgroundColor,  // Scaffold的默认颜色。典型Material应用程序或应用程序内页面的背景颜色。 
    Color? secondaryHeaderColor, // 选定行时PaginatedDataTable标题的颜色。 The color of the header of a [PaginatedDataTable] when there are selected rows.
    Color? shadowColor, // The color that the [Material] widget uses to draw elevation shadows.
    Color? splashColor, // The color of ink splashes.
    Color? unselectedWidgetColor, , // 用于处于非活动(但已启用)状态的小部件的颜色。例如,未选中的复选框。通常与accentColor形成对比。也看到disabledColor。 The color used for widgets in their inactive (but enabled) state. For example, an unchecked checkbox. See also [disabledColor].
 

ColorScheme colorScheme, // 拥有30种颜色,可用于配置大多数组件的颜色。

Ctrl+左键 点击 查看系统 snack_bar的使用
在这里插入图片描述

在这里插入图片描述

组件增加appbar

appBar: AppBar(title: Text("实例"),),

设置 colorSchemecolorScheme: ColorScheme.dark()

colorScheme: ColorScheme.dark()

结果
在这里插入图片描述
设置 colorSchemecolorScheme:ColorScheme.light()
在这里插入图片描述

亦可影响其他组件 自行测试

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值