07_Flutter使用NestedScrollView+TabBarView滚动位置共享问题修复

07_Flutter使用NestedScrollView+TabBarView滚动位置共享问题修复

一.案发现场

在这里插入图片描述

可以看到,上图中三个列表的滑动位置共享了,滑动其中一个列表,会影响到另外两个,这显然不符合要求,先来看下布局,再说明产生这个问题的原因:

  • 布局整体使用NestedScrollView,顶部banner和TabBar通过headerSliverBuilder创建,body为TabBarView,TabBarView中有三个列表,通过TabController与TabBar实现联动,同时每一个列表通过继承StatefulWidget构建并混入AutomaticKeepAliveClientMixin,重写wantKeepAlive的getter方法返回true,这样可以保证每次切换Tab的时候,ListView不会重新创建,实现懒加载。

    NestedScrollView(headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {return [SliverToBoxAdapter(child: Container(height: 200,color: Colors.red,alignment: Alignment.center,child: const Text("banner",style: TextStyle(color: Colors.white,fontSize: 16),),),),SliverOverlapAbsorber(handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),sliver: StickySliverToBoxAdapter(child: Container(color: Colors.white,child: TabBar(tabs: List.generate(_tabs.length, (index) {return Padding(padding: const EdgeInsets.symmetric(vertical: 15),child: Text(_tabs[index]),);}),unselectedLabelColor: const Color(0xFF7B7B7B),labelColor: const Color(0xFF5E80FF),isScrollable: false,indicatorSize: TabBarIndicatorSize.label,indicator: UnderlineTabIndicator(borderRadius: BorderRadius.circular(3),borderSide: const BorderSide(color: Color(0xFF5E80FF), width: 3),insets: const EdgeInsets.symmetric(horizontal: 3, vertical: 9)),controller: _tabController,),),),),];},body: LayoutBuilder(builder: (context, _) {return Container(padding: EdgeInsets.only(top: NestedScrollView.sliverOverlapAbsorberHandleFor(context).layoutExtent ?? 0),child: NestedTabBarView(controller: _tabController,children: List.generate(_tabs.length, (index) {return _TabInnerListView(tabName: _tabs[index],);})));})
    )class _TabInnerListViewState extends State<_TabInnerListView> with AutomaticKeepAliveClientMixin {final int length = 20;Widget build(BuildContext context) {return CustomScrollView(physics: const ClampingScrollPhysics(),slivers: [...(List.generate(length, (index) {return SliverToBoxAdapter(child: Container(height: 100,margin: const EdgeInsets.only(top: 16, left: 16, right: 16),color: Colors.orange,alignment: Alignment.center,child: Text("${widget.tabName} item $index",style: const TextStyle(color: Colors.white),),),);})),const SliverToBoxAdapter(child: SizedBox(height: 16,),)],);}bool get wantKeepAlive => true;}
    
  • 上述问题产生的原因,需要追踪NestedScrollView的源码,NestedScrollView整体的布局结构如下:

    在这里插入图片描述

    如果没有_NestedScrollCoordinator的加持,那么外层的CustomScrollView和内层的CustomScrollView就会各划各的。_NestedScrollCoordinator处理嵌套滑动是在applyUserOffset方法中完成的:

    class _NestedScrollCoordinator implements ScrollActivityDelegate, ScrollHoldController {void applyUserOffset(double delta) {updateUserScrollDirection(delta > 0.0 ? ScrollDirection.forward : ScrollDirection.reverse,);assert(delta != 0.0);if (_innerPositions.isEmpty) {_outerPosition!.applyFullDragUpdate(delta);} else if (delta < 0.0) {...} else {double innerDelta = delta;if (_floatHeaderSlivers) {innerDelta = _outerPosition!.applyClampedDragUpdate(delta);}if (innerDelta != 0.0) {double outerDelta = 0.0;final List<double> overscrolls = <double>[];final List<_NestedScrollPosition> innerPositions = _innerPositions.toList();for (final _NestedScrollPosition position in innerPositions) {final double overscroll = position.applyClampedDragUpdate(innerDelta);outerDelta = math.max(outerDelta, overscroll);overscrolls.add(overscroll);}if (outerDelta != 0.0) {outerDelta -= _outerPosition!.applyClampedDragUpdate(outerDelta);}for (int i = 0; i < innerPositions.length; ++i) {final double remainingDelta = overscrolls[i] - outerDelta;if (remainingDelta > 0.0) {innerPositions[i].applyFullDragUpdate(remainingDelta);}}}}}
    }
    

    可以看到在applyUserOffset中,是通过_NestedScrollPosition的applyFullDragUpdate响应滑动事件的,如果调用_outerPosition!.applyFullDragUpdate,则外层的CustomScrollView滑动。同理,内层CustomScrollView滑动,只不过applyUserOffset在处理内层滑动时,是遍历innerPositions把所有内层CustomScrollView的_NestedScrollPosition滚动相同的位移。

    _NestedScrollPosition? get _outerPosition {if (!_outerController.hasClients) {return null;}return _outerController.nestedPositions.single;
    }Iterable<_NestedScrollPosition> get _innerPositions {return _innerController.nestedPositions;
    }
    

    这也就解释了上图中,为什么滚动其中一个列表,其他列表也会跟着滑动相同的位置?。

