当前位置: 首页 > news >正文

Flutter_学习记录_基本组件的使用记录

1.TextWidge的常用属性

1.1TextAlign: 文本对齐属性

常用的样式有:

  • TextAlign.center 居中
  • TextAlign.left 左对齐
  • TextAlign.right 有对齐

使用案例:

body: Center(child: Text('开启 TextWidget 的旅程吧,珠珠, 开启 TextWidget 的旅程吧,珠珠开启 TextWidget 的旅程吧,珠珠开启 TextWidget 的旅程吧,珠珠',textAlign: TextAlign.center),)

1.2 maxLines: 文本显示的最大行数

使用案例:

body: Center(child: Text('开启 TextWidget 的旅程吧,珠珠, 开启 TextWidget 的旅程吧,珠珠开启 TextWidget 的旅程吧,珠珠开启 TextWidget 的旅程吧,珠珠',textAlign: TextAlign.center,maxLines: 2)

1.3 overFlow: 控制文本的溢出效果

常用的样式有:

  • TextOverflow.clip 直接截断
  • TextOverflow.ellipsis 被截断后,末尾处用… 来表示
  • TextOverflow.fade 最后一行有个阴影

使用案例:

body: Center(child: Text('开启 TextWidget 的旅程吧,珠珠, 开启 TextWidget 的旅程吧,珠珠开启 TextWidget 的旅程吧,珠珠开启 TextWidget 的旅程吧,珠珠',textAlign: TextAlign.center,maxLines: 2,overflow: TextOverflow.ellipsis),)

1.4 style 样式

style 给文本添加样式,需要用到组件TextStyle, 查看TextStyle 的定义如下:

 const TextStyle({this.inherit = true,this.color,this.backgroundColor,this.fontSize,this.fontWeight,this.fontStyle,this.letterSpacing,this.wordSpacing,this.textBaseline,this.height,this.leadingDistribution,this.locale,this.foreground,this.background,this.shadows,this.fontFeatures,this.fontVariations,this.decoration,this.decorationColor,this.decorationStyle,this.decorationThickness,this.debugLabel,String? fontFamily,List<String>? fontFamilyFallback,String? package,this.overflow,}

使用案例:

body: Center(child: Text('开启 TextWidget 的旅程吧,珠珠',textAlign: TextAlign.center,style: TextStyle(fontSize: 25.0,color: Color.fromARGB(255, 255, 150, 150),decoration: TextDecoration.underline,decorationStyle: TextDecorationStyle.solid),),)

1.5 富文本的使用

富文本主要用到两个组件:

  • RichText
  • TextSpan

代码如下:

class TextDemo extends StatelessWidget {Widget build(BuildContext context) {return RichText(text: TextSpan(text: "你好",style: TextStyle(color: Colors.deepOrange,fontSize: 34.0,fontStyle: FontStyle.italic,fontWeight: FontWeight.bold),children: [TextSpan(text: ",zhuzhu",style: TextStyle(fontSize: 17.0,color: Colors.lightGreen))]));}
}

效果图:
在这里插入图片描述

2. Container 容器组件

2.1 Alignment 属性的使用

常用样式:

/// The top left corner.
static const Alignment topLeft = Alignment(-1.0, -1.0);
/// The center point along the top edge.
static const Alignment topCenter = Alignment(0.0, -1.0);
/// The top right corner.
static const Alignment topRight = Alignment(1.0, -1.0);
/// The center point along the left edge.
static const Alignment centerLeft = Alignment(-1.0, 0.0);
/// The center point, both horizontally and vertically.
static const Alignment center = Alignment(0.0, 0.0);
/// The center point along the right edge.
static const Alignment centerRight = Alignment(1.0, 0.0);
/// The bottom left corner.
static const Alignment bottomLeft = Alignment(-1.0, 1.0);
/// The center point along the bottom edge.
static const Alignment bottomCenter = Alignment(0.0, 1.0);
/// The bottom right corner.
static const Alignment bottomRight = Alignment(1.0, 1.0);

2.2 设置宽高和颜色

高: height
宽:width
背景色:color

2.3 Padding 内边距属性的使用

两种设置方式:

  • EdgeInsets.all(xx) 上下左右的内边距统一设置
  • EdgeInsets.fromLTRB(left, top, right, bottom) 上下左右单独设置

2.4 margin外边距属性的使用

两种设置方式:

  • EdgeInsets.all(xx) 上下左右的内边距统一设置
  • EdgeInsets.fromLTRB(left, top, right, bottom) 上下左右单独设置

2.5 decoration 属性制作彩色背景

需要使用组件BoxDecoration 来设置

decoration: BoxDecoration(// LinearGradient 线性渐变,如果直接用Gradient也可以gradient: const LinearGradient(colors: [Colors.lightBlue,Colors.greenAccent,Colors.purple]))

2.6 decoration 来 添加圆角、边框、阴影

import 'package:flutter/material.dart';class TextDemo extends StatelessWidget {Widget build(BuildContext context) {return Container(color: Colors.green,child: Row(mainAxisAlignment: MainAxisAlignment.center,children: [Container(child: Icon(Icons.pool, size: 32.0, color: Colors.white),// color: Color.fromRGBO(3, 53, 255, 1.0),padding: EdgeInsets.all(8.0),margin: EdgeInsets.all(16.0),width: 90.0,height: 90.0,decoration: BoxDecoration(color: Color.fromRGBO(3, 53, 255, 1.0),// 边框// border: Border(//   top: BorderSide(//     color: Colors.orange,//     width: 3.0,//     style: BorderStyle.solid//   ),//   bottom: BorderSide(//     color: Colors.yellow,//     width: 3.0,//     style: BorderStyle.solid//   ),border: Border.all(color: Colors.orange,width: 3.0,style: BorderStyle.solid),// 圆角// borderRadius: BorderRadius.circular(8.0)borderRadius: BorderRadius.only(topLeft: Radius.circular(30.0),bottomRight: Radius.circular(30.0),),// 阴影效果boxShadow: [BoxShadow(offset: Offset(6.0, 7.0),color: Color.fromRGBO(16, 20, 188, 1.0),blurRadius: 25.0,spreadRadius: 5.0)]),)],),);}
}

效果图如下:
在这里插入图片描述

2.6 decoration 来 添加背景图

import 'package:flutter/material.dart';class TextDemo extends StatelessWidget {Widget build(BuildContext context) {return Container(decoration: BoxDecoration(image: DecorationImage(image: NetworkImage("https://i-blog.csdnimg.cn/blog_migrate/41635df939e6dd13c6d5e2af785d358b.jpeg"),// 对齐方法alignment: Alignment.topCenter,// 重复的样式// repeat: ImageRepeat.repeatYfit: BoxFit.cover,// 颜色混合colorFilter: ColorFilter.mode(// 颜色值Colors.indigoAccent.withAlpha(122),// 混合模式BlendMode.hardLight))),// color: Colors.green,child: Row(mainAxisAlignment: MainAxisAlignment.center,children: [Container(child: Icon(Icons.pool, size: 32.0, color: Colors.white),// color: Color.fromRGBO(3, 53, 255, 1.0),padding: EdgeInsets.all(8.0),margin: EdgeInsets.all(16.0),width: 90.0,height: 90.0,decoration: BoxDecoration(color: Color.fromRGBO(3, 53, 255, 1.0),// 边框// border: Border(//   top: BorderSide(//     color: Colors.orange,//     width: 3.0,//     style: BorderStyle.solid//   ),//   bottom: BorderSide(//     color: Colors.yellow,//     width: 3.0,//     style: BorderStyle.solid//   ),border: Border.all(color: Colors.orange,width: 3.0,style: BorderStyle.solid),// 圆角// borderRadius: BorderRadius.circular(8.0)borderRadius: BorderRadius.only(topLeft: Radius.circular(30.0),bottomRight: Radius.circular(30.0),),// 阴影效果boxShadow: [BoxShadow(offset: Offset(6.0, 7.0),color: Color.fromRGBO(16, 20, 188, 1.0),blurRadius: 25.0,spreadRadius: 5.0)]),)],),);}
}

效果图如下:
在这里插入图片描述

2.7 使用案例

body: Center(child: Container(alignment: Alignment.topLeft,width: 500.0,height: 300.0,// color: Colors.lightBlue,padding: const EdgeInsets.fromLTRB(50, 20, 10, 30), // 上下左右边距都一样的margin: const EdgeInsets.all(10.0),decoration: BoxDecoration(gradient: const LinearGradient(colors: [Colors.lightBlue,Colors.greenAccent,Colors.purple])),child: Text('开启 TextWidget 的旅程吧,珠珠',textAlign: TextAlign.left,style: TextStyle(fontSize: 45.0,color: Color.fromARGB(255, 255, 150, 150),decoration: TextDecoration.underline,decorationStyle: TextDecorationStyle.solid),),),)

3. Image图片组件的使用

3.1 Image Widget的集中加入形式

  1. Image.asset: 加载资源图片,会使打包时包体积过大
  2. Image.network: 网络资源图片,经常换的或者动态图片
  3. Image.file: 本地图片,比如相机照相后的图片预览

3.2 Fit 属性的使用

Fit 属性是说图片平铺的效果设置,用BoxFit组件来设置,主要有这几种样式:

  1. BoxFit.fill: 填充整个图片视图
    在这里插入图片描述

  2. BoxFit.contain :根据图片的比例完全展示在视图上,不会被裁剪。
    在这里插入图片描述

  3. BoxFit.cover: 根据图片的比例,填充这个视图,会被裁剪。
    在这里插入图片描述

  4. BoxFit.fitWidth 根据图片的宽度自适应视图
    在这里插入图片描述

  5. BoxFit.fitHeight 根据图片的高度,自适应视图
    在这里插入图片描述

3.3 图片背景色

  1. color: 设置背景色
  2. colorBlendMode: 混合模式, 用BlendMode组件来实现

代码案例:

child: Image.network('https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2024%2F1129%2F27ab50dfj00snowf20035d200u000tug008t008r.jpg&thumbnail=660x2147483647&quality=80&type=jpg',scale: 2.0,fit: BoxFit.fitHeight,color: Colors.greenAccent,colorBlendMode: BlendMode.difference,)

3.4 repeat属性的使用

需要使用ImageRepeat组件来实现,常用的模式有:

  1. ImageRepeat.repeat
  2. ImageRepeat.repeatX
  3. ImageRepeat.repeatY

3.5 本地图片的使用

首先,在项目的根目录中,添加一个文件夹, 命名为images,然后把图片拖进去,如下图:
在这里插入图片描述

其次,项目的pubspec.yaml的文件中,配置本地图片,如下图:
在这里插入图片描述

最后,在代码中引用Image.asset('images/picture_1.png'),代码如下:

import 'package:flutter/material.dart';void main() {runApp(MaterialApp(title: "图片本地展示",home: FirstPage()));
}class FirstPage extends StatelessWidget {const FirstPage({super.key});Widget build(BuildContext context) {return Scaffold(appBar: AppBar(title: Text("图片本地加载")),body: Center(// 引用本地图片的代码child: Image.asset('images/picture_1.png'),),);}
}

4. ListView 的初级使用

4.1 竖向列表的使用

代码案例1:

import 'package:flutter/material.dart';void main() => runApp(MyApp());class MyApp extends StatelessWidget {Widget build(BuildContext context) {return MaterialApp(title: 'Flutter 的demo',home: Scaffold(appBar: AppBar(title: Text('ListView Widget'),),body: ListView(children: <Widget>[ListTile(leading: Icon(Icons.accessible_forward_outlined),title: Text('标题提标题'),),ListTile(leading: Icon(Icons.accessibility_new_outlined),title: Text('标题提标题'),),ListTile(leading: Icon(Icons.access_alarm),title: Text('标题提标题'),),],),),);}
}

代码案例2:

import 'package:flutter/material.dart';void main() => runApp(MyApp());class MyApp extends StatelessWidget {Widget build(BuildContext context) {return MaterialApp(title: 'Flutter 的demo',home: Scaffold(appBar: AppBar(title: Text('ListView Widget'),),body: ListView(children: <Widget>[Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg'),Image.network('https://img1.baidu.com/it/u=1368815763,3761060632&fm=253&fmt=auto&app=138&f=JPEG?w=760&h=434'),Image.network('https://i-blog.csdnimg.cn/blog_migrate/41635df939e6dd13c6d5e2af785d358b.jpeg'),Image.network('https://img2.baidu.com/it/u=2848534206,1976619941&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=896'),],),),);}
}

效果图:
在这里插入图片描述

4.2 横向列表的使用

scrollDirection这个属性来设置列表滚动的方向:

  1. Axis.horizontal 横向滚动
  2. Axis.vertical 纵向滚动

4.3 动态列表的使用

代码案例:

import 'package:flutter/material.dart';void main() {runApp(MyApp(items: List<String>.generate(100,(i) => 'Heading $i')),);
}class MyApp extends StatelessWidget {final List<String> items;const MyApp({super.key, required this.items});Widget build(BuildContext context) {final itemList = items; // 如果items为null,则使用默认值return MaterialApp(home: Scaffold(appBar: AppBar(title: Text('Example App')),body: ListView.builder(itemCount: itemList.length,itemBuilder: (context, index) {return ListTile(title: Text(itemList[index]));},),),);}
}

5. 网络布局的使用

主要用GridView组件来实现,GridView提供了几种创建方式:

  1. GridView()
  2. GridView.builder()
  3. GridView.custom()
  4. GridView.count()

常用的属性有:

crossAxisCount: 3, 每一行展示几个item
mainAxisSpacing: 2.0, 上下的间距
crossAxisSpacing: 2.0, 左右的间距
childAspectRatio: 0.75 长和宽的比,用来设置每个子视图的大小

代码使用案例:

import 'package:flutter/material.dart';void main() {runApp(FilmExample());
}class FilmExample extends StatelessWidget {Widget build(BuildContext context) {return MaterialApp(title: "电影海报实例",home: Scaffold(appBar: AppBar(title: Text("电影海报实例"),),body: GridViewDelegateTest(),));}
}// GridViewDelegate 的使用案例
class GridViewDelegateTest extends StatelessWidget {Widget build(BuildContext context) {return GridView(gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3,  // 每一行展示几个itemmainAxisSpacing: 2.0,  // 上下的间距crossAxisSpacing: 2.0, // 左右的间距childAspectRatio: 0.75 // 长宽比),children: [Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg', fit: BoxFit.cover),Image.network('https://img1.baidu.com/it/u=1368815763,3761060632&fm=253&fmt=auto&app=138&f=JPEG?w=760&h=434', fit: BoxFit.cover),Image.network('https://i-blog.csdnimg.cn/blog_migrate/41635df939e6dd13c6d5e2af785d358b.jpeg', fit: BoxFit.cover),Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg', fit: BoxFit.cover),Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg', fit: BoxFit.cover),Image.network('https://img1.baidu.com/it/u=1368815763,3761060632&fm=253&fmt=auto&app=138&f=JPEG?w=760&h=434', fit: BoxFit.cover),Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg', fit: BoxFit.cover),Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg', fit: BoxFit.cover),Image.network('https://img2.baidu.com/it/u=2848534206,1976619941&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=896', fit: BoxFit.cover),Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg', fit: BoxFit.cover),Image.network('https://img1.baidu.com/it/u=1368815763,3761060632&fm=253&fmt=auto&app=138&f=JPEG?w=760&h=43', fit: BoxFit.cover),Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg', fit: BoxFit.cover),Image.network('https://img2.baidu.com/it/u=2848534206,1976619941&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=896', fit: BoxFit.cover),Image.network('https://i-blog.csdnimg.cn/blog_migrate/41635df939e6dd13c6d5e2af785d358b.jpeg', fit: BoxFit.cover),Image.network('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg', fit: BoxFit.cover),Image.network('https://img2.baidu.com/it/u=2848534206,1976619941&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=896', fit: BoxFit.cover),Image.network('https://i-blog.csdnimg.cn/blog_migrate/41635df939e6dd13c6d5e2af785d358b.jpeg', fit: BoxFit.cover),],);}
}

效果图:
在这里插入图片描述

6. 水平方向的布局案例

水平方向布局的设置,用Row的组件来设置,其中有个小知识点:Expanded组件,是填充组件:

如果设置了3个Expanded,表示将三个视图将屏幕的宽度3等份平铺。
如果三个视图中,中间的视图用Expanded包裹着,那第一个和第三个视图按照自身的大小展示,第二个视图填充剩余的宽度。

代码案例:

import 'package:flutter/material.dart';void main() {runApp(MyExampleApp());
}class MyExampleApp extends StatelessWidget {Widget build(BuildContext context) {return MaterialApp(title: "布局RowWidge",home: Scaffold(appBar: AppBar(title: Text("布局RowWidge案例"),),body: Row(children: [Expanded(child: ElevatedButton(onPressed: (){},style: ElevatedButton.styleFrom(foregroundColor: Colors.white,backgroundColor: Colors.redAccent, // foreground (text) color),child: Text("红色按钮"))),Expanded(child: ElevatedButton(onPressed: (){},style: ElevatedButton.styleFrom(foregroundColor: Colors.white,backgroundColor: Colors.orangeAccent, // foreground (text) color),child: Text("橙色按钮"))),Expanded(child: ElevatedButton(onPressed: (){},style: ElevatedButton.styleFrom(foregroundColor: Colors.white,backgroundColor: Colors.blueAccent, // foreground (text) color),child: Text("蓝色按钮"))),],),),);}
}

7. 垂直方向的布局案例

Column组件来实现垂直方向的布局,代码案例:

import 'package:flutter/material.dart';void main() {runApp(MyExampleApp());
}// ---布局ColumnWidge的案例---
class MyExampleApp extends StatelessWidget {Widget build(BuildContext context) {return MaterialApp(title: "垂直方向布局案例",home: Scaffold(appBar: AppBar(title: Text("垂直方向布局案例"),),body: Column(mainAxisAlignment: MainAxisAlignment.center,  // 主轴对齐方式:垂直的crossAxisAlignment: CrossAxisAlignment.center,  // 副轴对齐方式:左右的children: [Text('111111'),Expanded(child: Text('222222')),Text('333333333333')],),),);}
}

7.1 Row和Column中mainAxisAlignment

Row和Column中有个属性mainAxisAlignment设置主轴的布局方式,主要有这六种值:

  • MainAxisAlignment.start
  • MainAxisAlignment.center
  • MainAxisAlignment.end
  • MainAxisAlignment.spaceBetween
  • MainAxisAlignment.spaceAround
  • MainAxisAlignment.spaceEvenly

以column为例,对应的效果图如下:
在这里插入图片描述

7.2 Row和Column中crossAxisAlignment

Row和Column中有个属性crossAxisAlignment设置交叉轴的布局方式,交叉轴指的是跟主轴方向垂直的轴, 主要有这四种值:

CrossAxisAlignment.start
CrossAxisAlignment.center
CrossAxisAlignment.end
CrossAxisAlignment.stretch
在这里插入图片描述

8. 层叠布局案例

8.1 只有两个视图的stack的使用方法

Stack组件来实现,最少需要两个子视图,其中有个属性alignment是子控件内部按照什么对齐方式对齐:

最小是0,最大是1, 是相对于stack内部空间中,最大视图的位置来说的

代码案例:

import 'package:flutter/material.dart';void main() {runApp(MyExampleApp());
}class MyExampleApp extends StatelessWidget {Widget build(BuildContext context) {var stack = Stack(// 内部控件的对齐方式,最小是0,最大是1, 是相对于stack内部空间中,最大视图的位置来说的alignment: FractionalOffset(0.5, 0.8),  children: [CircleAvatar(backgroundImage: NetworkImage('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg'),radius: 100.0,),Container(decoration: BoxDecoration(color: Colors.blueAccent),padding: EdgeInsets.all(5.0),child: Text('ZhuZhu'),)],);return MaterialApp(title: "布局案例",home: Scaffold(appBar: AppBar(title: Text("层叠布局"),),body: Center(child: stack,),),);}
}

效果图:
在这里插入图片描述

8.2 如果stack的子视图多于2个的使用方法

如果stack子视图大于2个,那么用alignment 的对齐方式来布局,就非常的不优化,此时,可以选择Positioned组件来设置布局,代码如下:

import 'package:flutter/material.dart';void main() {runApp(MyExampleApp());
}class MyExampleApp extends StatelessWidget {Widget build(BuildContext context) {var stack = Stack(// 内部控件的对齐方式,最小是0,最大是1, 是相对于stack内部空间中,最大视图的位置来说的alignment: FractionalOffset(0.5, 0.8),  children: [CircleAvatar(backgroundImage: NetworkImage('https://pic.rmb.bdstatic.com/bjh/news/0fc6b71c59a69f39cf2e1244d10eaedc.jpeg'),radius: 100.0,),Positioned(top: 10.0,left: 10.0,child: Container(decoration: BoxDecoration(color: Colors.blueAccent),padding: EdgeInsets.all(5.0),child: Text("zhuzhu"),)),Positioned(bottom: 10.0,right: 10.0,child: Container(decoration: BoxDecoration(color: Colors.deepOrange),padding: EdgeInsets.all(5.0),child: Text("技术猪"),)),],);return MaterialApp(title: "布局案例",home: Scaffold(appBar: AppBar(title: Text("层叠布局"),),body: Center(child: stack,),),);}
}

效果图如下:
在这里插入图片描述

8. 卡片布局案例

Card组件来实现,代码如下:

import 'package:flutter/material.dart';void main() {runApp(MyExampleApp());
}class MyExampleApp extends StatelessWidget {Widget build(BuildContext context) {var card = Card(child: Column(children: [ListTile(title: Text("福建省厦门市湖里区", style: TextStyle(fontWeight: FontWeight.w700)),subtitle: Text("zhuzhu:15100001234"),leading: Icon(Icons.account_box, color: Colors.blueAccent),),Divider(),ListTile(title: Text("北京市海淀区中关村", style: TextStyle(fontWeight: FontWeight.w700)),subtitle: Text("guoguo:15100001234"),leading: Icon(Icons.account_box, color: Colors.blueAccent),),Divider(),ListTile(title: Text("上海市浦江区", style: TextStyle(fontWeight: FontWeight.w700)),subtitle: Text("xuexue:15100001234"),leading: Icon(Icons.account_box, color: Colors.blueAccent),),],),);return MaterialApp(title: "布局案例",home: Scaffold(appBar: AppBar(title: Text("层叠布局"),),body: Center(child: card,),),);}

效果图:
在这里插入图片描述

相关文章:

Flutter_学习记录_基本组件的使用记录

1.TextWidge的常用属性 1.1TextAlign: 文本对齐属性 常用的样式有&#xff1a; TextAlign.center 居中TextAlign.left 左对齐TextAlign.right 有对齐 使用案例&#xff1a; body: Center(child: Text(开启 TextWidget 的旅程吧&#xff0c;珠珠, 开启 TextWidget 的旅程吧&a…...

基于JAVA的微信点餐小程序设计与实现(LW+源码+讲解)

专注于大学生项目实战开发,讲解,毕业答疑辅导&#xff0c;欢迎高校老师/同行前辈交流合作✌。 技术范围&#xff1a;SpringBoot、Vue、SSM、HLMT、小程序、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、安卓app、大数据、物联网、机器学习等设计与开发。 主要内容&#xff1a;…...

计算机毕业设计hadoop+spark+hive民宿推荐系统 酒店推荐系统 民宿价格预测 酒店价格 预测 机器学习 深度学习 Python爬虫 HDFS集群

温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 作者简介&#xff1a;Java领…...

亲测有效!解决PyCharm下PyEMD安装报错 ModuleNotFoundError: No module named ‘PyEMD‘

解决PyCharm下PyEMD安装报错 PyEMD安装报错解决方案 PyEMD安装报错 PyCharm下通过右键自动安装PyEMD后运行报错ModuleNotFoundError: No module named ‘PyEMD’ 解决方案 通过PyCharm IDE python package搜索EMD-signal&#xff0c;选择版本后点击“install”执行安装...

Gin 应用并注册 pprof

pprof 配置与使用步骤 1. 引言 通过下面操作&#xff0c;你可以顺利集成和使用 pprof 来收集和分析 Gin 应用的性能数据。你可以查看 CPU 使用情况、内存占用、以及其他运行时性能数据&#xff0c;并通过图形化界面进行深度分析。 1. 安装依赖 首先&#xff0c;确保安装了 gi…...

Jenkins 启动

废话 这一阵子感觉空虚&#xff0c;心里空捞捞的&#xff0c;总想找点事情做&#xff0c;即使这是一件微小的事情&#xff0c;空余时间除了骑车、打球&#xff0c;偶尔朋友聚会 … 还能干什么呢&#xff1f; 当独自一人时&#xff0c;究竟可以做点什么&#xff0c;填补这空虚…...

第20篇:Python 开发进阶:使用Django进行Web开发详解

第20篇&#xff1a;使用Django进行Web开发 内容简介 在上一篇文章中&#xff0c;我们深入探讨了Flask框架的高级功能&#xff0c;并通过构建一个博客系统展示了其实际应用。本篇文章将转向Django&#xff0c;另一个功能强大且广泛使用的Python Web框架。我们将介绍Django的核…...

文献引用指南ChatGPT提示词分享

文献引用指南 在学术写作中&#xff0c;准确引用是至关重要的环节。它不仅能够为您的研究提供坚实的学术基础&#xff0c;还能确保您尊重并认可他人的学术成果&#xff0c;从而有效避免抄袭的问题。而ChatGPT在这一方面同样能够为您提供有力的支持。借助ChatGPT&#xff0c;您…...

程序代码篇---C++类.c\.h

文章目录 前言第一部分&#xff1a;C中的类1.类的定义2.成员变量&#xff08;属性&#xff09;3.成员函数&#xff08;方法&#xff09;4.访问修饰符私有受保护公有 5.构造函数和析构函数成员初始化列表方法重载 6.继承7.多态8.友元 第二部分&#xff1a;.c与.h文件头文件&…...

@RabbitListener处理重试机制完成后的异常捕获

application.properties中配置开启手动签收 spring.rabbitmq.listener.direct.acknowledge-modemanual spring.rabbitmq.listener.simple.acknowledge-modemanual定义一个重试器 Slf4j Configuration public class RabbitMQRetryConfing {Bean("customRetry")publi…...

Mac 上管理本地 Go 版本

在 Mac 上修改本地 Go 版本可以通过多种方法实现。以下是几种常见且详细的操作方案&#xff1a; 方法一&#xff1a;使用 goenv 管理多版本&#xff08;推荐&#xff09; 适用场景&#xff1a;需要频繁切换不同 Go 版本&#xff0c;适合长期开发者。 步骤&#xff1a; 安装 g…...

低代码系统-产品架构案例介绍、得帆云(八)

产品名称 得帆云DeCode低代码平台-私有化 得帆云DeMDM主数据管理平台 得帆云DeCode低代码平台-公有云 得帆云DePortal企业门户 得帆云DeFusion融合集成平台 得帆云DeHoop数据中台 名词 概念 云原生 指自己搭建的运维平台&#xff0c;区别于阿里云、腾讯云 Dehoop 指…...

免费GPU算力,不花钱部署DeepSeek-R1

在人工智能和大模型技术飞速发展的今天&#xff0c;越来越多的开发者和研究者希望能够亲自体验和微调大模型&#xff0c;以便更好地理解和应用这些先进的技术。然而&#xff0c;高昂的GPU算力成本往往成为了阻碍大家探索的瓶颈。幸运的是&#xff0c;腾讯云Cloud Studio提供了免…...

JavaEE:多线程进阶

JavaEE&#xff1a;多线程进阶 一、对比不同锁策略之间的应用场景及其区别1. 悲观锁 和 乐观锁1.1 定义和原理1.2 应用场景1.3 示例代码 2. 重量级锁 和 轻量级锁2.1 定义和原理2.2 应用场景2.3 示例代码 3. 挂起等待锁 和 自旋锁3.1 定义和原理3.2 应用场景3.3 示例代码 4. 几…...

不只是mini-react第二节:实现最简fiber

省流|总结 首先&#xff0c;我们编写JSX文件&#xff0c;并通过Babel等转换工具将其转化为createElement()函数的调用&#xff0c;最终生成虚拟 DOM&#xff08;Vdom&#xff09;格式。举个例子&#xff1a; // 原始 JSX const App <div>hi-mini-react</div>;//…...

C++实现设计模式---命令模式 (Command)

命令模式 (Command) 命令模式 是一种行为型设计模式&#xff0c;它将请求封装为一个对象&#xff0c;从而使得可以用不同的请求对客户端进行参数化、对请求排队或记录日志&#xff0c;以及支持可撤销的操作。 意图 将操作的调用者与接收者分离&#xff0c;通过将请求封装为独…...

设计模式的艺术-享元模式

结构性模式的名称、定义、学习难度和使用频率如下表所示&#xff1a; 1.如何理解享元模式 当一个软件系统在运行时产生的对象数量太多&#xff0c;将导致运行代价过高&#xff0c;带来系统性能下降等问题。 在享元模式中&#xff0c;存储这些共享实例对象的地方称为享元池&…...

Linux的权限和一些shell原理

目录 shell的原理 Linux权限 sudo命令提权 权限 文件的属性 ⽂件类型&#xff1a; 基本权限&#xff1a; chmod改权限 umask chown 该拥有者 chgrp 改所属组 最后&#xff1a; 目录权限 粘滞位 shell的原理 我们广义上的Linux系统 Linux内核Linux外壳 Linux严格…...

【Postgres_Python】使用python脚本批量创建和导入多个PG数据库

之前批量创建和导入数据库分为2个python脚本进行&#xff0c;现整合优化代码合并为一个python脚本&#xff0c;可同步实现数据库的创建和数据导入。之前的文章链接&#xff1a; 【Postgres_Python】使用python脚本批量创建PG数据库 【Postgres_Python】使用python脚本将多个.S…...

Ubuntu安装GitLab

在 Ubuntu 上安装 GitLab 的步骤如下。这里以 GitLab Community Edition&#xff08;CE&#xff09;为例&#xff1a; 前提条件 确保你的 Ubuntu 系统是 20.04 或更高版本。确保你的系统满足 GitLab 的硬件要求。 步骤 更新系统包&#xff1a; sudo apt update sudo apt upg…...

KubeSphere 容器平台高可用:环境搭建与可视化操作指南

Linux_k8s篇 欢迎来到Linux的世界&#xff0c;看笔记好好学多敲多打&#xff0c;每个人都是大神&#xff01; 题目&#xff1a;KubeSphere 容器平台高可用&#xff1a;环境搭建与可视化操作指南 版本号: 1.0,0 作者: 老王要学习 日期: 2025.06.05 适用环境: Ubuntu22 文档说…...

css实现圆环展示百分比,根据值动态展示所占比例

代码如下 <view class""><view class"circle-chart"><view v-if"!!num" class"pie-item" :style"{background: conic-gradient(var(--one-color) 0%,#E9E6F1 ${num}%),}"></view><view v-else …...

江苏艾立泰跨国资源接力:废料变黄金的绿色供应链革命

在华东塑料包装行业面临限塑令深度调整的背景下&#xff0c;江苏艾立泰以一场跨国资源接力的创新实践&#xff0c;重新定义了绿色供应链的边界。 跨国回收网络&#xff1a;废料变黄金的全球棋局 艾立泰在欧洲、东南亚建立再生塑料回收点&#xff0c;将海外废弃包装箱通过标准…...

Python爬虫(一):爬虫伪装

一、网站防爬机制概述 在当今互联网环境中&#xff0c;具有一定规模或盈利性质的网站几乎都实施了各种防爬措施。这些措施主要分为两大类&#xff1a; 身份验证机制&#xff1a;直接将未经授权的爬虫阻挡在外反爬技术体系&#xff1a;通过各种技术手段增加爬虫获取数据的难度…...

拉力测试cuda pytorch 把 4070显卡拉满

import torch import timedef stress_test_gpu(matrix_size16384, duration300):"""对GPU进行压力测试&#xff0c;通过持续的矩阵乘法来最大化GPU利用率参数:matrix_size: 矩阵维度大小&#xff0c;增大可提高计算复杂度duration: 测试持续时间&#xff08;秒&…...

【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的“no matching...“系列算法协商失败问题

【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的"no matching..."系列算法协商失败问题 摘要&#xff1a; 近期&#xff0c;在使用较新版本的OpenSSH客户端连接老旧SSH服务器时&#xff0c;会遇到 "no matching key exchange method found"​, "n…...

并发编程 - go版

1.并发编程基础概念 进程和线程 A. 进程是程序在操作系统中的一次执行过程&#xff0c;系统进行资源分配和调度的一个独立单位。B. 线程是进程的一个执行实体,是CPU调度和分派的基本单位,它是比进程更小的能独立运行的基本单位。C.一个进程可以创建和撤销多个线程;同一个进程中…...

Qemu arm操作系统开发环境

使用qemu虚拟arm硬件比较合适。 步骤如下&#xff1a; 安装qemu apt install qemu-system安装aarch64-none-elf-gcc 需要手动下载&#xff0c;下载地址&#xff1a;https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x…...

提升移动端网页调试效率:WebDebugX 与常见工具组合实践

在日常移动端开发中&#xff0c;网页调试始终是一个高频但又极具挑战的环节。尤其在面对 iOS 与 Android 的混合技术栈、各种设备差异化行为时&#xff0c;开发者迫切需要一套高效、可靠且跨平台的调试方案。过去&#xff0c;我们或多或少使用过 Chrome DevTools、Remote Debug…...

MySQL 主从同步异常处理

阅读原文&#xff1a;https://www.xiaozaoshu.top/articles/mysql-m-s-update-pk MySQL 做双主&#xff0c;遇到的这个错误&#xff1a; Could not execute Update_rows event on table ... Error_code: 1032是 MySQL 主从复制时的经典错误之一&#xff0c;通常表示&#xff…...