Flutter 初识:Chip控件

news2024/9/21 4:39:07

Flutter Chip控件小结

    • Chip
      • 属性解析
      • 示例
    • InputChip
      • 属性解析
      • 示例
    • ChoiceChip
      • 属性解析
      • 示例
    • FilterChip
      • 属性解析
      • 示例
    • ActionChip
      • 属性解析
      • 示例

在 Flutter 中,Chip 是一种用于显示简洁信息的组件。它通常用来展示标签、属性、短的文本片段等,并可以包含可选的删除按钮或其他图标。本文将详细介绍 Chip 控件及其各种类型和使用场景。

Chip

Chip 是 Flutter 中用于显示紧凑信息的小部件,通常包含一个标签和可选的图标或删除按钮,并且可以用作交互式元素。

Chip 控件的主要特点
紧凑:Chip 控件设计紧凑,适合展示短的、简洁的信息。
可交互:Chip 控件可以包含删除按钮或其他图标,支持交互操作。
可定制:Chip 控件可以自定义颜色、形状、图标等。

属性解析

const Chip({
    super.key,
    this.avatar,
    required this.label,
    this.labelStyle,
    this.labelPadding,
    this.deleteIcon,
    this.onDeleted,
    this.deleteIconColor,
    this.deleteButtonTooltipMessage,
    this.side,
    this.shape,
    this.clipBehavior = Clip.none,
    this.focusNode,
    this.autofocus = false,
    this.color,
    this.backgroundColor,
    this.padding,
    this.visualDensity,
    this.materialTapTargetSize,
    this.elevation,
    this.shadowColor,
    this.surfaceTintColor,
    this.iconTheme,
  })
  • avatar (Widget?): 要显示在标签前的小部件,通常是一个圆形头像。
  • label (Widget): 必需参数,表示 Chip 的主要内容,通常是文本。
  • labelStyle (TextStyle?): 标签的文本样式。
  • labelPadding (EdgeInsetsGeometry?): 标签的内边距。
  • deleteIcon (Widget?): 删除图标的小部件。
  • onDeleted (VoidCallback?): 当删除图标被点击时调用的回调函数。
  • deleteIconColor (Color?): 删除图标的颜色。
  • deleteButtonTooltipMessage (String?): 删除按钮的工具提示信息。
  • side (BorderSide?): 边框的样式。
  • shape (OutlinedBorder?): Chip 的形状。
  • clipBehavior (Clip): 定义 Chip 的剪裁行为,默认为 Clip.none。
  • focusNode (FocusNode?): 处理键盘焦点的节点。
  • autofocus (bool): 是否自动获得焦点。
  • color (Color?): Chip 的颜色。这已弃用,请使用 backgroundColor。
  • backgroundColor (Color?): Chip 的背景颜色。
  • padding (EdgeInsetsGeometry?): Chip 的内边距。
  • visualDensity (VisualDensity?): 定义 Chip 的视觉密度。
  • materialTapTargetSize (MaterialTapTargetSize?): 控制触摸目标的大小。
  • elevation (double?): Chip 的阴影高度。
  • shadowColor (Color?): 阴影的颜色。
  • surfaceTintColor (Color?): 表面颜色的色调。
  • iconTheme (IconThemeData?): 图标主题,用于控制图标的外观。

示例

class WidgetPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Chip 示例')),
        body: Center(
          child: Wrap(
            spacing: 8.0,
            children: [
              Chip(
                avatar: CircleAvatar(
                  backgroundColor: Colors.blue.shade900,
                  child: Text('A'),
                ),
                label: Text('Avatar Chip'),
                onDeleted: () {
                  print('Avatar Chip deleted');
                },
                deleteIcon: Icon(Icons.cancel),
                deleteIconColor: Colors.red,
                deleteButtonTooltipMessage: 'Remove',
                backgroundColor: Colors.blue.shade100,
                labelStyle: TextStyle(
                  fontWeight: FontWeight.bold,
                  color: Colors.blue.shade900,
                ),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(8.0),
                  side: BorderSide(color: Colors.blue.shade900),
                ),
                elevation: 4.0,
                shadowColor: Colors.blueAccent,
                padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
                materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
              ),
              Chip(
                label: Text('Simple Chip'),
              ),
              Chip(
                label: Text('Disabled Chip'),
                onDeleted: null, // 禁用删除功能
              ),
            ],
          ),
        ),
      ),
    );
  }
}