二.解决方案

综上所述,_NestedScrollCoordinator的_innerPositions的返回结果是所有内层CustomScrollView的_NestedScrollPosition,要解决这个问题,我们只需要想办法将_NestedScrollCoordinator的_innerPositions的返回结果改变成只包含当前选中的内层CustomScrollView的_NestedScrollPosition即可,而_innerPositions的取值是来源于_innerController的nestedPositions。_innerController是一个_NestedScrollController对象,接着看_NestedScrollController的源码:

class _NestedScrollController extends ScrollController {...ScrollPosition createScrollPosition(ScrollPhysics physics,ScrollContext context,ScrollPosition? oldPosition,) {return _NestedScrollPosition(coordinator: coordinator,physics: physics,context: context,initialPixels: initialScrollOffset,oldPosition: oldPosition,debugLabel: debugLabel,);}void attach(ScrollPosition position) {assert(position is _NestedScrollPosition);super.attach(position);coordinator.updateParent();coordinator.updateCanDrag();position.addListener(_scheduleUpdateShadow);_scheduleUpdateShadow();}void detach(ScrollPosition position) {assert(position is _NestedScrollPosition);(position as _NestedScrollPosition).setParent(null);position.removeListener(_scheduleUpdateShadow);super.detach(position);_scheduleUpdateShadow();}...Iterable<_NestedScrollPosition> get nestedPositions {// TODO(vegorov): use instance method version of castFrom when it is available.return Iterable.castFrom<ScrollPosition, _NestedScrollPosition>(positions);}
}

可以看到_NestedScrollController是私有类,并且NestedScrollView从头到尾都没有暴露任何可以修改或替换_innerController的方法给我们,因此,想在外部直接修改是不可能的。怎么办呢?

首先,内层的每一个CustomScrollView都是我们在外部人为编写的,我们可以在外部给内层的每一个CustomScrollView重新指定ScrollController,虽然暂时没什么卵用😄,但是别着急。

class _TabInnerListViewState extends State<_TabInnerListView> with AutomaticKeepAliveClientMixin {final int length = 20;late ScrollController _scrollController;void initState() {super.initState();_scrollController = ScrollController();}void dispose() {_scrollController.dispose();super.dispose();}Widget build(BuildContext context) {return CustomScrollView(controller: _scrollController,physics: const ClampingScrollPhysics(),slivers: [...(List.generate(length, (index) {return SliverToBoxAdapter(child: Container(height: 100,margin: const EdgeInsets.only(top: 16, left: 16, right: 16),color: Colors.orange,alignment: Alignment.center,child: Text("${widget.tabName} item $index",style: const TextStyle(color: Colors.white),),),);})),const SliverToBoxAdapter(child: SizedBox(height: 16,),)],);}bool get wantKeepAlive => true;}

在这里插入图片描述

可以看到,此时嵌套滑动失效了,这是因为我们为内层的每一个CustomScrollView单独指定ScrollController后,CustomScrollView的滑动全部交给了这个这个ScrollController处理,跟NestedScrollView的_innerController已经没有半毛钱关系了。既然没有关系,那我们就建立关系,怎么建立:

  • 创建NestedInnerScrollController类继承ScrollController

  • 重写createScrollPosition方法,通过PrimaryScrollController.maybeOf(context)获取NestedScrollView的_innerController,将createScrollPosition转交给_innerController完成

  • 重写attach方法,将attach转交给_innerController完成

  • 重写detach方法,将detach转交给_innerController完成

  • 为每一个内层的CustomScrollView指定controller为NestedInnerScrollController的实例

