flutter实现底部Tab和顶部导航条切换

【Flutter】自定义Tab的切换动画取巧实现 系统的TabBar并没有很好的自定义能力,为了满足设计的需求自己稍微写了一个取巧的Tab切换动画。 先看一下实现效果,没有搞动图和视频所以看不了动画。 主要需求点是: 1.点选Tab时字体需要变大,但是要保持Tab之间的间距不变。 2.底部的indicator可以自定义样式。 3.切换Tag时indicator有一个平滑(自定义)过渡动画。 4.当Tab数量过多时应该支持滑动(此项未实现,主要涉及取巧实现里的问题) 实现思路 首先先一个顶部Tab的Widget,一个简单的L. 阅读详情

目录

 

底部Tab:使用BottomNavigationBar来实现。

顶部Tab(DefaultTabController实现方式):

还有另一种实现方式:实现SingleTickerProviderStateMixin(适用于已确定要显示Tab标签)

如果是动态添加标签,就需要实现TickerProviderStateMixin,注意:不是SingleTickerProviderStateMixin,接口请求结束后,在setState中仍需要再初始化一遍TabController

有些需求会要求实现某部分布局滑到顶部后吸顶悬浮


底部Tab:使用BottomNavigationBar来实现。

class IndexPage extends StatefulWidget {
  @override
  _IndexPageState createState() => _IndexPageState();
}

class _IndexPageState extends State<IndexPage> {
  List<BottomNavigationBarItem> tabs = [
    BottomNavigationBarItem(
      icon: Image.asset("images/home_unactive.png", width: 24, height: 24),
      activeIcon: Image.asset("images/home_active.png", width: 24 height: 24),
      title: Text("首页"),
    ),
    BottomNavigationBarItem(
      icon: Image.asset("images/home_unactive.png", width: 24, height: 24),
      activeIcon: Image.asset("images/home_active.png", width: 24 height: 24),
      title: Text("分类"),
    ),
    BottomNavigationBarItem(
      icon: Image.asset("images/home_unactive.png", width: 24, height: 24),
      activeIcon: Image.asset("images/home_active.png", width: 24 height: 24),
      title: Text("购物车"),
    ),
    BottomNavigationBarItem(
      icon: Image.asset("images/home_unactive.png", width: 24, height: 24),
      activeIcon: Image.asset("images/home_active.png", width: 24 height: 24),
      title: Text("我的"),
    ),
  ];

  List<Widget> pages = [
    HomePage(),
    CategoryPage(),
    ShoppingCartPage(),
    MyPage(),
  ];

  int currentIndex = 0;
  PageController _controller = PageController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PageView(
        controller: _controller,
        children: pages,
        physics: NeverScrollableScrollPhysics(), //禁止页面滚动
      ),
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: currentIndex,
        items: tabs,
        unselectedFontSize: 13,
        selectedFontSize: 13,
        type: BottomNavigationBarType.fixed,
        onTap: (index) {
          _controller.jumpToPage(index);
          setState(() {
            currentIndex = index;
          });
        },
      ),
    );
  }
}

顶部Tab(DefaultTabController实现方式):

body: DefaultTabController(
          length: 3,//项的数量
          initialIndex: 0,//默认选择第一项
          child: Column(
            children: <Widget>[
              Container(
                color: Colors.lightBlue,
                child: AspectRatio(
                  aspectRatio: 8.0,
                  child: TabBar(
//                    isScrollable: true,//项少的话,无需滚动(自动均分屏幕宽度),多的话,设为true
                    indicatorColor: Colors.red,
                    indicatorWeight: 2,
                    unselectedLabelColor: Colors.white,
                    labelColor: Colors.red,
                    tabs: [
                      Tab(
                        text: "科技",
                      ),
                      Tab(
                        text: "汽车",
                      ),
                      Tab(
                        text: "金融",
                      ),
                    ],
                  ),
                ),
              ),
              Expanded(
                child: TabBarView(
                  children: [
                    TechFragment(),
                    CarFragment(),
                    FinanceFragment(),
                  ],
                ),
              )
            ],
          ),
        ),

还有另一种实现方式:实现SingleTickerProviderStateMixin(适用于已确定要显示Tab标签)

initState中:

tabController = TabController(length: list.length, vsync: this);

如果是动态添加标签,就需要实现TickerProviderStateMixin,注意:不是SingleTickerProviderStateMixin,接口请求结束后,在setState中仍需要再初始化一遍TabController

setState(() {
   tabController = TabController(length: list.length, vsync: this);
});

有些需求会要求实现某部分布局滑到顶部后吸顶悬浮

可以是一个tabbar,也可以是一个别的组件,但是目的都是让其吸顶悬浮在那,示例代码如下:

import 'package:flutter/material.dart';

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: PreferredSize(
        child: AppBar(
          backgroundColor: Colors.red,
        ),
        preferredSize: Size.fromHeight(0),
      ),
      body: NestedScrollView(
        headerSliverBuilder: (_, innerBoxIsScrolled) {
          return [
            SliverToBoxAdapter(//其他内容用SliverToBoxAdapter包裹
              child: Container(
                height: 150,
                color: Colors.greenAccent,
                alignment: Alignment.center,
                child: Text(
                  "头部",
                  style: TextStyle(
                    fontSize: 50,
                    color: Colors.white,
                  ),
                ),
              ),
            ),
            SliverPersistentHeader(//悬浮区
              pinned: true,
              delegate: _SliverAppBarDelegate(
                minHeight: 70,
                maxHeight: 70,
                child: Container(
                  child: Row(
                    children: <Widget>[
                      Expanded(
                        child: InkWell(
                          onTap: () {
                            print("Tab1");
                          },
                          child: Container(
                            alignment: Alignment.center,
                            child: Text("Tab1"),
                            color: Colors.red,
                          ),
                        ),
                      ),
                      Container(
                        width: 1,
                        height: 70,
                        color: Colors.white,
                      ),
                      Expanded(
                        child: InkWell(
                          onTap: () {
                            print("Tab2");
                          },
                          child: Container(
                            alignment: Alignment.center,
                            child: Text("Tab2"),
                            color: Colors.lightBlue,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ),
          ];
        },
        body: ListView.builder(//列表区
          itemCount: 30,
          itemBuilder: (_, index) {
            return Container(
              height: 60,
              alignment: Alignment(0, 0),
              child: Text("数据$index"),
            );
          },
        ),
      ),
    );
  }
}

class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
  _SliverAppBarDelegate({
    @required this.minHeight,
    @required this.maxHeight,
    @required this.child,
  });

  final double minHeight;
  final double maxHeight;
  final Widget child;

  @override
  double get minExtent => minHeight;

  @override
  double get maxExtent => maxHeight;

  @override
  Widget build(
      BuildContext context, double shrinkOffset, bool overlapsContent) {
    return SizedBox.expand(child: child);
  }

  @override
  bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
    return maxHeight != oldDelegate.maxHeight ||
        minHeight != oldDelegate.minHeight ||
        child != oldDelegate.child;
  }
}

 

 

【Flutter】三十四、Flutter常用组件——Tab导航栏 在Flutter中完成一个导航栏有两种方式:一种是通过DefaultTabController,另一种是通过TabController: 一、使用DefaultTabController import 'package:flutter/material.dart'; class TabDemo extends StatelessWidget { @override Widget buil... 阅读详情

相关推荐

Flutter组件--TabBar使用详情(分段控制器)

TabBar使用详情, TabController,分段控制器,左右滑动试图

eastWind1101的博客 1万+

Flutter控件之Tab选项卡封装

而在Flutter当中呢,可以很负责任的告诉大家,也是很简单的就可以实现,主要使用到了TabBar和TabBarView

知足常乐 3463

Flutter教程_Flutter实现底部tab切换_ Flutter BottomNavigationBar 自定义底部导航条实现底部页面tab切换

BottomNavigationBar 是底部导航条,可以让我们定义底部Tab切换,bottomNavigationBar是Scaffold组件的参数。 这是Flutter BottomNavigationBar 自定义底部导航条实现底部页面tab切换的效果 看视频的话去B站找 Dart Flutter教程,或者百度搜索 大地老师Flutter教程 BottomNavigationBar 常见...

xiaoyuan188的博客 2038

Flutter学习:关于Tab导航栏

Flutter关于Tab导航栏: 包括以下几种情况: 1、 底部Tab切换 2、 自定义顶部Tab 3、 使用TabController实现顶部Tab切换 1. 底部Tab切换 使用bottomNavigationBar实现底部Tab栏,这里需要注意控制切换的currentIndex,另外大于三个tab进行设置,type: BottomNavigationBarType.fixed配置底部tabs可以有多个按钮。 import 'package:flutter/material.dart'; import

qq_40206575的博客 1860

Flutter中BottomNavigationBar 定义底部导航条

本文介绍了Flutter中BottomNavigationBar的使用方法,用于实现底部导航栏功能。通过Scaffold组件的bottomNavigationBar属性配置,可以设置items导航按钮、图标大小、选中颜色等属性。示例代码展示了如何在main.dart中引入Tabs组件,并在Tabs.dart中实现包含首页、分类、设置三个页面的底部导航,通过currentIndex控制页面切换。每个子页面(Home、Category、Setting)都是简单的文本展示组件。

分享前端工程化、AI 应用、Agent 开发与大模型实践! 2787

R语言:基于Spatstat包的单变量和双变量平面Ripley‘s K函数分析

因为网上查找得到的R语言K函数分析的资料很少,Spatstat包的介绍也很少,所以抛砖引玉。本文简单介绍了使用R语言spatstat包的Kest,Kcross(Lcross)和Kinhom方法进行了单变量和双变量平面Ripley's K函数分析的方法及代码,希望有所帮助。

hsdcmax的博客 1万+

Flutter 底部导航栏(Tab 页)的快速实现

Flutter 底部导航栏(Tab 页)的快速实现 我们知道 Scaffold 实现了基本的 Material 布局。只要是在 Material 中定义了的单个界面显示的布局控件元素,都可以使用 Scaffold 来绘制。 如果我们想实现底部 Tab 页切换的效果,应该如何做呢? bottomNavigationBar Scaffold 的 bottomNavigationBar 属性是一个 BottomNavigationBar 类型的对象。BottomNavigationBar 是底部导航条,可以帮助

卜大爷的博客 2万+

过程挖掘(Process Mining)1——始于颜值

下周开始每周1-2篇的过程挖掘分享 过程挖掘是什么? 过程挖掘与过程管理的关系? 过程挖掘与数据挖掘的关系? 管理学还是计算机科学?

hyhy12580的博客 6236

Flutter之自定义底部导航条以及页面切换实例——Flutter基础系列

三只松鼠

houruoyu3的博客 1065

使用ArcGIS Pro进行土地利用分类的机器学习与深度学习

传统的土地利用分类方法通常依赖于手动解译和规则定义,但随着机器学习和深度学习的发展,我们现在可以利用这些技术来自动化和提高分类的精度。ArcGIS Pro是一种功能强大的GIS软件,它提供了丰富的工具和功能,可以支持土地利用分类的机器学习和深度学习。我们将首先讨论数据准备和预处理的步骤,然后介绍常用的机器学习和深度学习方法,并提供相应的源代码示例。这可以通过人工标注或半自动的方式完成。数据裁剪:根据研究区域的范围,裁剪遥感影像数据,以减少计算和存储的负担,并确保只包含感兴趣的土地利用区域。

code_program481的博客 2039

2025华为OD面试手撕代码真题目录及面试八股文

本专栏更新每年华为OD机试的高频手撕代码题,每个题目都会使用五种语言进行解答(C & C++& Java & Python & JS) 华为od机试,华为od机试真题,华为od机试E卷,华为odE卷,华为od机试真题E卷,华为OD,华为OD机试,华为OD机试真题,华为od机考,华为od机试D卷,华为od机试真题D卷,华为od手撕代码,华为od,华为od机试C卷,华为od e卷,华为2024e卷,od机试,2024E卷,华为OD机试E卷,什么是华为od,华为od介绍,全面了解华为od,2024华为od,如何备

KJ.JK 5万+

Futter基础11篇: 实现自定义AppBar 定义顶部Tab切换、底部Tab结合顶部Tab实现类似头条页面布局

效果图: Home.dart AppBarDemo.dart Categroy.dart 底部导航基本架构参考:flutter实现底部导航 main.dart import 'package:flutter/material.dart'; import 'routes/Routes.dart'; void main() => runApp(MyApp()); class MyAp...

qq_27494201的博客 744

Unreal Engine开发:角色动画与状态机_动画混合:通过混合节点实现平滑动画过渡

动画混合是提升游戏动画质量的关键技术之一。Unreal Engine提供了多种混合节点,包括BlendSpace1D、Blend Two By Bool、Blend Two By Alpha和Sequencer,每种节点适用于不同的场景。通过合理使用这些节点,可以实现平滑、自然且高效的动画过渡效果。此外,遵循最佳实践和高级应用技巧,可以进一步优化动画质量和性能。希望本节内容对你在Unreal Engine中实现动画混合有所帮助,使你的游戏角色动作更加流畅和自然。

chenlz2007的博客 1245

Flutter之自定义顶部Tab——Flutter基础系列

需求: 顶部导航条的功能实现。 效果图: DefaultTabController( length: 2, //配置顶部tab的数量 child: Scaffold( appBar: AppBar( title: Text("普通顶部导航栏"), bottom: TabBar( tabs: <Widget>[ Tab(text: "热.

houruoyu3的博客 2248

【数据集处理】中国地面气候资料日值数据集(V3.0)(含MATLAB全代码)

简介数据集数据处理

WW、forever的博客 1万+

从服务器到桌面超算:当3999美元的NVIDIA DGX Spark装上Ubuntu,普通开发者能玩出什么花?

DGX Spark的出现,标志着AI算力正在经历从"数据中心集中供给"到"个人桌面按需拥有"的范式转移。它让开发者可以在本地完成从数据预处理、模型微调到推理验证的全流程,只有在需要大规模训练时才调用云端资源。迭代速度:从按小时计费的云端调试,变成随时随地的本地实验数据主权:敏感信息永不离开本地成本可控:一次投入,长期使用,不受API调用次数限制AI算力民主化的时代,真的来了。你的下一台超级计算机,不必在云端。它就在你的桌面上,安静地等待着你的下一个创意。附录:实用资源。

QQ_778132974的博客 616

Flutter BottomNavigationBar 自定义底部导航栏,实现页面切换

Flutter BottomNavigationBar组件 BottomNavigationBar是底部导航条,可以让我们定义底部Tab切换,bottomNatigationBar是Scaffold组件的参数。 BottomNavigationBar常见属性 属性 说明 items List<BottomNavigationBarItem> 底部导航条按钮集合 iconSize icon currentIndex 默认选中第几个 onTap.

达帮主 2395

electron:解决打包后报错Cannot find module ‘X‘ 运行报错各种模块缺失问题(解决electron build打包后运行应用报错启动失败或白屏,无论模块名称是什么都能解决!)

Electron app打包后启动报错:“Cannot find module 'X'”解决方案,electron-builder 打包出现 cannot find module,electron 打包后找不到module问题,electron打包运行白屏、Can not find modules ‘x‘,electron项目打包报错,electron打包后,点击生成的exe应用程序出现Cannot find module,解决electron-build打包后运行app报错:cannot find mod

✅ 精选推荐文章 4385

Flutter BottomNavigationBar:底部导航条实现页面切换

3.items中是一个BottomNavigationBarItem的集合,里面包含图片及文字标签,视频教程中给的文字使用的是title,我在使用时提示被弃用,但可以使用label直接给文字。4.currentIndex是BottomNavigationBar 中的属性,是为底部导航页面编的号,从零开始。6. body中是我们展示的页面,我们将所有页面放在一个集合中,通过上一步中获取到的下标定位到指定页面。然后调用setState改变展示的页面。之后在body处遍历List即可。这是一个比较普遍的思路。

weixin_46136019的博客 1895

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

15 Flutter BottomNavigationBar自定义底部导航条 以及实现页面切换 以及模块化

效果: /** *FlutterBottomNavigationBar自定义底部导航条、以及实现页面切换: *BottomNavigationBar是底部导航条,可以让我们定义底部Tab切换, *bottomNavigationBar是Scaffold组件的参数。 *BottomNavigationBar常见的属性: itemsList&lt...

weixin_30522095的博客 205

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Flutter 自定义底部导航条及切换

未抽离代码 import 'package:flutter/material.dart'; import 'package:untitled1/res/data.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { // TODO: implement build return ..

qq_42572245的博客 561

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Flutter StatefulWidget 有状态组件 、 页面上绑定数据、改变页面数据、 BottomNavigationBar 自定义 底部导航条、以及实现页面切换

Flutter StatefulWidget 有状态组件 、 页面上绑定数据、改变页面数据、 BottomNavigationBar 自定义 底部导航条、以及实现页面切换

manerzi的博客 345

BottomNavigationBar 自定义 底部导航条

在flutter中,BottomNavigationBar 是底部导航条,可以让我们定义底部 Tab 切换,bottomNavigationBar是 Scaffold 组件的参数。 BottomNavigationBar 常见的属性 items :List底部导航条按钮集合 iconSize :icon currentIndex :默认选中第几个 onTap:选中变化回调函...

weixin_30443075的博客 441

Futter基础第7篇: 实现底部导航

效果图: main.dart: import 'package:flutter/material.dart'; import 'pages/Tabs.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget{ @override Widget build(BuildContext cont...

qq_27494201的博客 592

Flutter组件学习九-BottomNavigationBar(底部导航栏)

1、BottomNavigationBar 是底部导航条,可以让我们定义底部Tab切换,bottomNavigationBar是Scaffold组件的参数 1.1、属性 属性 说明 items List底部导航条按钮集合 iconSize 图标大小 currentIndex 默认选中第几个 onTap 选中变化回调函数 fixedColor 选中的颜色 type...

wmd看海的博客 318

Flutter组件--BottomNavigationBar,底部tabbar,FloatingActionButton

FloatingActionButton,tabbar,底部tabbar

eastWind1101的博客 1025
上一篇: Android热修复Tinker
下一篇: flutter状态管理---provider
尘彦
博客等级 码龄11年 92粉丝 22原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

尘彦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值