在这里插入图片描述

 
 

InputChip

InputChip 是 Flutter 中的一个小部件,用于显示可交互的紧凑信息。与普通的 Chip 不同,InputChip 具有更多的交互行为,例如选择和删除操作

属性解析

const InputChip({
    super.key,
    this.avatar,
    required this.label,
    this.labelStyle,
    this.labelPadding,
    this.selected = false,
    this.isEnabled = true,
    this.onSelected,
    this.deleteIcon,
    this.onDeleted,
    this.deleteIconColor,
    this.deleteButtonTooltipMessage,
    this.onPressed,
    this.pressElevation,
    this.disabledColor,
    this.selectedColor,
    this.tooltip,
    this.side,
    this.shape,
    this.clipBehavior = Clip.none,
    this.focusNode,
    this.autofocus = false,
    this.color,
    this.backgroundColor,
    this.padding,
    this.visualDensity,
    this.materialTapTargetSize,
    this.elevation,
    this.shadowColor,
    this.surfaceTintColor,
    this.iconTheme,
    this.selectedShadowColor,
    this.showCheckmark,
    this.checkmarkColor,
    this.avatarBorder = const CircleBorder(),
  })
  • avatar (Widget?): 要显示在标签前的小部件,通常是一个圆形头像。
  • label (Widget): 必需参数,表示 Chip 的主要内容,通常是文本。
  • labelStyle (TextStyle?): 标签的文本样式。
  • labelPadding (EdgeInsetsGeometry?): 标签的内边距。
  • selected (bool): 是否选中此 Chip,默认值为 false。
  • isEnabled (bool): 是否启用此 Chip,默认值为 true。
  • onSelected (ValueChanged?):当 Chip 被选中或取消选中时调用的回调函数。
  • deleteIcon (Widget?): 删除图标的小部件。
  • onDeleted (VoidCallback?): 当删除图标被点击时调用的回调函数。
  • deleteIconColor (Color?): 删除图标的颜色。
  • deleteButtonTooltipMessage (String?): 删除按钮的工具提示信息。
  • onPressed (VoidCallback?): 当 Chip 被按下时调用的回调函数。
  • pressElevation (double?): 按下时的阴影高度。
  • disabledColor (Color?): Chip 禁用时的背景颜色。
  • selectedColor (Color?): Chip 选中时的背景颜色。
  • tooltip (String?): 此 Chip 的工具提示信息。
  • side (BorderSide?): 边框的样式。
  • shape (OutlinedBorder?): InputChip 的形状。
  • clipBehavior (Clip): 定义 InputChip 的剪裁行为,默认为 Clip.none。
  • focusNode (FocusNode?): 处理键盘焦点的节点。
  • autofocus (bool): 是否自动获得焦点。
  • color (Color?): InputChip 的颜色。这已弃用,请使用 backgroundColor。
  • backgroundColor (Color?): InputChip 的背景颜色。
  • padding (EdgeInsetsGeometry?): InputChip 的内边距。
  • visualDensity (VisualDensity?): 定义 InputChip 的视觉密度。
  • materialTapTargetSize (MaterialTapTargetSize?): 控制触摸目标的大小。
  • elevation (double?): InputChip 的阴影高度。
  • shadowColor (Color?): 阴影的颜色。
  • surfaceTintColor (Color?): 表面颜色的色调。
  • iconTheme (IconThemeData?): 图标主题,用于控制图标的外观。
  • selectedShadowColor (Color?): Chip 选中时的阴影颜色。
  • showCheckmark (bool?): 是否显示复选标记。
  • checkmarkColor (Color?): 复选标记的颜色。
  • avatarBorder (ShapeBorder): 头像的边框,默认为 CircleBorder()。