    class NestedInnerScrollController extends ScrollController {ScrollController? _inner;NestedInnerScrollController();ScrollPosition createScrollPosition(ScrollPhysics physics, ScrollContext context, ScrollPosition? oldPosition) {ScrollPosition scrollPosition;ScrollableState? scrollableState = context as ScrollableState;if(scrollableState != null) {_inner = PrimaryScrollController.maybeOf(scrollableState.context);}if(_inner == null) {scrollPosition = super.createScrollPosition(physics, context, oldPosition);} else {scrollPosition = _inner!.createScrollPosition(physics, context, oldPosition);}return scrollPosition;}void attach(ScrollPosition position) {super.attach(position);_inner?.attach(position);}void detach(ScrollPosition position) {_inner?.detach(position);super.detach(position);}}class _TabInnerListViewState extends State<_TabInnerListView> with AutomaticKeepAliveClientMixin {final int length = 20;late ScrollController _scrollController;void initState() {super.initState();_scrollController = NestedInnerScrollController();}void dispose() {_scrollController.dispose();super.dispose();}Widget build(BuildContext context) {return CustomScrollView(controller: _scrollController,physics: const ClampingScrollPhysics(),slivers: [...(List.generate(length, (index) {return SliverToBoxAdapter(child: Container(height: 100,margin: const EdgeInsets.only(top: 16, left: 16, right: 16),color: Colors.orange,alignment: Alignment.center,child: Text("${widget.tabName} item $index",style: const TextStyle(color: Colors.white),),),);})),const SliverToBoxAdapter(child: SizedBox(height: 16,),)],);}bool get wantKeepAlive => true;}
    

    在这里插入图片描述

可以看到,嵌套滑动它又回来了😄。那么接下来…,就只剩下解决共享滑动了:

  • 将TabBarView单独定义成StatefulWidget,这样我们就可以很方便的为每一个内层的CustomScrollView维护上面定义好的NestedInnerScrollController,同时通过TabController监听TabBar的选中状态。

    class NestedTabBarView extends StatefulWidget {final TabController? controller;final List<Widget> children;final ScrollPhysics? physics;final DragStartBehavior dragStartBehavior;final double viewportFraction;final Clip clipBehavior;const NestedTabBarView({super.key,required this.children,this.controller,this.physics,this.dragStartBehavior = DragStartBehavior.start,this.viewportFraction = 1.0,this.clipBehavior = Clip.hardEdge,});State<StatefulWidget> createState() => _NestedTabBarViewState();
    }class _NestedTabBarViewState extends State<NestedTabBarView> {List<NestedInnerScrollController> _nestedInnerControllers = [];void initState() {super.initState();_initNestedInnerControllers();widget.controller?.addListener(_onTabChange);}void didUpdateWidget(covariant NestedTabBarView oldWidget) {super.didUpdateWidget(oldWidget);if(oldWidget.children.length != widget.children.length) {_initNestedInnerControllers();}}void dispose() {widget.controller?.removeListener(_onTabChange);_disposeNestedInnerControllers();super.dispose();}void _onTabChange() {}void _initNestedInnerControllers() {_disposeNestedInnerControllers();List<NestedInnerScrollController> controllers = List.generate(widget.children.length, (index) {return NestedInnerScrollController();});if(mounted) {setState(() {_nestedInnerControllers = controllers;});} else {_nestedInnerControllers = controllers;}}void _disposeNestedInnerControllers() {_nestedInnerControllers.forEach((element) {element.dispose();});}Widget build(BuildContext context) {return TabBarView(controller: widget.controller,physics: widget.physics,dragStartBehavior: widget.dragStartBehavior,viewportFraction: widget.viewportFraction,clipBehavior: widget.clipBehavior,children: widget.children);}
    }
    
  • 使用InheritedWidget,将NestedInnerScrollController暴露给对应的内层CustomScrollView使用

