Giter VIP home page Giter VIP logo

Comments (6)

AmosHuKe avatar AmosHuKe commented on May 20, 2024

@zengchanghuan 我也是新手,共同学习哈,
我底部导肮的代码在这里 home_screen
如果要改到左上角你可以找到对应的页面自行在顶部布局,布局相关请看这里 Widget 目录
或者使用 Material 风格的 AppBar、iOS 风格的 CupertinoNavigationBar

from mood-example.

zengchanghuan avatar zengchanghuan commented on May 20, 2024

请问我使用drawer这种方式后怎么样可以把侧边栏调出来呢?谢谢

return Scaffold(
appBar: AppBar(
title: const Text('trade club'),
),
drawer: SizedBox(
width: MediaQuery.of(context).size.width * 0.9,
child: const Profile(),
),
body: PageView(
controller: _pageViewController,
physics: const NeverScrollableScrollPhysics(),
children: _pages,
),
bottomNavigationBar: DecoratedBox(
decoration: BoxDecoration(
color:
appTheme.bottomNavigationBarTheme.backgroundColor ?? Colors.grey,
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.04), blurRadius: 24),
],
),
child: SafeArea(
child: Stack(
// alignment: Alignment.centerLeft,
children: [

          /// 菜单

          TabBar(
            enableFeedback: true,
            padding: EdgeInsets.only(left: 40.w),
            controller: _pageController,
            indicatorColor: Colors.transparent,
            labelStyle: TextStyle(
              height: 0.5.h,
              fontSize: 10.sp,
              fontWeight: FontWeight.bold,
            ),
            unselectedLabelStyle: TextStyle(
              height: 0.5.h,
              fontSize: 10.sp,
              fontWeight: FontWeight.bold,
            ),
            tabs: [
              Tab(
                key: const Key('tab_home'),
                text: S.of(context).app_bottomNavigationBar_title_home,
                icon: Icon(
                  Remix.home_line,
                  size: _tabIconSize,
                ),
              ),
              Tab(
                key: const Key('tab_mood'),
                text: S.of(context).app_bottomNavigationBar_title_mood,
                icon: Icon(
                  Remix.heart_3_line,
                  size: _tabIconSize,
                ),
              ),
              Tab(
                key: const Key('tab_statistic'),
                text: S.of(context).app_bottomNavigationBar_title_statistic,
                icon: Icon(
                  Remix.bar_chart_line,
                  size: _tabIconSize,
                ),
              ),
            ],
            onTap: (value) {
              switch (value) {
                case 2:
                  // 统计菜单触发
                  statistic.init(context);
              }
              _pageViewController.jumpToPage(value);
              setState(() {
                _currentPage = value;
              });
            },
          ),
        ],
      ),
    ),
  ),
);

from mood-example.

zengchanghuan avatar zengchanghuan commented on May 20, 2024

直接隐藏掉下面的返回按钮一直可以调用侧边栏,大牛厉害

from mood-example.

AmosHuKe avatar AmosHuKe commented on May 20, 2024

这里有写 NavigationDrawer
给 Scaffold 赋值一个 key

final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();

......

Scaffold(
    key: scaffoldKey,
    drawer: ......
)

......

然后通过当前状态打开 Drawer: scaffoldKey.currentState!.openDrawer();

from mood-example.

zengchanghuan avatar zengchanghuan commented on May 20, 2024

方便留个二维码吗?请您喝杯咖啡

from mood-example.

AmosHuKe avatar AmosHuKe commented on May 20, 2024

谢谢😄~ 不用不用,记得多多看官方文档 https://flutter.cn/

from mood-example.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.