示例

class WidgetPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('InputChip 示例')),
        body: Center(
          child: Wrap(
            spacing: 8.0,
            children: [
              InputChip(
                avatar: CircleAvatar(
                  backgroundColor: Colors.blue.shade900,
                  child: Text('A'),
                ),
                label: Text('Selectable Chip'),
                selected: true,
                onSelected: (bool selected) {
                  print(
                      'Selectable Chip ${selected ? "selected" : "deselected"}');
                },
                onDeleted: () {
                  print('Selectable Chip deleted');
                },
                deleteIcon: Icon(Icons.cancel),
                deleteIconColor: Colors.red,
                deleteButtonTooltipMessage: 'Remove',
                selectedColor: Colors.blue.shade100,
                labelStyle: TextStyle(
                  fontWeight: FontWeight.bold,
                  color: Colors.blue.shade900,
                ),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(8.0),
                  side: BorderSide(color: Colors.blue.shade900),
                ),
                pressElevation: 4.0,
                shadowColor: Colors.blueAccent,
                padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
                materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
              ),
              InputChip(
                label: Text('Simple Chip'),
                onPressed: () {
                  print('Simple Chip pressed');
                },
              ),
              InputChip(
                label: Text('Disabled Chip'),
                isEnabled: false,
              ),
            ],
          ),
        ),
      ),
    );
  }
}

在这里插入图片描述

 
 

ChoiceChip

ChoiceChip 是 Flutter 中的一种 Chip,用于从一组选项中进行单选。ChoiceChip 支持各种自定义外观和交互行为

属性解析

const ChoiceChip({
    super.key,
    this.avatar,
    required this.label,
    this.labelStyle,
    this.labelPadding,
    this.onSelected,
    this.pressElevation,
    required this.selected,
    this.selectedColor,
    this.disabledColor,
    this.tooltip,
    this.side,
    this.shape,
    this.clipBehavior = Clip.none,
    this.focusNode,
    this.autofocus = false,
    this.color,
    this.backgroundColor,
    this.padding,
    this.visualDensity,
    this.materialTapTargetSize,
    this.elevation,
    this.shadowColor,
    this.surfaceTintColor,
    this.iconTheme,
    this.selectedShadowColor,
    this.showCheckmark,
    this.checkmarkColor,
    this.avatarBorder = const CircleBorder(),
  })
  • avatar (Widget?): 要显示在标签前的小部件,通常是一个圆形头像。
  • label (Widget): 必需参数,表示 Chip 的主要内容,通常是文本。
  • labelStyle (TextStyle?): 标签的文本样式。
  • labelPadding (EdgeInsetsGeometry?): 标签的内边距。
  • onSelected (ValueChanged?): 当 Chip 被选中或取消选中时调用的回调函数。
  • pressElevation (double?): 按下时的阴影高度。
  • selected (bool): 必需参数,当前是否选中了这个 Chip。
  • selectedColor (Color?): 选中时的背景颜色。
  • disabledColor (Color?): 禁用状态下的背景颜色。
  • tooltip (String?): 此 Chip 的工具提示信息。
  • side (BorderSide?): 边框的样式。
  • shape (OutlinedBorder?): ChoiceChip 的形状。
  • clipBehavior (Clip): 定义 ChoiceChip 的剪裁行为,默认为 Clip.none。
  • focusNode (FocusNode?): 处理键盘焦点的节点。
  • autofocus (bool): 是否自动获得焦点。
  • color (Color?): ChoiceChip 的颜色。这已弃用,请使用 backgroundColor。
  • backgroundColor (Color?): ChoiceChip 的背景颜色。
  • padding (EdgeInsetsGeometry?): ChoiceChip 的内边距。
  • visualDensity (VisualDensity?): 定义 ChoiceChip 的视觉密度。
  • materialTapTargetSize (MaterialTapTargetSize?): 控制触摸目标的大小。
  • elevation (double?): ChoiceChip 的阴影高度。
  • shadowColor (Color?): 阴影的颜色。
  • surfaceTintColor (Color?): 表面颜色的色调。
  • iconTheme (IconThemeData?): 图标主题,用于控制图标的外观。
  • selectedShadowColor (Color?): 选中时的阴影颜色。
  • showCheckmark (bool?): 是否显示复选标记。
  • checkmarkColor (Color?): 复选标记的颜色。
  • avatarBorder (ShapeBorder): 头像的边框,默认为 CircleBorder()。