    class _InheritedInnerScrollController extends InheritedWidget {final ScrollController controller;const _InheritedInnerScrollController({required super.child,required this.controller});bool updateShouldNotify(covariant _InheritedInnerScrollController oldWidget) => controller != oldWidget.controller;}class _NestedTabBarViewState extends State<NestedTabBarView> {...Widget build(BuildContext context) {return TabBarView(controller: widget.controller,physics: widget.physics,dragStartBehavior: widget.dragStartBehavior,viewportFraction: widget.viewportFraction,clipBehavior: widget.clipBehavior,children: List<Widget>.generate(widget.children.length, (index) {return _InheritedInnerScrollController(controller: _nestedInnerControllers[index],child: widget.children[index],);}));}
    }class NestedInnerScrollController extends ScrollController {...static ScrollController of(BuildContext context) {final _InheritedInnerScrollController? target = context.dependOnInheritedWidgetOfExactType<_InheritedInnerScrollController>();assert(target != null,'NestedInnerScrollController.of must be called with a context that contains a NestedTabBarView\'s children.',);return target!.controller;}static ScrollController? maybeOf(BuildContext context) {final _InheritedInnerScrollController? target = context.dependOnInheritedWidgetOfExactType<_InheritedInnerScrollController>();return target?.controller;}}class _TabInnerListViewState extends State<_TabInnerListView> with AutomaticKeepAliveClientMixin {final int length = 20;Widget build(BuildContext context) {return CustomScrollView(controller: NestedInnerScrollController.maybeOf(context),physics: const ClampingScrollPhysics(),slivers: [...],);}bool get wantKeepAlive => true;}
    

    使用的时候

    NestedScrollView(headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {return [...];},body: LayoutBuilder(builder: (context, _) {return Container(padding: EdgeInsets.only(top: NestedScrollView.sliverOverlapAbsorberHandleFor(context).layoutExtent ?? 0),child: NestedTabBarView(controller: _tabController,children: List.generate(_tabs.length, (index) {return _TabInnerListView(tabName: _tabs[index],);})));})
    )
    
  • 监听TabBar的选中状态,然后通过NestedInnerScrollController将NestedScrollView的_innerController中所有的ScrollPosition detach,然后再attach与当前选中的NestedInnerScrollController对应的ScrollPosition。

    class NestedInnerScrollController extends ScrollController {...void attachCurrent() {if(_inner != null) {while(_inner!.positions.isNotEmpty) {_inner!.detach(_inner!.positions.first);}_inner!.attach(position);}}}class _NestedTabBarViewState extends State<NestedTabBarView> {...void _onTabChange() {int index = widget.controller!.index;if (index == widget.controller!.animation?.value) {_nestedInnerControllers[index].attachCurrent();}}...
    }
    

