flutter自定义日期选择器按日、按月、自定义开始、结束时间

news2024/11/28 8:22:23

在这里插入图片描述在这里插入图片描述
导入包flutter_datetime_picker: 1.5.0
封装

import 'package:atui/jade/utils/JadeColors.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ATuiDateTimePickerDialog {
  static Future<DateTime> showDatePicker(
    BuildContext context, {
    bool showTitleActions: true,
    bool isShowDay: true,
    DateTime minTime,
    DateTime maxTime,
    DateChangedCallback onChanged,
    DateChangedCallback onConfirm,
    Function onCustomDateConfirm,
    DateCancelledCallback onCancel,
    locale: LocaleType.en,
    DateTime currentTime,
    DatePickerTheme theme,
  }) async {
    return await Navigator.push(
      context,
      _DatePickerRoute(
        showTitleActions: showTitleActions,
        onChanged: onChanged,
        onConfirm: onConfirm,
        onCustomDateConfirm: onCustomDateConfirm,
        onCancel: onCancel,
        locale: locale,
        theme: theme,
        isShowDay: isShowDay,
        barrierLabel:
            MaterialLocalizations.of(context).modalBarrierDismissLabel,
        pickerModel: DatePickerModel(
          currentTime: currentTime,
          maxTime: maxTime,
          minTime: minTime,
          locale: locale,
        ),
      ),
    );
  }
}

class _DatePickerRoute<T> extends PopupRoute<T> {
  _DatePickerRoute({
    this.showTitleActions,
    this.onChanged,
    this.onConfirm,
    this.onCustomDateConfirm,
    this.onCancel,
    theme,
    this.barrierLabel,
    this.locale,
    this.isShowDay,
    RouteSettings settings,
    pickerModel,
  })  : this.pickerModel = pickerModel ?? DatePickerModel(),
        this.theme = theme ?? DatePickerTheme(),
        super(settings: settings);

  final bool showTitleActions;
  final DateChangedCallback onChanged;
  final DateChangedCallback onConfirm;
  final Function onCustomDateConfirm;
  final DateCancelledCallback onCancel;
  final DatePickerTheme theme;
  final LocaleType locale;
  final BasePickerModel pickerModel;
  final bool isShowDay;
  
  Duration get transitionDuration => const Duration(milliseconds: 200);

  
  bool get barrierDismissible => true;

  
  final String barrierLabel;

  
  Color get barrierColor => Colors.black54;

  AnimationController _animationController;

  
  AnimationController createAnimationController() {
    assert(_animationController == null);
    _animationController =
        BottomSheet.createAnimationController(navigator.overlay);
    return _animationController;
  }

  
  Widget buildPage(BuildContext context, Animation<double> animation,
      Animation<double> secondaryAnimation) {
    Widget bottomSheet = MediaQuery.removePadding(
      context: context,
      removeTop: true,
      child: _DatePickerComponent(
        onChanged: onChanged,
        locale: this.locale,
        route: this,
        pickerModel: pickerModel,
        isShowDay: isShowDay,
      ),
    );
    return InheritedTheme.captureAll(context, bottomSheet);
  }
}

class _DatePickerComponent extends StatefulWidget {
  _DatePickerComponent(
      {Key key,
       this.route,
      this.onChanged,
      this.locale,
      this.pickerModel,
      this.isShowDay})
      : super(key: key);

  final DateChangedCallback onChanged;

  final _DatePickerRoute route;

  final LocaleType locale;

  final BasePickerModel pickerModel;

  bool isShowDay;
  
  State<StatefulWidget> createState() {
    return _DatePickerState();
  }
}

class _DatePickerState extends State<_DatePickerComponent> {
  FixedExtentScrollController leftScrollCtrl, middleScrollCtrl, rightScrollCtrl;

  List<String> _btnTitleList = ['按日','按月','自定义'];
  int _selectPosition = 0;
  bool _isCustomTime = false;
  String _startDate;
  String _endDate = '结束时间';
  int _customDateType = 1; //1:开始时间 2:结束时间

  
  void initState() {
    super.initState();
    refreshScrollOffset();
    _startDate = '${widget.pickerModel.finalTime().year}/${widget.pickerModel.finalTime().month}/${widget.pickerModel.finalTime().day}';
  }