示例

class WidgetPage extends StatefulWidget {
  @override
  _WidgetPageState createState() => _WidgetPageState();
}

class _WidgetPageState extends State<WidgetPage> {
  int selectedIndex = 0;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('ChoiceChip 示例')),
        body: Center(
          child: Wrap(
            spacing: 8.0,
            children: List<Widget>.generate(3, (int index) {
              return ChoiceChip(
                avatar: CircleAvatar(
                  backgroundColor: Colors.blue.shade900,
                  child: Text('C$index'),
                ),
                label: Text('Choice $index'),
                selected: selectedIndex == index,
                onSelected: (bool selected) {
                  setState(() {
                    selectedIndex = selected ? index : selectedIndex;
                  });
                },
                selectedColor: Colors.blue.shade100,
                labelStyle: TextStyle(
                  fontWeight: FontWeight.bold,
                  color: selectedIndex == index
                      ? Colors.blue.shade900
                      : Colors.grey,
                ),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(8.0),
                  side: BorderSide(
                    color: selectedIndex == index
                        ? Colors.blue.shade900
                        : Colors.grey,
                  ),
                ),
                pressElevation: 4.0,
                shadowColor: Colors.blueAccent,
                padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
                materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                showCheckmark: false,
              );
            }),
          ),
        ),
      ),
    );
  }
}

在这里插入图片描述

 
 

FilterChip

FilterChip 是 Flutter 中的一种 Chip,用于表示一个可以选择或取消选择的选项,通常用于筛选内容。

属性解析

