首页 > 其他分享 >flutter3

flutter3

时间:2024-07-01 14:52:38浏览次数:13  
标签:const title Icons label flutter3 Icon icon

import 'package:flutter/material.dart';

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

class GoWaterMyApp extends StatelessWidget {
  const GoWaterMyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      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;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
        elevation: 30.0, //阴影默认4.0

        leading: IconButton(
            icon: const Icon(Icons.menu),
            tooltip: 'Navigation',
            onPressed: () => debugPrint('Navigation button is pressed')),

        actions: <Widget>[
          //actions: <Widget>里可以设置一组小部件
          IconButton(
              icon: Icon(Icons.search),
              tooltip: 'search',
              onPressed: () => debugPrint('搜索')),
          IconButton(
              icon: const Icon(Icons.more_horiz),
              tooltip: 'more_horiz',
              onPressed: () => debugPrint('更多')),
        ],
      ),
      body: SafeArea(
        child: Container(),
      ),
//导航开始
      bottomNavigationBar: BottomNavigationBar(
        selectedItemColor: Colors.lightBlue,
        currentIndex: _selectedIndex,
        onTap: (index) => setState(() {
          _selectedIndex = index;
        }),
        //如果超过宽度则必须加下面这句
        type: BottomNavigationBarType.fixed,
        //fixedColor: Colors.black, //激活状态的颜色
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.list),
            label: '历史',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.widgets),
            label: '订水',
          ),
          BottomNavigationBarItem(icon: Icon(Icons.history), label: ('发现')),
          BottomNavigationBarItem(
            icon: Icon(Icons.settings),
            label: '自己',
          ),
        ],
      ),
//导航结束
    );
  }
}

  

标签:const,title,Icons,label,flutter3,Icon,icon
From: https://www.cnblogs.com/xiongwei/p/18278044

相关文章

  • flutter3空页面加导航
    import'package:flutter/material.dart';voidmain(){runApp(constGoWaterMyApp());}classGoWaterMyAppextendsStatelessWidget{constGoWaterMyApp({super.key});@overrideWidgetbuild(BuildContextcontext){returnMaterialApp(......
  • (更新自2024年6月)Flutter3中BottomNavigationBar的用法。
    import'package:flutter/material.dart';voidmain(){runApp(MyApp());}classMyAppextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnconstMaterialApp(home:MyHomePage(),);}}classMyH......
  • flutter3-weos手机OS系统|Flutter3.22+Getx仿ios桌面管理OA应用
    原创自研flutter3.x+getx仿制ios手机桌面UI管理系统模板Flutter3-OS。flutter3-osx基于最新跨平台技术Flutter3.22+Dart3.4+GetX+fl_chart实战仿IOS风格手机os管理系统。全新自研flutter磁贴式栅格布局引擎、分屏式多页管理、自定义主题壁纸、卡片式桌面小部件、可拖拽式悬浮球菜......
  • flutter3-macOS桌面端os系统|flutter3.x+window_manager仿mac桌面管理
    原创力作flutter3+getX+window_manager仿Mac桌面系统平台Flutter-MacOS。flutter3_macui基于最新跨端技术flutter3.19+dart3.3+window_manager+system_tray构建的一款桌面端仿MacOS风格os系统项目。支持自定义主题换肤、毛玻璃虚化背景、程序坞Dock菜单多级嵌套+自由拖拽排序、可......
  • 原创开发flutter3+getX仿抖音App短视频+直播实战
    前几天有分享一篇flutter3.19+dart3.3+getx实战开发抖音app短视频直播项目,得到了很多开发者的关注,这次就来分享下这个项目的视频讲解演示,希望有更多的小伙伴能喜欢~flutter3-douyin仿抖音app短视频直播flutter3.x_douyin跨平台仿抖音app实战开发flutter3+bitsdojo_w......
  • flutter3-dylive仿抖音App实例|Flutter3+Getx实战短视频直播应用
    原创研发flutter3+getX+mediaKit跨平台仿抖音app短视频直播实战Flutter3-DouYin。flutter3_dylive使用最新跨平台技术flutter3.x+dart3+getx+get_storage+media_kit开发手机端仿抖音app小视频直播实战项目。实现了抖音全屏式上下滑动视频、左右滑动切换页面模块,直播间进场/礼物动......
  • flutter3+dart3聊天室|Flutter3跨平台仿微信App语音聊天/朋友圈
    全新研发flutter3+dart3+photo_view跨多端仿微信App界面聊天Flutter3-Chat。flutter3-chat基于最新跨全平台技术flutter3+dart3+material-design+shared_preferences+easy_refresh构建的仿微信APP界面聊天实例项目。实现发送图文表情消息/gif大图、长按仿微信语音操作面板、图片......
  • Flutter3 TV 一百行自定义实现 tabbar tabview 联动
    系统自带的tabbar焦点在TV端无法很好的使用使用card_swiper组件作为tabviewimport'package:card_swiper/card_swiper.dart';import'package:flutter/material.dart';voidmain()=>runApp(MyApp());classMyAppextendsStatefulWidget{constMyApp({su......