  void refreshScrollOffset() {
//    print('refreshScrollOffset ${widget.pickerModel.currentRightIndex()}');
    leftScrollCtrl = FixedExtentScrollController(
        initialItem: widget.pickerModel.currentLeftIndex());
    middleScrollCtrl = FixedExtentScrollController(
        initialItem: widget.pickerModel.currentMiddleIndex());
    rightScrollCtrl = FixedExtentScrollController(
        initialItem: widget.pickerModel.currentRightIndex());
  }

  
  Widget build(BuildContext context) {
    DatePickerTheme theme = widget.route.theme;
    return GestureDetector(
      child: AnimatedBuilder(
        animation: widget.route.animation,
        builder: (BuildContext context, Widget child) {
          final double bottomPadding = MediaQuery.of(context).padding.bottom;
          return ClipRect(
            child: CustomSingleChildLayout(
              delegate: _BottomPickerLayout(
                widget.route.animation.value,
                theme,
                showTitleActions: widget.route.showTitleActions,
                bottomPadding: bottomPadding,
              ),
              child: GestureDetector(
                child: Material(
                  color: theme.backgroundColor ?? Colors.white,
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.only(topLeft: Radius.circular(15.0),topRight: Radius.circular(10.0)), // 设置圆角半径
                  ),
                  child: _renderPickerView(theme)
                ),
              ),
            ),
          );
        },
      ),
    );
  }

  void _notifyDateChanged() {
    if (widget.onChanged != null) {
      widget.onChanged(widget.pickerModel.finalTime());
    }
    String _date = '${widget.pickerModel.finalTime().year}/${widget.pickerModel.finalTime().month}/${widget.pickerModel.finalTime().day}';
    if(_customDateType == 1){
      _startDate = _date;
    }else if(_customDateType == 2){
      _endDate = _date;
    }
  }

  Widget _renderPickerView(DatePickerTheme theme) {
    Widget itemView = _renderItemView(theme);
    return Column(
      children: <Widget>[
        if (widget.route.showTitleActions)
        _renderTitleActionsView(theme),
        _switchBtnView(),
        itemView,
      ],
    );
  }

  Widget _renderColumnView(
    ValueKey key,
    DatePickerTheme theme,
    StringAtIndexCallBack stringAtIndexCB,
    ScrollController scrollController,
    int layoutProportion,
    ValueChanged<int> selectedChangedWhenScrolling,
    ValueChanged<int> selectedChangedWhenScrollEnd,
  ) {
    return Expanded(
      flex: layoutProportion,
      child: Container(
        padding: EdgeInsets.all(8.0),
        height: theme.containerHeight,
        decoration: BoxDecoration(color: theme.backgroundColor ?? Colors.white),
        child: NotificationListener(
          onNotification: (ScrollNotification notification) {
            if (notification.depth == 0 &&
                selectedChangedWhenScrollEnd != null &&
                notification is ScrollEndNotification &&
                notification.metrics is FixedExtentMetrics) {
              final FixedExtentMetrics metrics = notification.metrics;
              final int currentItemIndex = metrics.itemIndex;
              selectedChangedWhenScrollEnd(currentItemIndex);
            }
            return false;
          },
          child: CupertinoPicker.builder(
            key: key,
            backgroundColor: theme.backgroundColor ?? Colors.white,
            scrollController: scrollController,
            itemExtent: theme.itemHeight,
            onSelectedItemChanged: (int index) {
              selectedChangedWhenScrolling(index);
            },
            useMagnifier: true,
            itemBuilder: (BuildContext context, int index) {
              final content = stringAtIndexCB(index);
              if (content == null) {
                return null;
              }
              return Container(
                height: theme.itemHeight,
                alignment: Alignment.center,
                child: Text(
                  content,
                  style: theme.itemStyle,
                  textAlign: TextAlign.start,
                ),
              );
            },
          ),
        ),
      ),
    );
  }

  Widget _renderItemView(DatePickerTheme theme) {
    return Container(
      color: theme.backgroundColor ?? Colors.white,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: <Widget>[
          Container(
            child: widget.pickerModel.layoutProportions()[0] > 0
                ? _renderColumnView(
                    ValueKey(widget.pickerModel.currentLeftIndex()),
                    theme,
                    widget.pickerModel.leftStringAtIndex,
                    leftScrollCtrl,
                    widget.pickerModel.layoutProportions()[0], (index) {
                    widget.pickerModel.setLeftIndex(index);
                  }, (index) {
                    setState(() {
                      refreshScrollOffset();
                      _notifyDateChanged();
                    });
                  })
                : null,
          ),
          Text(
            widget.pickerModel.leftDivider(),
            style: theme.itemStyle,
          ),
          Container(
            child: widget.pickerModel.layoutProportions()[1] > 0
                ? _renderColumnView(
                    ValueKey(widget.pickerModel.currentLeftIndex()),
                    theme,
                    widget.pickerModel.middleStringAtIndex,
                    middleScrollCtrl,
                    widget.pickerModel.layoutProportions()[1], (index) {
                    widget.pickerModel.setMiddleIndex(index);
                  }, (index) {
                    setState(() {
                      refreshScrollOffset();
                      _notifyDateChanged();
                    });
                  })
                : null,
          ),
          Text(
            widget.pickerModel.rightDivider(),
            style: theme.itemStyle,
          ),
          widget.isShowDay ?? true
              ? Container(
                  child: widget.pickerModel.layoutProportions()[2] > 0
                      ? _renderColumnView(
                          ValueKey(
                              widget.pickerModel.currentMiddleIndex() * 100 +
                                  widget.pickerModel.currentLeftIndex()),
                          theme,
                          widget.pickerModel.rightStringAtIndex,
                          rightScrollCtrl,
                          widget.pickerModel.layoutProportions()[2], (index) {
                          widget.pickerModel.setRightIndex(index);
                        }, (index) {
                          setState(() {
                            refreshScrollOffset();
                            _notifyDateChanged();
                          });
                        })
                      : null,
                )
              : Container(),
        ],
      ),
    );
  }

  // Title View
  Widget _renderTitleActionsView(DatePickerTheme theme) {
    final done = _localeDone();
    final cancel = _localeCancel();

    return Container(
      height: theme.titleHeight,
      decoration: BoxDecoration(
        color: theme.headerColor ?? theme.backgroundColor ?? Colors.white,
        borderRadius: BorderRadius.only(topLeft: Radius.circular(15.0),topRight: Radius.circular(15.0))
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: <Widget>[
          Container(
            height: theme.titleHeight,
            child: CupertinoButton(
              pressedOpacity: 0.3,
              padding: EdgeInsets.only(left: 16, top: 0),
              child: Text(
                '$cancel',
                style: theme.cancelStyle,
              ),
              onPressed: () {
                Navigator.pop(context);
                if (widget.route.onCancel != null) {
                  widget.route.onCancel();
                }
              },
            ),
          ),
          Container(
            height: theme.titleHeight,
            child: CupertinoButton(
              pressedOpacity: 0.3,
              padding: EdgeInsets.only(right: 16, top: 0),
              child: Text(
                '$done',
                style: theme.doneStyle,
              ),
              onPressed: () {
                Navigator.pop(context, widget.pickerModel.finalTime());
                if (widget.route.onConfirm != null) {
                  if(!_isCustomTime){
                    widget.route.onConfirm(widget.pickerModel.finalTime());
                  }else{
                    widget.route.onCustomDateConfirm(_startDate,_endDate);
                  }
                }
              },
            ),
          ),
        ],
      ),
    );
  }

  String _localeDone() {
    return i18nObjInLocale(widget.locale)['done'];
  }

  String _localeCancel() {
    return i18nObjInLocale(widget.locale)['cancel'];
  }
  //切换按钮
  Widget _switchBtnView(){
    return Container(
      height: 120.w,
      padding: EdgeInsets.symmetric(horizontal: 30.w),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Wrap(
                  alignment: WrapAlignment.start,
                  direction: Axis.horizontal,
                  spacing: 30.w,
                  textDirection: TextDirection.ltr,
                  children: List.generate(_btnTitleList.length, (index) {
                    return GestureDetector(
                      child: Container(
                        padding: EdgeInsets.only(left: 24.w,right: 24.w,top: 10.w,bottom: 12.w),
                        decoration: BoxDecoration(
                          color: _selectPosition == index ? JadeColors.yellow : JadeColors.lightGrey,
                          borderRadius: BorderRadius.all(Radius.circular(20)),
                        ),
                        child: Text(_btnTitleList[index],style: TextStyle(fontSize: 28.sp,color: _selectPosition == index ? JadeColors.grey_2 : JadeColors.grey),),
                      ),
                      onTap: (){
                        setState(() {
                          _selectPosition = index;
                          if(_selectPosition == 0){
                            widget.isShowDay = true;
                            _isCustomTime = false;
                          }else if(_selectPosition == 1){
                            widget.isShowDay = false;
                            _isCustomTime = false;
                          }else if(_selectPosition == 2){
                            widget.isShowDay = true;
                            _isCustomTime = true;
                          }
                        });
                      },
                    );
                  })
              ),
              GestureDetector(
                child: Container(
                  padding: EdgeInsets.only(left: 20.w,right: 20.w,top: 10.w,bottom: 10.w),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(20),
                      border: Border.all(width: 1.w,color: JadeColors.grey_2)
                  ),
                  child: Text('清除筛选',style: TextStyle(fontSize: 28.sp,color: JadeColors.grey_2),),
                ),
              )
            ],
          ),
          _customDataSelectView()
        ],
      ),
    );
  }


  _customDataSelectView(){
    return _isCustomTime?Container(
      margin: EdgeInsets.only(top: 15.w),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          GestureDetector(
              child: Column(children: [
                IntrinsicWidth(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(
                        "$_startDate",
                        style: TextStyle(overflow: TextOverflow.fade, color: _customDateType == 1?JadeColors.red_6 : JadeColors.grey_7, fontSize: 30.sp),
                      ),
                      Container(
                        margin: EdgeInsets.only(top: 1.h),
                        height: 1,
                        color: _customDateType == 1?JadeColors.red_6 : JadeColors.grey_7,
                      )
                    ],
                  ),
                ),
              ]),
              onTap: () {
                setState(() {
                  _customDateType = 1;
                });
              }),
          Container(width: 30.w, height: 1, color: JadeColors.grey_7, margin: EdgeInsets.symmetric(horizontal: 40.w)),
          GestureDetector(
              child: Column(children: [
                IntrinsicWidth(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(
                        "$_endDate",
                        style: TextStyle(overflow: TextOverflow.fade, color: _customDateType == 2?JadeColors.red_6 : JadeColors.grey_7, fontSize: 30.sp),
                      ),
                      Container(
                        margin: EdgeInsets.only(top: 1.h),
                        height: 1,
                        color: _customDateType == 2?JadeColors.red_6 : JadeColors.grey_7,
                      )
                    ],
                  ),
                ),
              ]),
              onTap: () {
                setState(() {
                  _customDateType = 2;
                });
              })
        ],
      ),
    ):Container();
  }

}