const FilterChip({
    super.key,
    this.avatar,
    required this.label,
    this.labelStyle,
    this.labelPadding,
    this.selected = false,
    required this.onSelected,
    this.deleteIcon,
    this.onDeleted,
    this.deleteIconColor,
    this.deleteButtonTooltipMessage,
    this.pressElevation,
    this.disabledColor,
    this.selectedColor,
    this.tooltip,
    this.side,
    this.shape,
    this.clipBehavior = Clip.none,
    this.focusNode,
    this.autofocus = false,
    this.color,
    this.backgroundColor,
    this.padding,
    this.visualDensity,
    this.materialTapTargetSize,
    this.elevation,
    this.shadowColor,
    this.surfaceTintColor,
    this.iconTheme,
    this.selectedShadowColor,
    this.showCheckmark,
    this.checkmarkColor,
    this.avatarBorder = const CircleBorder(),
  })
  • avatar (Widget?): 要显示在标签前的小部件,通常是一个圆形头像。
  • label (Widget): 必需参数,表示 Chip 的主要内容,通常是文本。
  • labelStyle (TextStyle?): 标签的文本样式。
  • labelPadding (EdgeInsetsGeometry?): 标签的内边距。
  • selected (bool): 是否选中此 Chip,默认值为 false。
  • onSelected (ValueChanged): 当 Chip 被选中或取消选中时调用的回调函数。
  • deleteIcon (Widget?): 删除图标的小部件。
  • onDeleted (VoidCallback?): 当删除图标被点击时调用的回调函数。
  • deleteIconColor (Color?): 删除图标的颜色。
  • deleteButtonTooltipMessage (String?): 删除按钮的工具提示信息。
  • pressElevation (double?): 按下时的阴影高度。
  • disabledColor (Color?): Chip 禁用时的背景颜色。
  • selectedColor (Color?): Chip 选中时的背景颜色。
  • tooltip (String?): 此 Chip 的工具提示信息。
  • side (BorderSide?): 边框的样式。
  • shape (OutlinedBorder?): FilterChip 的形状。
  • clipBehavior (Clip): 定义 FilterChip 的剪裁行为,默认为 Clip.none。
  • focusNode (FocusNode?): 处理键盘焦点的节点。
  • autofocus (bool): 是否自动获得焦点。
  • color (Color?): FilterChip 的颜色。这已弃用,请使用 backgroundColor。
  • backgroundColor (Color?): FilterChip 的背景颜色。
  • padding (EdgeInsetsGeometry?): FilterChip 的内边距。
  • visualDensity (VisualDensity?): 定义 FilterChip 的视觉密度。
  • materialTapTargetSize (MaterialTapTargetSize?): 控制触摸目标的大小。
  • elevation (double?): FilterChip 的阴影高度。
  • shadowColor (Color?): 阴影的颜色。
  • surfaceTintColor (Color?): 表面颜色的色调。
  • iconTheme (IconThemeData?): 图标主题,用于控制图标的外观。
  • selectedShadowColor (Color?): Chip 选中时的阴影颜色。
  • showCheckmark (bool?): 是否显示复选标记。
  • checkmarkColor (Color?): 复选标记的颜色。
  • avatarBorder (ShapeBorder): 头像的边框,默认为 CircleBorder()。

示例

class WidgetPage extends StatefulWidget {
  @override
  _WidgetPageState createState() => _WidgetPageState();
}

class _WidgetPageState extends State<WidgetPage> {
  List<String> _filters = [];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('FilterChip 示例')),
        body: Center(
          child: Wrap(
            spacing: 8.0,
            children: [
              FilterChip(
                avatar: CircleAvatar(
                  backgroundColor: Colors.blue.shade900,
                  child: Text('F1'),
                ),
                label: Text('Filter 1'),
                selected: _filters.contains('Filter 1'),
                onSelected: (bool selected) {
                  setState(() {
                    if (selected) {
                      _filters.add('Filter 1');
                    } else {
                      _filters.remove('Filter 1');
                    }
                  });
                },
                selectedColor: Colors.blue.shade100,
                labelStyle: TextStyle(
                  fontWeight: FontWeight.bold,
                  color: _filters.contains('Filter 1')
                      ? Colors.blue.shade900
                      : Colors.grey,
                ),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(8.0),
                  side: BorderSide(
                    color: _filters.contains('Filter 1')
                        ? Colors.blue.shade900
                        : Colors.grey,
                  ),
                ),
                pressElevation: 4.0,
                shadowColor: Colors.blueAccent,
                padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
                materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                showCheckmark: false,
              ),
              FilterChip(
                avatar: CircleAvatar(
                  backgroundColor: Colors.green.shade900,
                  child: Text('F2'),
                ),
                label: Text('Filter 2'),
                selected: _filters.contains('Filter 2'),
                onSelected: (bool selected) {
                  setState(() {
                    if (selected) {
                      _filters.add('Filter 2');
                    } else {
                      _filters.remove('Filter 2');
                    }
                  });
                },
                selectedColor: Colors.green.shade100,
                labelStyle: TextStyle(
                  fontWeight: FontWeight.bold,
                  color: _filters.contains('Filter 2')
                      ? Colors.green.shade900
                      : Colors.grey,
                ),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(8.0),
                  side: BorderSide(
                    color: _filters.contains('Filter 2')
                        ? Colors.green.shade900
                        : Colors.grey,
                  ),
                ),
                pressElevation: 4.0,
                shadowColor: Colors.greenAccent,
                padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
                materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                showCheckmark: false,
              ),
            ],
          ),
        ),
      ),
    );
  }
}