    在这里插入图片描述

搞定。

三.完整代码
class _NestedScrollPageState extends State<NestedScrollPage> with TickerProviderStateMixin {final List<String> _tabs = ["tab1", "tab2", "tab3"];late TabController _tabController;void initState() {super.initState();_tabController = TabController(length: _tabs.length, vsync: this);}void dispose() {_tabController.dispose();super.dispose();}Widget build(BuildContext context) {return Scaffold(appBar: AppBar(title: const Text("nested scroll"),),body: SafeArea(child: NestedScrollView(headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {return [SliverToBoxAdapter(child: Container(height: 200,color: Colors.red,alignment: Alignment.center,child: const Text("banner",style: TextStyle(color: Colors.white,fontSize: 16),),),),SliverOverlapAbsorber(handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),sliver: StickySliverToBoxAdapter(child: Container(color: Colors.white,child: TabBar(tabs: List.generate(_tabs.length, (index) {return Padding(padding: const EdgeInsets.symmetric(vertical: 15),child: Text(_tabs[index]),);}),unselectedLabelColor: const Color(0xFF7B7B7B),labelColor: const Color(0xFF5E80FF),isScrollable: false,indicatorSize: TabBarIndicatorSize.label,indicator: UnderlineTabIndicator(borderRadius: BorderRadius.circular(3),borderSide: const BorderSide(color: Color(0xFF5E80FF), width: 3),insets: const EdgeInsets.symmetric(horizontal: 3, vertical: 9)),controller: _tabController,),),),),];},body: LayoutBuilder(builder: (context, _) {return Container(padding: EdgeInsets.only(top: NestedScrollView.sliverOverlapAbsorberHandleFor(context).layoutExtent ?? 0),child: NestedTabBarView(controller: _tabController,children: List.generate(_tabs.length, (index) {return _TabInnerListView(tabName: _tabs[index],);})));}))),);}}class _TabInnerListView extends StatefulWidget {final String? tabName;const _TabInnerListView({this.tabName});State<StatefulWidget> createState() => _TabInnerListViewState();}class _TabInnerListViewState extends State<_TabInnerListView> with AutomaticKeepAliveClientMixin {final int length = 20;Widget build(BuildContext context) {return CustomScrollView(controller: NestedInnerScrollController.maybeOf(context),physics: const ClampingScrollPhysics(),slivers: [...(List.generate(length, (index) {return SliverToBoxAdapter(child: Container(height: 100,margin: const EdgeInsets.only(top: 16, left: 16, right: 16),color: Colors.orange,alignment: Alignment.center,child: Text("${widget.tabName} item $index",style: const TextStyle(color: Colors.white),),),);})),const SliverToBoxAdapter(child: SizedBox(height: 16,),)],);}bool get wantKeepAlive => true;}
class NestedTabBarView extends StatefulWidget {final TabController? controller;final List<Widget> children;final ScrollPhysics? physics;final DragStartBehavior dragStartBehavior;final double viewportFraction;final Clip clipBehavior;const NestedTabBarView({super.key,required this.children,this.controller,this.physics,this.dragStartBehavior = DragStartBehavior.start,this.viewportFraction = 1.0,this.clipBehavior = Clip.hardEdge,});State<StatefulWidget> createState() => _NestedTabBarViewState();
}class _NestedTabBarViewState extends State<NestedTabBarView> {List<NestedInnerScrollController> _nestedInnerControllers = [];void initState() {super.initState();_initNestedInnerControllers();widget.controller?.addListener(_onTabChange);}void didUpdateWidget(covariant NestedTabBarView oldWidget) {super.didUpdateWidget(oldWidget);if(oldWidget.children.length != widget.children.length) {_initNestedInnerControllers();}}void dispose() {widget.controller?.removeListener(_onTabChange);_disposeNestedInnerControllers();super.dispose();}void _onTabChange() {int index = widget.controller!.index;if (index == widget.controller!.animation?.value) {_nestedInnerControllers[index].attachCurrent();}}void _initNestedInnerControllers() {_disposeNestedInnerControllers();List<NestedInnerScrollController> controllers = List.generate(widget.children.length, (index) {return NestedInnerScrollController();});if(mounted) {setState(() {_nestedInnerControllers = controllers;});} else {_nestedInnerControllers = controllers;}}void _disposeNestedInnerControllers() {_nestedInnerControllers.forEach((element) {element.dispose();});}Widget build(BuildContext context) {return TabBarView(controller: widget.controller,physics: widget.physics,dragStartBehavior: widget.dragStartBehavior,viewportFraction: widget.viewportFraction,clipBehavior: widget.clipBehavior,children: List<Widget>.generate(widget.children.length, (index) {return _InheritedInnerScrollController(controller: _nestedInnerControllers[index],child: widget.children[index],);}));}
}class _InheritedInnerScrollController extends InheritedWidget {final ScrollController controller;const _InheritedInnerScrollController({required super.child,required this.controller});bool updateShouldNotify(covariant _InheritedInnerScrollController oldWidget) => controller != oldWidget.controller;}class NestedInnerScrollController extends ScrollController {ScrollController? _inner;NestedInnerScrollController();ScrollPosition createScrollPosition(ScrollPhysics physics, ScrollContext context, ScrollPosition? oldPosition) {ScrollPosition scrollPosition;ScrollableState? scrollableState = context as ScrollableState;if(scrollableState != null) {_inner = PrimaryScrollController.maybeOf(scrollableState.context);}if(_inner == null) {scrollPosition = super.createScrollPosition(physics, context, oldPosition);} else {scrollPosition = _inner!.createScrollPosition(physics, context, oldPosition);}return scrollPosition;}void attach(ScrollPosition position) {super.attach(position);_inner?.attach(position);}void detach(ScrollPosition position) {_inner?.detach(position);super.detach(position);}void attachCurrent() {if(_inner != null) {while(_inner!.positions.isNotEmpty) {_inner!.detach(_inner!.positions.first);}_inner!.attach(position);}}static ScrollController of(BuildContext context) {final _InheritedInnerScrollController? target = context.dependOnInheritedWidgetOfExactType<_InheritedInnerScrollController>();assert(target != null,'NestedInnerScrollController.of must be called with a context that contains a NestedTabBarView\'s children.',);return target!.controller;}static ScrollController? maybeOf(BuildContext context) {final _InheritedInnerScrollController? target = context.dependOnInheritedWidgetOfExactType<_InheritedInnerScrollController>();return target?.controller;}}

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

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【FL常用插件#1】Ozone11臭氧的安装和使用