class _BottomPickerLayout extends SingleChildLayoutDelegate {
  _BottomPickerLayout(
    this.progress,
    this.theme, {
    this.itemCount,
    this.showTitleActions,
    this.bottomPadding = 0,
  });

  final double progress;
  final int itemCount;
  final bool showTitleActions;
  final DatePickerTheme theme;
  final double bottomPadding;

  
  BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
    double maxHeight = theme.containerHeight;
    if (showTitleActions) {
      maxHeight += theme.titleHeight + 120.w;//增加actionTitle布局(取消、确定)时和切换按钮的布局时要在当前的布局高度上再加上去
    }

    return BoxConstraints(
      minWidth: constraints.maxWidth,
      maxWidth: constraints.maxWidth,
      minHeight: 0.0,
      maxHeight: maxHeight + bottomPadding,
    );
  }

  
  Offset getPositionForChild(Size size, Size childSize) {
    final height = size.height - childSize.height * progress;
    return Offset(0.0, height);
  }

  
  bool shouldRelayout(_BottomPickerLayout oldDelegate) {
    return progress != oldDelegate.progress;
  }
}

引用

_dateFilter() async {
    LocaleType localeType;
    await ATuiSharedPreferences.getStorage("localType")
        .then((value) {
      if (value == "zh") {
        localeType = LocaleType.zh;
      } else if (value == "en") {
        localeType = LocaleType.en;
      }
    });
    ATuiDateTimePickerDialog.showDatePicker(
      context,
      //isShowDay: false,
      locale: localeType ?? LocaleType.zh,
      theme: DatePickerTheme(
          cancelStyle: TextStyle(
              fontSize: 30.sp,
              color: JadeColors.grey_2),
          doneStyle: TextStyle(
              fontSize: 30.sp,
              color: JadeColors.grey_2,
              fontWeight: FontWeight.w600)),
      onConfirm: (datetime) async {
        String newDate = '${datetime.year}-${datetime.month}-${datetime.day}';
        newDate += datetime.month < 10
            ? '0${datetime.month}'
            : datetime.month.toString();
        print('非自定义时点击确定按钮= $newDate');
      },
      onCustomDateConfirm: (startDatetime,endDatetime) async {
        print('自定义时点击确定按钮');
        print('startDatetime= $startDatetime');
        print('endDatetime= $endDatetime');
      },
      onChanged: (datetime) {
        print('onChanged dateTime: ${datetime}');
      },
    );
  }

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

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