在这里插入图片描述

 
 

ActionChip

ActionChip 是 Flutter 中的一种 Chip,用于表示一个可以触发操作的选项。ActionChip 支持各种自定义外观和交互行为

属性解析

const ActionChip({
    super.key,
    this.avatar,
    required this.label,
    this.labelStyle,
    this.labelPadding,
    this.onPressed,
    this.pressElevation,
    this.tooltip,
    this.side,
    this.shape,
    this.clipBehavior = Clip.none,
    this.focusNode,
    this.autofocus = false,
    this.color,
    this.backgroundColor,
    this.disabledColor,
    this.padding,
    this.visualDensity,
    this.materialTapTargetSize,
    this.elevation,
    this.shadowColor,
    this.surfaceTintColor,
    this.iconTheme,
  })
  • avatar (Widget?): 要显示在标签前的小部件,通常是一个圆形头像。
  • label (Widget): 必需参数,表示 Chip 的主要内容,通常是文本。
  • labelStyle (TextStyle?): 标签的文本样式。
  • labelPadding (EdgeInsetsGeometry?): 标签的内边距。
  • onPressed (VoidCallback?): 当 Chip 被按下时调用的回调函数。
  • pressElevation (double?): 按下时的阴影高度。
  • tooltip (String?): 此 Chip 的工具提示信息。
  • side (BorderSide?): 边框的样式。
  • shape (OutlinedBorder?): ActionChip 的形状。
  • clipBehavior (Clip): 定义 ActionChip 的剪裁行为,默认为 Clip.none。
  • focusNode (FocusNode?): 处理键盘焦点的节点。
  • autofocus (bool): 是否自动获得焦点。
  • color (Color?): ActionChip 的颜色。这已弃用,请使用 backgroundColor。
  • backgroundColor (Color?): ActionChip 的背景颜色。
  • disabledColor (Color?): Chip 禁用时的背景颜色。
  • padding (EdgeInsetsGeometry?): ActionChip 的内边距。
  • visualDensity (VisualDensity?): 定义 ActionChip 的视觉密度。
  • materialTapTargetSize (MaterialTapTargetSize?): 控制触摸目标的大小。
  • elevation (double?): ActionChip 的阴影高度。
  • shadowColor (Color?): 阴影的颜色。
  • surfaceTintColor (Color?): 表面颜色的色调。
  • iconTheme (IconThemeData?): 图标主题,用于控制图标的外观。

示例

class WidgetPage extends StatelessWidget {
  void _handleChipPress() {
    print('ActionChip 被按下');
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('ActionChip 示例')),
        body: Center(
          child: ActionChip(
            avatar: CircleAvatar(
              backgroundColor: Colors.red.shade900,
              child: Text('A'),
            ),
            label: Text('Action Chip'),
            onPressed: _handleChipPress,
            padding: EdgeInsets.all(8.0),
            labelStyle: TextStyle(
              fontWeight: FontWeight.bold,
              color: Colors.white,
            ),
            backgroundColor: Colors.redAccent,
            shape: StadiumBorder(
              side: BorderSide(color: Colors.red.shade900),
            ),
            pressElevation: 4.0,
            shadowColor: Colors.redAccent,
            materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
          ),
        ),
      ),
    );
  }
}

在这里插入图片描述

 
 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2094801.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

C语言推箱子迷宫

目录 开头程序程序的流程图程序游玩的效果下一篇博客要说的东西 开头 大家好&#xff0c;我叫这是我58。 程序 #define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <Windows.h> typedef stru…

python内置模块datetime.date类详细介绍

