首页 > 其他分享 >存档main

存档main

时间:2024-07-01 10:08:40浏览次数:1  
标签:const title 存档 BottomNavigationBarItem Colors extends selectedIndex main

import 'package:flutter/material.dart';
import 'package:gowater/widget/buy-water.dart';
import 'package:gowater/widget/history.dart';
//

//

void main() {
  runApp(const GoWaterMyApp());
}

class GoWaterMyApp extends StatelessWidget {
  const GoWaterMyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'GoWater',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
            seedColor: Colors.lightBlue),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: '桶装水自动配送系统'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late int _selectedIndex = 0;

  // 创建一组彩色的容器
// 创建一组彩色的容器
  static List<Widget> pages = <Widget>[
    //Container(color: Colors.red),
    const History(),
    //
    const MyButton(),
    //
    Container(color: Colors.blue)
  ];
  //彩色容器结束

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: SafeArea(
        //child: Container(),//原始安全容器主要内容
        child: pages[_selectedIndex],
      ),
//导航开始
      bottomNavigationBar: BottomNavigationBar(
        selectedItemColor: Colors.lightBlue,
        currentIndex: _selectedIndex,
        onTap: (index) =>
            setState(() {
              _selectedIndex = index;
            }),
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.list),
            label: '历史',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.widgets),
            label: '订水',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.settings),
            label: '自己',
          ),
        ],
      ),
//导航结束
    );
  }
}

  

标签:const,title,存档,BottomNavigationBarItem,Colors,extends,selectedIndex,main
From: https://www.cnblogs.com/xiongwei/p/18277475

相关文章

  • Qt-QMain Window和QAction
        QMainWindow是主窗口类,具有菜单栏、工具栏、状态栏等主窗口常见的界面元素。要设计主窗口上的菜单栏、工具栏、、按钮的下拉菜单、组件的快捷菜单等,需要用到QAction类。QAction对象就是实现某个功能的“动作”,我们称其为Action。在UI可视化设计时,我们可以设计很......
  • 植物大战僵尸杂交版(极速下载,解锁全部植物,存档,只需要两分钟!!)
    文章目录下载夸克网盘百度网盘gitee下载压缩包/gitee拉取安装解锁全部植物游戏技巧友情提示游戏背景(可不阅)更多相关内容可查看不说废话,先玩起来下载夸克网盘有夸克网盘会员的直接用夸克网盘下载原创作者:潜艇伟伟迷B站地址:https://space.bilibili.com/97213......
  • 构建基于 LlamaIndex 的RAG AI Agent
    IbuiltacustomAIagentthatthinksandthenacts.Ididn'tinventitthough,theseagentsareknownasReActAgentsandI'llshowyouhowtobuildoneyourselfusingLlamaIndexinthistutorial.我构建了一个自定义的AI智能体,它能够思考然后行动。不过,这并不......
  • C/C++ main 函数注意事项
    main 函数是C/C++程序的入口点,当运行程序时,操作系统会调用 main 函数来启动程序。下面为 main 函数的注意事项:函数签名:在C/C++中,main 函数的标准签名通常有两种形式:intmain(){//...}intmain(intargc,char*argv[]){//...}其中,argc 是命......
  • 用idea导入maven在打包之后在web.xml文件找不到src/main/resources文件夹下的资源(已解
    一、产生原因这其实是因为在导入ssm项目时候src/main/resources下的配置文件打包丢失造成的二、解决办法1、在确定maven包都导入情况下,只有资源文件找不到(ps:不能修改绝对路径,否则项目跑不起来) 2、此时的resources文件夹是普通文件夹3、点击项目配置 4、因为之前他只是......
  • 存档-环境信息apt
    1!aptlist--installed2Listing...Done3accountsservice/now0.6.55-0ubuntu12~20.04.5amd64[installed,upgradableto:0.6.55-0ubuntu12~20.04.6]4acl/focal,now2.2.53-6amd64[installed,automatic]5adduser/focal,now3.118ubuntu2all[in......
  • 存档-环境信息conda
    3060  (Pytorch2)4090(Pytorch2)3060(Pytorch1)name:basechannels:-nvidia/label/cuda-11.8.0-defaultsdependencies:-_libgcc_mutex=0.1=main-_openmp_mutex=5.1=1_gnu-boltons=23.0.0=py310h06a4308_0-brotlipy=0.7.0=py310h7f8727e_1002-......
  • jar运行报错no main manifest attribute
    在服务器上运行:  java-jartest-0.0.1-SNAPSHOT.jar1报错:nomainmanifestattribute,intest-0.0.1-SNAPSHOT.jar1原因:原因是找不到主类。一般情况下,java打包成jar包需要在MANIFEST.MF中指定Main-Class项,以便运行java-jarxxx.jar时找到对应的主类。将test-0.......
  • c++定义了类在main函数中使用的一个坑现象的解决,让我理解了栈,堆和内存之间关系。
    首先描述一下我的坑是啥?我的坑就是写了一个对集料颗粒进行角度计算的类,在main函数中使用采用了类定义申明,这样使用导致一个坑,这个类中对于集料的数目进行了宏定义,发现数据如果超过20个,编译就报错,当时没有太在意这个坑,没有思考什么原因。也就将就者用了。后来对接同事说,这个颗粒数......
  • MainWindows移动View文件夹和使用Window.DataContext单例绑定需要修改的地方
    项目结构移动文件夹后需要修改的三个地方1、App.xaml2、MainWindow.xaml3、MainWindow.xaml.cs单例绑定需要修改的地方MainWindow.xaml ......