相关文章

040——移植数据库sqlite3到i.mx6ull

目录 一、下载 二、移植数据库 三、测试sqlite3 一、下载 SQLite Download Page 暂时先下载最新版的试试&#xff0c;我们以前其实在ubuntu上直接使用过 嵌入式数据库sqlite3_常见的嵌入式数据库-CSDN博客 当时我把常用的操作和怎么使用记录下来了 现在把他移植到开发板…

SamFirm Reborn 0.3.6.8三星固件下载器 汉化版

介绍 在三星手机的维护和升级过程中&#xff0c;固件的获取往往成为了一个难题。幸运的是&#xff0c;有一群热爱技术的开发者们&#xff0c;他们开发了各种工具以简化这个过程。今天&#xff0c;我们要介绍的是一款名为SamFirm Reborn 0.3.6.8的三星固件下载器的汉化版。它旨在…

Java8 ConcurrentHashMap 存储、扩容源码阅读

文章目录 1. 概述2. 入门实例3. 属性4. 核心方法4.1 put4.2 initTable4.3 transfer4.4 sizeCtl4.5 sizeCtl bug 1. 概述 ConcurrentHashMap 是线程安全且高效的 HashMap。 HashMap 可以看下我这篇 传送门 。 2. 入门实例 public class MyStudy {public static void main(St…

什么是数据平台——企业构建Data+AI的基础数据底座需要的决策参考

什么是数据平台 标准的解释是这样的 Wikipedia A data platform usually refers to a software platform used for collecting and managing data, and acting as a data delivery point for application and reporting software. 数据平台是指将各类数据进行整合、存储、处…

实现字符串比较函数(C语言)

一、N-S流程图&#xff1b; 二、运行结果&#xff1b; 三、源代码&#xff1b; # define _CRT_SECURE_NO_WARNINGS # include <stdio.h>int main() {//初始化变量值&#xff1b;int i, result;char s1[100], s2[100];//填充数组&#xff1b;printf("请输入数组s1的…

Docker 直接运行一个 Alpine 镜像

由于镜像很小&#xff0c;下载时间往往很短&#xff0c;读者可以直接使用 docker run 指令直接运行一个 Alpine 容器&#xff0c;并指定运行的 Linux 指令&#xff0c;例如&#xff1a; PS C:\Users\yhu> docker run alpine echo 123 Unable to find image alpine:latest lo…

docker八大架构之应用数据分离架构

数据分离架构 什么是数据分离架构&#xff1f; 数据分离架构是指应用服务&#xff08;应用层&#xff09;和数据库服务&#xff08;数据层&#xff09;使用不同的服务器来进行操作&#xff0c;如下边的两个图所示。当访问到应用层后&#xff0c;如果需要获取数据会进行访问另…

【Qt 学习笔记】Qt常用控件 | 布局管理器 | 水平布局Horizontal Layout

博客主页&#xff1a;Duck Bro 博客主页系列专栏&#xff1a;Qt 专栏关注博主&#xff0c;后期持续更新系列文章如果有错误感谢请大家批评指出&#xff0c;及时修改感谢大家点赞&#x1f44d;收藏⭐评论✍ Qt常用控件 | 布局管理器 | 水平布局Horizontal Layout 文章编号&…

基于STM32的风量控制器的Proteus仿真

文章目录 一、风量控制器1.题目要求2.思路3.仿真图4.仿真程序4.1 程序说明4.2 主函数4.2 OLED显示函数4.3 按键函数 三、总结 一、风量控制器 1.题目要求 设计一个可以风量控制器进行通信的控制板&#xff0c;该控制板由1块OLED显示屏和8个物理按键组成&#xff0c;其中显示屏…

落雪音乐 超好用的桌面端音乐播放器

之前一直都是充某Q音乐的会员&#xff0c;突然不想氪金了&#xff0c;终于找到一个开源的音乐播放器&#xff0c;在此先给落雪无痕大佬跪了 太爱了 简直白嫖怪的福音 话不多说&#xff0c;直接上操作&#xff1a;解压密码&#xff1a;www.1234f.com下载地址&#xff1a;极速云…

B/S模式的web通信(高并发服务器)

这里写目录标题 目标实现的目标 服务器代码&#xff08;采用epoll实现服务器&#xff09;整体框架main函数init_listen_fd函数&#xff08;负责对lfd初始化的那一系列操作&#xff09;epoll_run函数do_accept函数do_read函数内容补充&#xff1a;http中的getline函数 详解do_re…

DE2-115开发板基于verilog和nioⅡ的流水灯实现

目录 一、 内容概要二、 实现2.1 基于Nios II软核的流水灯2.1.1 准备工作2.1.2 工程搭建2.1.3 硬件代码设计Ⅰ 连接IP核Ⅱ 编写代码Ⅲ 各种配置 2.1.4 软件代码设计Ⅰ 环境构建Ⅱ 编写代码 2.1.5 代码下载Ⅰ 硬件下载Ⅱ 软件下载 2.1.6 运行结果 2.2 Verilog流水灯 三、 心得体…

LORA学习笔记2——训练集处理

前言 对于ai训练来说&#xff0c;处理训练集是模型训练的重要环节。训练集的质量对最终模型的质量影响巨大。这里以二次元角色为例&#xff0c;记录下训练集处理的流程和一些心得。 素材准备 素材准备有以下几个需要注意的点&#xff1a; 通常训练二次元角色需要30张以上的…

栈和队列(栈的详解)

目录 栈栈的实现栈的结构栈的初始化栈的销毁入栈出栈获取栈顶元素栈的判空获取栈的数据个数test.c(测试)总结 栈 栈也是线性表&#xff08;在逻辑上是顺序存储&#xff09;的一种&#xff0c;栈只允许其在固定的一端进行插入和删除&#xff0c;栈中的元素遵循后进先出&#xf…

Linux-笔记 开发板Uboot命令使用

将之前自学的知识整理了一下笔记&#xff0c;以便回忆 信息查询命令 1、help/?&#xff1a;查看所支持命令 > ? md md - memory displayUsage: md [.b, .w, .l] address [# of objects]2、bdinfo&#xff1a;查询板子信息 > bdinfo arch_number 0x00000000 boot_p…

多商户Docker Supervisor进程管理器部署

Dockerfile 根目录下没有Dockerfile的可以复制下面的命令 # 使用基础镜像 FROM leekay0218/crmeb-mer## 复制代码 ## 在本地调试注释掉&#xff0c;使用映射把文件映射进去 #ADD ./ /var/www# 设置工作目录 WORKDIR /var/www# 设置时区为上海 ENV TZAsia/Shanghai RUN ln -sn…

对数据进行标准化和归一化

数据的形式&#xff1a;保存在CSV中&#xff0c;第一列为姓名&#xff0c;第二列之后为特征。 标准化 输入文件的路径&#xff0c;设置保存转化后的文件路径 import pandas as pd from sklearn.preprocessing import StandardScaler# 读取CSV文件 data pd.read_csv(rC:\User…

开发时如何快速分析代码和生成测试方法(Baidu Comate插件帮我一键分析)

目录 前言 Baidu Comate智能编码助手简介 安装教程 使用RabbitMQ一个绑定队列方法进行演示 进行测试现有功能 使用感觉 测试结果 前言 因为在开发代码的时候&#xff0c;发现有很多都是废话也不是很想写注释 的&#xff0c;毕竟程序员最讨厌的两件事情&#xff0c;一…

Hikyuu高性能量化研究框架助力探索

Hikyuu Quant Framework 是一款基于C/Python的开源量化交易分析与研究工具&#xff0c;主要用于A股市场的交易策略分析与回测&#xff0c;目前不支持期货等&#xff0c;需要自行改造。 Hikyuu的目标 Hikyuu的最初目的是为了快速对A股全市场股票进行策略回测和验证&#xff0c…

windows窗口消息队列与消息过程处理函数

在Windows窗口应用程序中&#xff0c;消息队列和窗口过程函数是实现消息驱动机制的核心组件。 消息队列&#xff08;Message Queue&#xff09;&#xff1a; 消息队列是用于存储窗口消息的缓冲区。当用户与应用程序交互时&#xff0c;系统会将生成的消息插入到消息队列中&…