Python的datetime模块是一个强大的日期和时间处理库&#xff0c;它提供了多个类来处理日期和时间。主要包括几个功能类datetime.date、datetime.time、datetime.datetime、datetime.timedelta,datetime.timezone等。 使用datetime模块 要使用 datetime模块&#xff0c;直接导…

大模型辅助软件开发,助力工程师的开发之路

大模型与软件工程师&#xff1a;改变开发范式的力量 “是人类工程师的能力&#xff0c;而不是大模型的能力&#xff0c;决定了大模型协作式开发的上限。” 这句话深刻地揭示了在人工智能&#xff0c;尤其是大型语言模型&#xff08;LLM&#xff09;飞速发展的今天&#xff0c…

《数字信号处理》学习02-序列的能量及周期性

目录 一&#xff0c;序列的能量 二&#xff0c;序列的周期性 一&#xff0c;序列的能量 序列能量在数字信号处理中的应用&#xff1a;能量归一化。在信号处理中&#xff0c;有时需要对信号进行归一化处理&#xff0c;使得信号的能量为特定的值&#xff0c;这在一些算法和系统…

无主灯吊顶的精致做法:打造光影艺术的居家空间

在现代家居设计中&#xff0c;无主灯吊顶以其独特的照明效果和空间层次感&#xff0c;逐渐成为追求高品质生活人群的首选。无主灯设计不仅能够有效避免传统主灯带来的刺眼感&#xff0c;还能通过多点光源的巧妙布局&#xff0c;营造出温馨、舒适的居家氛围。作为无主灯照明灯具…

洛谷 P3183 [HAOI2016]食物链(记忆化搜索/拓扑排序)

[HAOI2016]食物链 给定 n 个物种和 m 条能量流动关系&#xff0c;求其中的食物链条数。物种的名称从 1 到 n 编号&#xff0c; M 条能量流动关系形如 a1​→b1​,a2​→b2​,a3​→b3​⋯am−1​→bm−1​,am​→bm​ 其中 ai​→bi​ 表示能量从物种 ai​ 流向物种 bi​ ,注意…

【Linux 驱动】IMX6ULL interrupt驱动