本文内容收集自互联网&#xff0c;仅供个人学习参考使用&#xff0c;不允许用于商业用途&#xff0c;造成的侵权行为与本文作者无关 安装 VST2、VST3、AAX和NKS是音频技术界常见的几种插件格式&#xff0c;它们在功能和兼容性上有所不同&#xff1a; VST2 (Virtual Studio Tec…

矩阵的压缩存储介绍

引入 概述 特殊矩阵的压缩 对称矩阵 三角矩阵 对角矩阵 稀疏矩阵 三元组存储 十字链表法 示例

Linux 第二十二章

&#x1f436;博主主页&#xff1a;ᰔᩚ. 一怀明月ꦿ ❤️‍&#x1f525;专栏系列&#xff1a;线性代数&#xff0c;C初学者入门训练&#xff0c;题解C&#xff0c;C的使用文章&#xff0c;「初学」C&#xff0c;linux &#x1f525;座右铭&#xff1a;“不要等到什么都没有了…

MapReduce的Shuffle过程

Shuffle是指从 Map 产生输出开始,包括系统执行排序以及传送Map输出到Reduce作为输入的过程. Shuffle 阶段可以分为 Map 端的 Shuffle 阶段和 Reduce 端的 Shuffle 阶段. Shuffle 阶段的工作过程,如图所示: Map 端的 Shuffle 阶段 1&#xff09;每个输入分片会让一个 Map 任务…

我的256天之创作纪念日

目录 时光 数据的一些变化 开心的事 憧憬 时光 自上次CSDN的消息推送&#xff0c;又一个128天过去了&#xff0c;整天的工作和生活都在忙忙碌碌中度过&#xff0c;每到能静下来片刻&#xff0c;都倍感珍惜。因为一些原因&#xff0c;能够陪伴家人的时间越来越少&#xff…

C语言 动态内存管理

目录 1. C/C程序的内存分配2. 动态内存分配的作用3. malloc - 分配内存4. free - 释放内存5. calloc - 分配并清零内存6. realloc - 调整之前分配的内存块7. 常见的动态内存的错误7.1 对空指针解引用7.2 对动态开辟空间的越界访问7.3 对非动态开辟内存使用free7.4 使用free释放…

软件设计师-应用技术-UML建模题3

基础知识及技巧&#xff1a; 1. 用例图&#xff1a; 1.1 考点&#xff1a; 题干里面有关项目的详细描述&#xff0c;完整用例图中的某些参与者和某些用来扣掉&#xff0c;根据题干内容和已有用例图补充。根据题干&#xff0c;分析用例图之间的关系。 1.2 基础知识&#xff…

力扣:62. 不同路径

62. 不同路径 一个机器人位于一个 m x n 网格的左上角 &#xff08;起始点在下图中标记为 “Start” &#xff09;。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角&#xff08;在下图中标记为 “Finish” &#xff09;。 问总共有多少条不同的路径&…

仓库管理员如何入门?仓库管理六大步骤教会你!

新手菜鸟入行&#xff0c;如何做好一个仓库管理员&#xff1f;仓库运营对于许多行业至关重要&#xff0c;例如制造、零售和物流。它们涉及高效、安全地接收、仓储、拣选、包装和运输货物。 跟着这6个步骤做&#xff0c;最慢一个月&#xff0c;最快一周&#xff0c;就能轻松做好…

【Unity】使用Resources.LoadAll读取文件的顺序问题

最近在做客户的一个项目&#xff0c;其中的一个模块使用到了照片&#xff0c;但是发现了一个很严重的问题。当你在使用Unity的时候&#xff0c;它竟然不按照顺序读取&#xff1f;这个机器人是不是逻辑有问题&#xff1f;如下图&#xff1a; 名字脱敏了哈。。。 照片比较多&…

【计组OS】访存过程以及存储层次化结构

苏泽 本专栏纯个人笔记作用 用于记录408 学习的笔记记录&#xff08;敲了两年码实在不习惯手写笔记了&#xff09; 如果能帮助到大家当然最好 但由于是工作后退下来备考 很多说法和想法都会结合实际开发的思想 可能不是那么的纯粹应试哈 希望大家挑选自己喜欢的口味食用…

神经网络怎么把隐含层变量融合到损失函数中?

&#x1f3c6;本文收录于「Bug调优」专栏&#xff0c;主要记录项目实战过程中的Bug之前因后果及提供真实有效的解决方案&#xff0c;希望能够助你一臂之力&#xff0c;帮你早日登顶实现财富自由&#x1f680;&#xff1b;同时&#xff0c;欢迎大家关注&&收藏&&…