1. GIC驱动初始化 start_kernel (init\main.c) init_IRQ (arch\arm\kernel\irq.c) irqchip_init (drivers\irqchip\irqchip.c) of_irq_init (drivers\of\irq.c) desc->irq_init_cb match->data; ret desc->irq_init_cb(des…

(已开源-CVPR 2024)YOLO-World: Real-Time Open-Vocabulary Object Detection

169期《YOLO-World Real-Time Open-Vocabulary Object Detection》 You Only Look Once (YOLO) 系列检测模型是目前最常用的检测模型之一。然而&#xff0c;它们通常是在预先定义好的目标类别上进行训练&#xff0c;很大程度上限制了它们在开放场景中的可用性。为了解决这一限制…

医学领域实现基于大模型和本地知识库的智能问答系统

在医学领域实现一个基于大模型和本地知识库的智能问答系统&#xff0c;需要考虑医学领域的专业知识和术语。我们将构建一个简单版本的系统&#xff0c;该系统能够处理医学问题&#xff0c;并且能够从本地知识库中检索相关信息来生成答案。 技术栈&#xff1a; 自然语言处理模型…

编译LineageOS模拟器镜像,导出到AndroidStudio

版权归作者所有&#xff0c;如有转发&#xff0c;请注明文章出处&#xff1a;https://cyrus-studio.github.io/blog/ 源码下载 LineageOS官网&#xff1a;https://lineageos.org/ LineageOS源码 github 地址&#xff1a;https://github.com/LineageOS/android LineageOS源码国…

讯鹏科技智慧公厕专业供应商,解读智慧公厕有哪些奥秘

在当今科技日新月异的时代&#xff0c;讯鹏科技作为智慧公厕专业供应商&#xff0c;以其先进的技术和创新的解决方案&#xff0c;为人们带来了全新的公共卫生体验。那么&#xff0c;智慧公厕究竟有哪些奥秘呢&#xff1f;让我们一同解读。 一、智慧公厕硬件 1. 环境监测传感器&…

06:【江科大stm32】:定时器输入捕获功能

定时器输入捕获功能 1、通过定时器的输入捕获功能测量PWM波的频率2、PWMI模式测量频率和占空比 1、通过定时器的输入捕获功能测量PWM波的频率 定时器标准库相关的编程接口&#xff1a; ①PWM.c文件的代码如下&#xff1a; /*通过定时器TIM2生成一个分辨率为10us,频率为1KHz的…

八皇后问题代码实现(java,递归)

简介&#xff1a;著名的八皇后问题是由棋手马克斯贝瑟尔在1848年提出来的&#xff0c;要求在 8 8 的棋盘上摆放8个皇后&#xff0c;使”皇后“们不能互相攻击 &#xff0c;当任意两个皇后都不处于同一行、同一列或同一条斜线上时就不会相互攻击&#xff0c;即为目标解。 说明…

C语言中的预处理指令的其中之一——#line

目录 开头1.什么是预处理指令——#line?2.预处理指令——#line的实际应用改__FILE__宏改__LINE__宏改__FILE__宏和__LINE__宏…… 下一篇博客要说的东西 开头 大家好&#xff0c;我叫这是我58。今天&#xff0c;我们要学一下关于C语言中的预处理指令的其中之一——#line的一些…

4-6 使用bios 中断 显示字符

1 显示的逻辑 bios 首先通过中断&#xff0c;访问到 最前面的中断向量表&#xff0c;然后 通过中断向量表然后 访问到具体的 bios 的函数&#xff0c;这些函数是bios 自带的&#xff0c;具体的位置 &#xff0c; 我也不知道。只知道有这个函数。 3 显示的原理 &#xff1b; 主要…

纯蓝图事件

一、创建事件分发器 1、蓝图中可直接添加Event Dispatchers事件分发器 2、还可以设置事件的传递参数 3、直接将创建好的事件分发器拖入EventGraph中会显示出Call、Bind、UnBind、Assign等方法 二、广播事件通知 三、订阅、取消订阅事件通知

算法数学加油站:一元高斯分布(正态分布)Python精美科研绘图(PDF、CDF、PPF、ECDF曲线;QQ图)

这类博客针对算法学习时可能遇到的数学知识补充&#xff0c;但不会太多废话&#xff0c;主要是公式结合Python代码精美绘图理解&#xff01; 本期重点&#xff1a; 参数&#xff1a;期望、标准差曲线&#xff1a;概率密度曲线PDF、累积概率密度函数CDF、百分点函数PPF应用&am…

14:LDO电源模块的布局

1.器件要和边框相聚5mm的距离作为工艺边&#xff0c;工艺边可以布线&#xff0c;但不能摆放器件 LDO布局原则 ①输出靠近负载端 和DCDC布局一样

Springcloud微服务合并打包,重复路径引发的血案

你好&#xff0c;我是柳岸花开。 在微服务架构的世界里&#xff0c;各种服务之间的接口调用犹如人类的神经系统&#xff0c;构成了整个系统的核心。然而&#xff0c;正是这些看似简单的接口路径&#xff0c;可能会引发一场惊天血案。今天&#xff0c;我们就来揭开一起因“重复路…

Git高手必备:掌握这些指令,轻松玩转版本控制(一)

前言 注&#xff1a;本文下的除非特殊声明&#xff0c;否则一律不作为实际加号&#xff0c;仅表示连接 所有的版本控制系统&#xff0c;只能跟踪文本文件的改动比如txt文件&#xff0c;网页&#xff0c;所有程序的代码等&#xff0c;能清楚的知道改动了什么。但是类似于图片、…